Skip to content

Commit

Permalink
Extract out a new helper method from java ApiClients
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanburns committed May 16, 2017
1 parent 63facc0 commit 9c25b7a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,12 @@ 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);
}

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 +1131,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,12 @@ 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);
}

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 +1137,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,12 @@ 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);
}

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 +1138,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 9c25b7a

Please sign in to comment.