Skip to content

Commit

Permalink
[JAVA] use query parameter apikey if present (#19334)
Browse files Browse the repository at this point in the history
* Fix #16362

* Update samples

* Undo formatting changes

* Revert whitespace changes in samples

* make it work

---------

Co-authored-by: Jason Boileau <jason@boileau.dk>
Co-authored-by: Jason Boileau <spraot@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 14, 2024
1 parent d55525f commit 58dd030
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1450,10 +1450,6 @@ public class ApiClient {
* @throws {{invokerPackage}}.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);
final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);
// prepare HTTP request body
Expand Down Expand Up @@ -1481,10 +1477,12 @@ public class ApiClient {
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1197,10 +1197,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1228,10 +1224,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1171,10 +1171,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1202,10 +1198,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1194,10 +1194,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1225,10 +1221,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1287,10 +1287,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1318,10 +1314,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1272,10 +1272,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1303,10 +1299,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1298,10 +1294,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1270,10 +1270,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1301,10 +1297,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1273,10 +1273,6 @@ public Call buildCall(String baseUrl, String path, String method, List<Pair> que
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);

final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);

// prepare HTTP request body
Expand Down Expand Up @@ -1304,10 +1300,12 @@ public Request buildRequest(String baseUrl, String path, String method, List<Pai
reqBody = serialize(body, contentType);
}

List<Pair> updatedQueryParams = new ArrayList<>(queryParams);

// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));

final Request.Builder reqBuilder = new Request.Builder().url(url);
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);

Expand Down
Loading

0 comments on commit 58dd030

Please sign in to comment.