mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 16:02:44 +00:00
Extract out a new helper method from java ApiClients (#5648)
This commit is contained in:
@@ -1085,6 +1085,26 @@ public class ApiClient {
|
|||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Request request = buildRequest(path, method, queryParams, body, headerParams, formParams, authNames, progressRequestListener);
|
||||||
|
|
||||||
|
return httpClient.newCall(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an HTTP request with the given options.
|
||||||
|
*
|
||||||
|
* @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 body The request body object
|
||||||
|
* @param headerParams The header parameters
|
||||||
|
* @param formParams The form parameters
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return The HTTP request
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public Request buildRequest(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||||
|
|
||||||
final String url = buildUrl(path, queryParams);
|
final String url = buildUrl(path, queryParams);
|
||||||
@@ -1125,7 +1145,7 @@ public class ApiClient {
|
|||||||
request = reqBuilder.method(method, reqBody).build();
|
request = reqBuilder.method(method, reqBody).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
return httpClient.newCall(request);
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1091,6 +1091,26 @@ public class ApiClient {
|
|||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Request request = buildRequest(path, method, queryParams, body, headerParams, formParams, authNames, progressRequestListener);
|
||||||
|
|
||||||
|
return httpClient.newCall(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an HTTP request with the given options.
|
||||||
|
*
|
||||||
|
* @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 body The request body object
|
||||||
|
* @param headerParams The header parameters
|
||||||
|
* @param formParams The form parameters
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return The HTTP request
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public Request buildRequest(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||||
|
|
||||||
final String url = buildUrl(path, queryParams);
|
final String url = buildUrl(path, queryParams);
|
||||||
@@ -1131,7 +1151,7 @@ public class ApiClient {
|
|||||||
request = reqBuilder.method(method, reqBody).build();
|
request = reqBuilder.method(method, reqBody).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
return httpClient.newCall(request);
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1092,6 +1092,26 @@ public class ApiClient {
|
|||||||
* @throws ApiException If fail to serialize the request body object
|
* @throws ApiException If fail to serialize the request body object
|
||||||
*/
|
*/
|
||||||
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
|
Request request = buildRequest(path, method, queryParams, body, headerParams, formParams, authNames, progressRequestListener);
|
||||||
|
|
||||||
|
return httpClient.newCall(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build an HTTP request with the given options.
|
||||||
|
*
|
||||||
|
* @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 body The request body object
|
||||||
|
* @param headerParams The header parameters
|
||||||
|
* @param formParams The form parameters
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param progressRequestListener Progress request listener
|
||||||
|
* @return The HTTP request
|
||||||
|
* @throws ApiException If fail to serialize the request body object
|
||||||
|
*/
|
||||||
|
public Request buildRequest(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||||
|
|
||||||
final String url = buildUrl(path, queryParams);
|
final String url = buildUrl(path, queryParams);
|
||||||
@@ -1132,7 +1152,7 @@ public class ApiClient {
|
|||||||
request = reqBuilder.method(method, reqBody).build();
|
request = reqBuilder.method(method, reqBody).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
return httpClient.newCall(request);
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user