Improve Apache Httpclient support (#10624)

* Move apache-httpclient templates to proper dir

* Add template for Gradle

* Fix few JavaDoc compile warnings

* Add properly generated samples

* Empty just trigger PR checks rebuild
This commit is contained in:
Maciej Sitarz
2021-10-23 08:57:32 +02:00
committed by GitHub
parent 27459b5003
commit 2875c7e14d
17 changed files with 1100 additions and 293 deletions

View File

@@ -50,14 +50,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:
```groovy
repositories {
mavenCentral() // Needed if the 'petstore-apache-httpclient' jar has been published to maven central.
mavenLocal() // Needed if the 'petstore-apache-httpclient' jar has been published to the local maven repo.
}
dependencies {
implementation "org.openapitools:petstore-apache-httpclient:1.0.0"
}
compile "org.openapitools:petstore-apache-httpclient:1.0.0"
```
### Others

View File

@@ -119,7 +119,7 @@ ext {
jackson_databind_nullable_version = "0.2.1"
jakarta_annotation_version = "1.3.5"
jackson_threetenbp_version = "2.9.10"
jersey_version = "1.19.4"
httpclient_version = "4.5.13"
jodatime_version = "2.9.9"
junit_version = "4.13.1"
}
@@ -127,8 +127,8 @@ ext {
dependencies {
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "com.sun.jersey:jersey-client:$jersey_version"
implementation "com.sun.jersey.contribs:jersey-multipart:$jersey_version"
implementation "org.apache.httpcomponents:httpclient:$httpclient_version"
implementation "org.apache.httpcomponents:httpmime:$httpclient_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"

View File

@@ -228,16 +228,16 @@
</dependency>
<!-- HTTP client: jersey-client -->
<!-- HTTP client: apache client -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient-version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>${jersey-version}</version>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpclient-version}</version>
</dependency>
<!-- JSON processing: jackson -->
@@ -288,7 +288,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.21</swagger-annotations-version>
<jersey-version>1.19.4</jersey-version>
<httpclient-version>4.5.13</httpclient-version>
<jackson-version>2.12.1</jackson-version>
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>

View File

@@ -19,21 +19,33 @@ import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.GZIPContentEncodingFilter;
import com.sun.jersey.api.client.filter.LoggingFilter;
import com.sun.jersey.api.client.WebResource.Builder;
import com.sun.jersey.multipart.FormDataMultiPart;
import com.sun.jersey.multipart.file.FileDataBodyPart;
import javax.ws.rs.core.Cookie;
import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.core.MediaType;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.FileEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.cookie.BasicClientCookie;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.apache.http.cookie.Cookie;
import java.util.Collection;
import java.util.Collections;
@@ -46,11 +58,20 @@ import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.net.URLEncoder;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.nio.file.Paths;
import java.lang.reflect.Type;
import java.net.URI;
import java.text.DateFormat;
@@ -76,8 +97,9 @@ public class ApiClient extends JavaTimeFormatter {
private boolean debugging = false;
private int connectionTimeout = 0;
private Client httpClient;
private CloseableHttpClient httpClient;
private ObjectMapper objectMapper;
protected String tempFolderPath = null;
private Map<String, Authentication> authentications;
@@ -86,7 +108,10 @@ public class ApiClient extends JavaTimeFormatter {
private DateFormat dateFormat;
public ApiClient() {
// Methods that can have a request body
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
public ApiClient(CloseableHttpClient httpClient) {
objectMapper = new ObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -116,33 +141,17 @@ public class ApiClient extends JavaTimeFormatter {
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
rebuildHttpClient();
this.httpClient = httpClient;
}
public ApiClient() {
this(HttpClients.createDefault());
}
public static DateFormat buildDefaultDateFormat() {
return new RFC3339DateFormat();
}
/**
* Build the Client used to make HTTP requests with the latest settings,
* i.e. objectMapper and debugging.
* TODO: better to use the Builder Pattern?
* @return API client
*/
public ApiClient rebuildHttpClient() {
// Add the JSON serialization support to Jersey
JacksonJsonProvider jsonProvider = new JacksonJsonProvider(objectMapper);
DefaultClientConfig conf = new DefaultClientConfig();
conf.getSingletons().add(jsonProvider);
Client client = Client.create(conf);
client.addFilter(new GZIPContentEncodingFilter(false));
if (debugging) {
client.addFilter(new LoggingFilter());
}
this.httpClient = client;
return this;
}
/**
* Returns the current object mapper used for JSON serialization/deserialization.
* <p>
@@ -155,18 +164,22 @@ public class ApiClient extends JavaTimeFormatter {
return objectMapper;
}
/**
* @return API client
*/
public ApiClient setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
// Need to rebuild the Client as it depends on object mapper.
rebuildHttpClient();
return this;
}
public Client getHttpClient() {
public CloseableHttpClient getHttpClient() {
return httpClient;
}
public ApiClient setHttpClient(Client httpClient) {
/**
* @return API client
*/
public ApiClient setHttpClient(CloseableHttpClient httpClient) {
this.httpClient = httpClient;
return this;
}
@@ -175,6 +188,9 @@ public class ApiClient extends JavaTimeFormatter {
return basePath;
}
/**
* @return API client
*/
public ApiClient setBasePath(String basePath) {
this.basePath = basePath;
return this;
@@ -184,6 +200,9 @@ public class ApiClient extends JavaTimeFormatter {
return servers;
}
/**
* @return API client
*/
public ApiClient setServers(List<ServerConfiguration> servers) {
this.servers = servers;
return this;
@@ -193,6 +212,9 @@ public class ApiClient extends JavaTimeFormatter {
return serverIndex;
}
/**
* @return API client
*/
public ApiClient setServerIndex(Integer serverIndex) {
this.serverIndex = serverIndex;
return this;
@@ -202,6 +224,9 @@ public class ApiClient extends JavaTimeFormatter {
return serverVariables;
}
/**
* @return API client
*/
public ApiClient setServerVariables(Map<String, String> serverVariables) {
this.serverVariables = serverVariables;
return this;
@@ -241,16 +266,28 @@ public class ApiClient extends JavaTimeFormatter {
return authentications.get(authName);
}
/**
* The path of temporary folder used to store downloaded files from endpoints
* with file response. The default value is <code>null</code>, i.e. using
* the system's default temporary folder.
*
* @return Temp folder path
*/
public String getTempFolderPath() {
return tempFolderPath;
}
/**
* Helper method to set username for the first HTTP basic authentication.
* @param username Username
* @return API client
*/
public void setUsername(String username) {
public ApiClient setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setUsername(username);
return;
return this;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
@@ -259,12 +296,13 @@ public class ApiClient extends JavaTimeFormatter {
/**
* Helper method to set password for the first HTTP basic authentication.
* @param password Password
* @return API client
*/
public void setPassword(String password) {
public ApiClient setPassword(String password) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
return this;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
@@ -274,12 +312,13 @@ public class ApiClient extends JavaTimeFormatter {
/**
* Helper method to set API key value for the first API key authentication.
* @param apiKey the API key
* @return API client
*/
public void setApiKey(String apiKey) {
public ApiClient setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKey(apiKey);
return;
return this;
}
}
throw new RuntimeException("No API key authentication configured!");
@@ -288,12 +327,13 @@ public class ApiClient extends JavaTimeFormatter {
/**
* Helper method to set API key prefix for the first API key authentication.
* @param apiKeyPrefix API key prefix
* @return API client
*/
public void setApiKeyPrefix(String apiKeyPrefix) {
public ApiClient setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
return;
return this;
}
}
throw new RuntimeException("No API key authentication configured!");
@@ -303,12 +343,13 @@ public class ApiClient extends JavaTimeFormatter {
/**
* Helper method to set access token for the first OAuth2 authentication.
* @param accessToken Access token
* @return API client
*/
public void setAccessToken(String accessToken) {
public ApiClient setAccessToken(String accessToken) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken);
return;
return this;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
@@ -325,6 +366,16 @@ public class ApiClient extends JavaTimeFormatter {
return this;
}
/**
* Set temp folder path
* @param tempFolderPath Temp folder path
* @return API client
*/
public ApiClient setTempFolderPath(String tempFolderPath) {
this.tempFolderPath = tempFolderPath;
return this;
}
/**
* Add a default header.
*
@@ -364,9 +415,8 @@ public class ApiClient extends JavaTimeFormatter {
* @return API client
*/
public ApiClient setDebugging(boolean debugging) {
// TODO: implement debugging mode
this.debugging = debugging;
// Need to rebuild the Client as it depends on the value of debugging.
rebuildHttpClient();
return this;
}
@@ -387,7 +437,6 @@ public class ApiClient extends JavaTimeFormatter {
*/
public ApiClient setConnectTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
httpClient.setConnectTimeout(connectionTimeout);
return this;
}
@@ -408,8 +457,6 @@ public class ApiClient extends JavaTimeFormatter {
this.dateFormat = dateFormat;
// Also set the date format for model (de)serialization with Date properties.
this.objectMapper.setDateFormat((DateFormat) dateFormat.clone());
// Need to rebuild the Client as objectMapper changes.
rebuildHttpClient();
return this;
}
@@ -600,6 +647,46 @@ public class ApiClient extends JavaTimeFormatter {
}
}
/**
* Transform response headers into map
*/
protected Map<String, List<String>> transformResponseHeaders(Header[] headers) {
Map<String, List<String>> headersMap = new HashMap<>();
for (Header header : headers) {
List<String> valuesList = headersMap.get(header.getName());
if (valuesList != null) {
valuesList.add(header.getValue());
} else {
valuesList = new ArrayList<>();
valuesList.add(header.getValue());
headersMap.put(header.getName(), valuesList);
}
}
return headersMap;
}
/**
* Parse content type object from header value
*/
private ContentType getContentType(String headerValue) throws ApiException {
try {
return ContentType.parse(headerValue);
} catch (ParseException e) {
throw new ApiException("Could not parse content type " + headerValue);
}
}
/**
* Get content type of a response or null if one was not provided
*/
private String getResponseMimeType(HttpResponse response) throws ApiException {
Header contentTypeHeader = response.getFirstHeader("Content-Type");
if (contentTypeHeader != null) {
return getContentType(contentTypeHeader.getValue()).getMimeType();
}
return null;
}
/**
* Serialize the given Java object into string according the given
* Content-Type (only JSON is supported for now).
@@ -609,33 +696,118 @@ public class ApiClient extends JavaTimeFormatter {
* @return Object
* @throws ApiException API exception
*/
public Object serialize(Object obj, String contentType, Map<String, Object> formParams) throws ApiException {
if (contentType.startsWith("multipart/form-data")) {
FormDataMultiPart mp = new FormDataMultiPart();
for (Entry<String, Object> param: formParams.entrySet()) {
if( param.getValue() instanceof List && !( ( List ) param.getValue() ).isEmpty()
&& ( ( List ) param.getValue() ).get( 0 ) instanceof File ) {
@SuppressWarnings( "unchecked" )
List<File> files = ( List<File> ) param.getValue();
for( File file : files ) {
mp.bodyPart( new FileDataBodyPart( param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE ) );
}
} else if (param.getValue() instanceof File) {
File file = (File) param.getValue();
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.APPLICATION_OCTET_STREAM_TYPE));
public HttpEntity serialize(Object obj, Map<String, Object> formParams, ContentType contentType) throws ApiException {
String mimeType = contentType.getMimeType();
if (isJsonMime(mimeType)) {
try {
return new StringEntity(objectMapper.writeValueAsString(obj), contentType);
} catch (JsonProcessingException e) {
throw new ApiException(e);
}
} else if (mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType())) {
MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create();
for (Entry<String, Object> paramEntry : formParams.entrySet()) {
Object value = paramEntry.getValue();
if (value instanceof File) {
multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value);
} else if (value instanceof byte[]) {
multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value);
} else {
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()));
}
}
return mp;
} else if (contentType.startsWith("application/x-www-form-urlencoded")) {
return this.getXWWWFormUrlencodedParams(formParams);
return multiPartBuilder.build();
} else if (mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) {
List<NameValuePair> formValues = new ArrayList<>();
for (Entry<String, Object> paramEntry : formParams.entrySet()) {
formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue())));
}
try {
return new UrlEncodedFormEntity(formValues);
} catch (UnsupportedEncodingException e) {
throw new ApiException(e);
}
} else {
// We let Jersey attempt to serialize the body
return obj;
// Handle files with unknown content type
if (obj instanceof File) {
return new FileEntity((File) obj, contentType);
} else if (obj instanceof byte[]) {
return new ByteArrayEntity((byte[]) obj, contentType);
}
throw new ApiException("Serialization for content type '" + contentType + "' not supported");
}
}
/**
* Deserialize response content
*/
public <T> T deserialize(HttpResponse response, TypeReference<T> valueType) throws ApiException, IOException {
if (valueType == null) {
return null;
}
HttpEntity entity = response.getEntity();
Type valueRawType = valueType.getType();
if (valueRawType.equals(byte[].class)) {
return (T) EntityUtils.toByteArray(entity);
} else if (valueRawType.equals(File.class)) {
return (T) downloadFileFromResponse(response);
}
String mimeType = getResponseMimeType(response);
if (mimeType == null || isJsonMime(mimeType)) {
// Assume json if no mime type
return objectMapper.readValue(entity.getContent(), valueType);
} else {
throw new ApiException(
"Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'",
response.getStatusLine().getStatusCode(),
responseHeaders,
EntityUtils.toString(entity)
);
}
}
private File downloadFileFromResponse(HttpResponse response) throws IOException {
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
File file = prepareDownloadFile(contentDisposition);
Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
return file;
}
protected File prepareDownloadFile(String contentDisposition) throws IOException {
String filename = null;
if (contentDisposition != null && !"".equals(contentDisposition)) {
// Get filename from the Content-Disposition header.
Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
Matcher matcher = pattern.matcher(contentDisposition);
if (matcher.find())
filename = matcher.group(1);
}
String prefix;
String suffix = null;
if (filename == null) {
prefix = "download-";
suffix = "";
} else {
int pos = filename.lastIndexOf('.');
if (pos == -1) {
prefix = filename + "-";
} else {
prefix = filename.substring(0, pos) + "-";
suffix = filename.substring(pos);
}
// Files.createTempFile requires the prefix to be at least three characters long
if (prefix.length() < 3)
prefix = "download-";
}
if (tempFolderPath == null)
return Files.createTempFile(prefix, suffix).toFile();
else
return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile();
}
/**
* Build full URL by concatenating base path, the given sub path and query parameters.
*
@@ -697,57 +869,34 @@ public class ApiClient extends JavaTimeFormatter {
return url.toString();
}
private ClientResponse getAPIResponse(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 accept, String contentType, String[] authNames) throws ApiException {
if (body != null && !formParams.isEmpty()) {
throw new ApiException(500, "Cannot have body and form params");
protected boolean isSuccessfulStatus(int statusCode) {
return statusCode >= 200 && statusCode < 300;
}
protected boolean isBodyAllowed(String method) {
return bodyMethods.contains(method);
}
protected Cookie buildCookie(String key, String value, URI uri) {
BasicClientCookie cookie = new BasicClientCookie(key, value);
cookie.setDomain(uri.getHost());
cookie.setPath("/");
return cookie;
}
protected <T> T processResponse(CloseableHttpResponse response, TypeReference<T> returnType) throws ApiException, IOException {
statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_NO_CONTENT) {
return null;
}
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
Builder builder;
if (accept == null) {
builder = httpClient.resource(url).getRequestBuilder();
responseHeaders = transformResponseHeaders(response.getAllHeaders());
if (isSuccessfulStatus(statusCode)) {
return this.deserialize(response, returnType);
} else {
builder = httpClient.resource(url).accept(accept);
String message = EntityUtils.toString(response.getEntity());
throw new ApiException(message, statusCode, responseHeaders, message);
}
for (Entry<String, String> keyValue : headerParams.entrySet()) {
builder = builder.header(keyValue.getKey(), keyValue.getValue());
}
for (Map.Entry<String,String> keyValue : defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(keyValue.getKey())) {
builder = builder.header(keyValue.getKey(), keyValue.getValue());
}
}
for (Entry<String, String> keyValue : cookieParams.entrySet()) {
builder = builder.cookie(new Cookie(keyValue.getKey(), keyValue.getValue()));
}
for (Map.Entry<String,String> keyValue : defaultCookieMap.entrySet()) {
if (!cookieParams.containsKey(keyValue.getKey())) {
builder = builder.cookie(new Cookie(keyValue.getKey(), keyValue.getValue()));
}
}
ClientResponse response = null;
if ("GET".equals(method)) {
response = (ClientResponse) builder.get(ClientResponse.class);
} else if ("POST".equals(method)) {
response = builder.type(contentType).post(ClientResponse.class, serialize(body, contentType, formParams));
} else if ("PUT".equals(method)) {
response = builder.type(contentType).put(ClientResponse.class, serialize(body, contentType, formParams));
} else if ("DELETE".equals(method)) {
response = builder.type(contentType).delete(ClientResponse.class, serialize(body, contentType, formParams));
} else if ("PATCH".equals(method)) {
response = builder.type(contentType).header("X-HTTP-Method-Override", "PATCH").post(ClientResponse.class, serialize(body, contentType, formParams));
} else if ("HEAD".equals(method)) {
response = builder.head();
} else {
throw new ApiException(500, "unknown method type " + method);
}
return response;
}
/**
@@ -769,36 +918,73 @@ public class ApiClient extends JavaTimeFormatter {
* @return The response body in type of string
* @throws ApiException API exception
*/
public <T> T invokeAPI(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 accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
public <T> T invokeAPI(
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 accept,
String contentType,
String[] authNames,
TypeReference<T> returnType) throws ApiException {
if (body != null && !formParams.isEmpty()) {
throw new ApiException("Cannot have body and form params");
}
ClientResponse response = getAPIResponse(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames);
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
final String url = buildUrl(path, queryParams, collectionQueryParams);
statusCode = response.getStatusInfo().getStatusCode();
responseHeaders = response.getHeaders();
RequestBuilder builder = RequestBuilder.create(method);
builder.setUri(url);
if(response.getStatusInfo().getStatusCode() == ClientResponse.Status.NO_CONTENT.getStatusCode()) {
return null;
} else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
if (returnType == null)
return null;
else
return response.getEntity(returnType);
} else {
String message = "error";
String respBody = null;
if (response.hasEntity()) {
try {
respBody = response.getEntity(String.class);
message = respBody;
} catch (RuntimeException e) {
// e.printStackTrace();
}
RequestConfig config = RequestConfig.custom()
.setConnectionRequestTimeout(connectionTimeout)
.build();
builder.setConfig(config);
if (accept != null) {
builder.addHeader("Accept", accept);
}
for (Entry<String, String> keyValue : headerParams.entrySet()) {
builder.addHeader(keyValue.getKey(), keyValue.getValue());
}
for (Map.Entry<String,String> keyValue : defaultHeaderMap.entrySet()) {
if (!headerParams.containsKey(keyValue.getKey())) {
builder.addHeader(keyValue.getKey(), keyValue.getValue());
}
throw new ApiException(
response.getStatusInfo().getStatusCode(),
message,
response.getHeaders(),
respBody);
}
BasicCookieStore store = new BasicCookieStore();
for (Entry<String, String> keyValue : cookieParams.entrySet()) {
store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri()));
}
for (Entry<String,String> keyValue : defaultCookieMap.entrySet()) {
if (!cookieParams.containsKey(keyValue.getKey())) {
store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri()));
}
}
HttpClientContext context = HttpClientContext.create();
context.setCookieStore(store);
ContentType contentTypeObj = getContentType(contentType);
if (body != null || !formParams.isEmpty()) {
if (isBodyAllowed(method)) {
// Add entity if we have content and a valid method
builder.setEntity(serialize(body, formParams, contentTypeObj));
} else {
throw new ApiException("method " + method + " does not support a request body");
}
}
try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) {
return processResponse(response, returnType);
} catch (IOException e) {
throw new ApiException(e);
}
}
@@ -817,32 +1003,4 @@ public class ApiClient extends JavaTimeFormatter {
auth.applyToParams(queryParams, headerParams, cookieParams);
}
}
/**
* Encode the given form parameters as request body.
* @param formParams Form parameters
* @return HTTP form encoded parameters
*/
private String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
StringBuilder formParamBuilder = new StringBuilder();
for (Entry<String, Object> param : formParams.entrySet()) {
String valueStr = parameterToString(param.getValue());
try {
formParamBuilder.append(URLEncoder.encode(param.getKey(), "utf8"))
.append("=")
.append(URLEncoder.encode(valueStr, "utf8"));
formParamBuilder.append("&");
} catch (UnsupportedEncodingException e) {
// move on to next
}
}
String encodedFormParams = formParamBuilder.toString();
if (encodedFormParams.endsWith("&")) {
encodedFormParams = encodedFormParams.substring(0, encodedFormParams.length() - 1);
}
return encodedFormParams;
}
}

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api;
import com.sun.jersey.api.client.GenericType;
import com.fasterxml.jackson.core.type.TypeReference;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiClient;
@@ -89,7 +89,20 @@ public class AnotherFakeApi {
String[] localVarAuthNames = new String[] { };
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Client> localVarReturnType = new TypeReference<Client>() {};
return apiClient.invokeAPI(
localVarPath,
"PATCH",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
}

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api;
import com.sun.jersey.api.client.GenericType;
import com.fasterxml.jackson.core.type.TypeReference;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiClient;
@@ -96,8 +96,20 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
*
@@ -135,9 +147,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Boolean> localVarReturnType = new TypeReference<Boolean>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
*
* Test serialization of object with outer number type
@@ -174,9 +199,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<OuterComposite> localVarReturnType = new TypeReference<OuterComposite>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
*
* Test serialization of outer number types
@@ -213,9 +251,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<BigDecimal> localVarReturnType = new TypeReference<BigDecimal>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
*
* Test serialization of outer string types
@@ -252,9 +303,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
GenericType<String> localVarReturnType = new GenericType<String>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
*
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
@@ -295,8 +359,20 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
*
@@ -345,8 +421,20 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* To test \&quot;client\&quot; model
@@ -389,9 +477,22 @@ public class FakeApi {
String[] localVarAuthNames = new String[] { };
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Client> localVarReturnType = new TypeReference<Client>() {};
return apiClient.invokeAPI(
localVarPath,
"PATCH",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -488,8 +589,20 @@ if (paramCallback != null)
String[] localVarAuthNames = new String[] { "http_basic_test" };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* To test enum parameters
@@ -545,8 +658,20 @@ if (enumFormString != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Fake endpoint to test group parameters (optional)
@@ -611,8 +736,20 @@ if (booleanGroup != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* test inline additionalProperties
@@ -654,8 +791,20 @@ if (booleanGroup != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* test json serialization of form data
@@ -707,8 +856,20 @@ if (param2 != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
*
@@ -779,7 +940,19 @@ if (param2 != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
}

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api;
import com.sun.jersey.api.client.GenericType;
import com.fasterxml.jackson.core.type.TypeReference;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiClient;
@@ -89,7 +89,20 @@ public class FakeClassnameTags123Api {
String[] localVarAuthNames = new String[] { "api_key_query" };
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Client> localVarReturnType = new TypeReference<Client>() {};
return apiClient.invokeAPI(
localVarPath,
"PATCH",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
}

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api;
import com.sun.jersey.api.client.GenericType;
import com.fasterxml.jackson.core.type.TypeReference;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiClient;
@@ -91,8 +91,20 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Deletes a pet
@@ -138,8 +150,20 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Finds Pets by status
@@ -183,9 +207,22 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<List<Pet>> localVarReturnType = new TypeReference<List<Pet>>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
@@ -230,9 +267,22 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<Set<Pet>> localVarReturnType = new GenericType<Set<Pet>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Set<Pet>> localVarReturnType = new TypeReference<Set<Pet>>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Find pet by ID
* Returns a single pet
@@ -275,9 +325,22 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "api_key" };
GenericType<Pet> localVarReturnType = new GenericType<Pet>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Pet> localVarReturnType = new TypeReference<Pet>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Update an existing pet
*
@@ -318,8 +381,20 @@ public class PetApi {
String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Updates a pet in the store with form data
@@ -368,8 +443,20 @@ if (status != null)
String[] localVarAuthNames = new String[] { "petstore_auth" };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* uploads an image
@@ -419,9 +506,22 @@ if (file != null)
String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<ModelApiResponse> localVarReturnType = new TypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* uploads an image (required)
*
@@ -475,7 +575,20 @@ if (requiredFile != null)
String[] localVarAuthNames = new String[] { "petstore_auth" };
GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<ModelApiResponse> localVarReturnType = new TypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
}

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api;
import com.sun.jersey.api.client.GenericType;
import com.fasterxml.jackson.core.type.TypeReference;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiClient;
@@ -89,8 +89,20 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Returns pet inventories by status
@@ -127,9 +139,22 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { "api_key" };
GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Map<String, Integer>> localVarReturnType = new TypeReference<Map<String, Integer>>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
@@ -172,9 +197,22 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { };
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Order> localVarReturnType = new TypeReference<Order>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Place an order for a pet
*
@@ -216,7 +254,20 @@ public class StoreApi {
String[] localVarAuthNames = new String[] { };
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<Order> localVarReturnType = new TypeReference<Order>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
}

View File

@@ -12,7 +12,7 @@
package org.openapitools.client.api;
import com.sun.jersey.api.client.GenericType;
import com.fasterxml.jackson.core.type.TypeReference;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiClient;
@@ -88,8 +88,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Creates list of users with given input array
@@ -131,8 +143,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Creates list of users with given input array
@@ -174,8 +198,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Delete user
@@ -218,8 +254,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"DELETE",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Get user by user name
@@ -263,9 +311,22 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
GenericType<User> localVarReturnType = new GenericType<User>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<User> localVarReturnType = new TypeReference<User>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Logs user into the system
*
@@ -315,9 +376,22 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
GenericType<String> localVarReturnType = new GenericType<String>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
return apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Logs out current logged in user session
*
@@ -352,8 +426,20 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
/**
* Updated user
@@ -402,7 +488,19 @@ public class UserApi {
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
apiClient.invokeAPI(
localVarPath,
"PUT",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
null
);
}
}