Skip to content

Commit

Permalink
Extract out a new helper method from java ApiClients (#5648)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendandburns authored and wing328 committed May 16, 2017
1 parent 63facc0 commit c5d1c5d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,26 @@ public class ApiClient {
* @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 {
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);
final String url = buildUrl(path, queryParams);
Expand Down Expand Up @@ -1125,7 +1145,7 @@ public class ApiClient {
request = reqBuilder.method(method, reqBody).build();
}

return httpClient.newCall(request);
return request;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,26 @@ public <T> T handleResponse(Response response, Type returnType) throws ApiExcept
* @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 {
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);

final String url = buildUrl(path, queryParams);
Expand Down Expand Up @@ -1131,7 +1151,7 @@ public Call buildCall(String path, String method, List<Pair> queryParams, Object
request = reqBuilder.method(method, reqBody).build();
}

return httpClient.newCall(request);
return request;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,26 @@ public <T> T handleResponse(Response response, Type returnType) throws ApiExcept
* @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 {
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);

final String url = buildUrl(path, queryParams);
Expand Down Expand Up @@ -1132,7 +1152,7 @@ public Call buildCall(String path, String method, List<Pair> queryParams, Object
request = reqBuilder.method(method, reqBody).build();
}

return httpClient.newCall(request);
return request;
}

/**
Expand Down

0 comments on commit c5d1c5d

Please sign in to comment.