forked from loafle/openapi-generator-original
Rebuild Java petstore sample
This commit is contained in:
parent
aff21e5e6b
commit
7c16dfcf13
@ -1,9 +1,7 @@
|
|||||||
package io.swagger.client;
|
package io.swagger.client;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
import com.fasterxml.jackson.databind.*;
|
||||||
import com.fasterxml.jackson.annotation.*;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
|
|
||||||
import com.sun.jersey.api.client.Client;
|
import com.sun.jersey.api.client.Client;
|
||||||
import com.sun.jersey.api.client.ClientResponse;
|
import com.sun.jersey.api.client.ClientResponse;
|
||||||
@ -11,7 +9,9 @@ import com.sun.jersey.api.client.config.ClientConfig;
|
|||||||
import com.sun.jersey.api.client.config.DefaultClientConfig;
|
import com.sun.jersey.api.client.config.DefaultClientConfig;
|
||||||
import com.sun.jersey.api.client.filter.LoggingFilter;
|
import com.sun.jersey.api.client.filter.LoggingFilter;
|
||||||
import com.sun.jersey.api.client.WebResource.Builder;
|
import com.sun.jersey.api.client.WebResource.Builder;
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataMultiPart;
|
import com.sun.jersey.multipart.FormDataMultiPart;
|
||||||
|
import com.sun.jersey.multipart.file.FileDataBodyPart;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response.Status.Family;
|
import javax.ws.rs.core.Response.Status.Family;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
@ -29,6 +29,7 @@ import java.util.TimeZone;
|
|||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.File;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
@ -45,6 +46,7 @@ public class ApiClient {
|
|||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private boolean debugging = false;
|
private boolean debugging = false;
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
private String basePath = "http://petstore.swagger.io/v2";
|
||||||
|
private JSON json = new JSON();
|
||||||
|
|
||||||
private Map<String, Authentication> authentications;
|
private Map<String, Authentication> authentications;
|
||||||
|
|
||||||
@ -336,50 +338,38 @@ public class ApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize the given JSON string to Java object.
|
* Serialize the given Java object into string according the given
|
||||||
*
|
* Content-Type (only JSON is supported for now).
|
||||||
* @param json The JSON string
|
|
||||||
* @param containerType The container type, one of "list", "array" or ""
|
|
||||||
* @param cls The type of the Java object
|
|
||||||
* @return The deserialized Java object
|
|
||||||
*/
|
*/
|
||||||
public Object deserialize(String json, String containerType, Class cls) throws ApiException {
|
public String serialize(Object obj, String contentType) throws ApiException {
|
||||||
if(null != containerType) {
|
if (contentType.startsWith("application/json")) {
|
||||||
containerType = containerType.toLowerCase();
|
return json.serialize(obj);
|
||||||
}
|
} else {
|
||||||
try{
|
throw new ApiException(400, "can not serialize object into Content-Type: " + contentType);
|
||||||
if("list".equals(containerType) || "array".equals(containerType)) {
|
|
||||||
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
|
|
||||||
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
else if(String.class.equals(cls)) {
|
|
||||||
if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1)
|
|
||||||
return json.substring(1, json.length() - 2);
|
|
||||||
else
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return JsonUtil.getJsonMapper().readValue(json, cls);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
throw new ApiException(500, e.getMessage(), null, json);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize the given Java object into JSON string.
|
* Deserialize response body to Java object according to the Content-Type.
|
||||||
*/
|
*/
|
||||||
public String serialize(Object obj) throws ApiException {
|
public <T> T deserialize(ClientResponse response, TypeRef returnType) throws ApiException {
|
||||||
try {
|
String contentType = null;
|
||||||
if (obj != null)
|
List<String> contentTypes = response.getHeaders().get("Content-Type");
|
||||||
return JsonUtil.getJsonMapper().writeValueAsString(obj);
|
if (contentTypes != null && !contentTypes.isEmpty())
|
||||||
|
contentType = contentTypes.get(0);
|
||||||
|
if (contentType == null)
|
||||||
|
throw new ApiException(500, "missing Content-Type in response");
|
||||||
|
|
||||||
|
String body;
|
||||||
|
if (response.hasEntity())
|
||||||
|
body = (String) response.getEntity(String.class);
|
||||||
else
|
else
|
||||||
return null;
|
body = "";
|
||||||
}
|
|
||||||
catch (Exception e) {
|
if (contentType.startsWith("application/json")) {
|
||||||
throw new ApiException(500, e.getMessage());
|
return json.deserialize(body, returnType);
|
||||||
|
} else {
|
||||||
|
throw new ApiException(500, "can not deserialize Content-Type: " + contentType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,9 +385,10 @@ public class ApiClient {
|
|||||||
* @param accept The request's Accept header
|
* @param accept The request's Accept header
|
||||||
* @param contentType The request's Content-Type header
|
* @param contentType The request's Content-Type header
|
||||||
* @param authNames The authentications to apply
|
* @param authNames The authentications to apply
|
||||||
|
* @param returnType The return type into which to deserialize the response
|
||||||
* @return The response body in type of string
|
* @return The response body in type of string
|
||||||
*/
|
*/
|
||||||
public String invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String accept, String contentType, String[] authNames) throws ApiException {
|
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, TypeRef returnType) throws ApiException {
|
||||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||||
|
|
||||||
Client client = getClient();
|
Client client = getClient();
|
||||||
@ -423,82 +414,81 @@ public class ApiClient {
|
|||||||
else
|
else
|
||||||
builder = client.resource(basePath + path + querystring).accept(accept);
|
builder = client.resource(basePath + path + querystring).accept(accept);
|
||||||
|
|
||||||
for(String key : headerParams.keySet()) {
|
for (String key : headerParams.keySet()) {
|
||||||
builder = builder.header(key, headerParams.get(key));
|
builder = builder.header(key, headerParams.get(key));
|
||||||
}
|
}
|
||||||
for(String key : defaultHeaderMap.keySet()) {
|
for (String key : defaultHeaderMap.keySet()) {
|
||||||
if(!headerParams.containsKey(key)) {
|
if (!headerParams.containsKey(key)) {
|
||||||
builder = builder.header(key, defaultHeaderMap.get(key));
|
builder = builder.header(key, defaultHeaderMap.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String encodedFormParams = null;
|
||||||
|
if (contentType.startsWith("multipart/form-data")) {
|
||||||
|
FormDataMultiPart mp = new FormDataMultiPart();
|
||||||
|
for (Entry<String, Object> param: formParams.entrySet()) {
|
||||||
|
if (param.getValue() instanceof File) {
|
||||||
|
File file = (File) param.getValue();
|
||||||
|
mp.field(param.getKey(), file.getName());
|
||||||
|
mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.MULTIPART_FORM_DATA_TYPE));
|
||||||
|
} else {
|
||||||
|
mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body = mp;
|
||||||
|
} else if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
||||||
|
encodedFormParams = this.getXWWWFormUrlencodedParams(formParams);
|
||||||
|
}
|
||||||
|
|
||||||
ClientResponse response = null;
|
ClientResponse response = null;
|
||||||
|
|
||||||
if("GET".equals(method)) {
|
if ("GET".equals(method)) {
|
||||||
response = (ClientResponse) builder.get(ClientResponse.class);
|
response = (ClientResponse) builder.get(ClientResponse.class);
|
||||||
}
|
} else if ("POST".equals(method)) {
|
||||||
else if ("POST".equals(method)) {
|
if (encodedFormParams != null) {
|
||||||
if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
response = builder.type(contentType).post(ClientResponse.class, encodedFormParams);
|
||||||
String encodedFormParams = this
|
|
||||||
.getXWWWFormUrlencodedParams(formParams);
|
|
||||||
response = builder.type(contentType).post(ClientResponse.class,
|
|
||||||
encodedFormParams);
|
|
||||||
} else if (body == null) {
|
} else if (body == null) {
|
||||||
response = builder.post(ClientResponse.class, null);
|
response = builder.post(ClientResponse.class, null);
|
||||||
} else if(body instanceof FormDataMultiPart) {
|
} else if (body instanceof FormDataMultiPart) {
|
||||||
response = builder.type(contentType).post(ClientResponse.class, body);
|
response = builder.type(contentType).post(ClientResponse.class, body);
|
||||||
}
|
|
||||||
else
|
|
||||||
response = builder.type(contentType).post(ClientResponse.class, serialize(body));
|
|
||||||
}
|
|
||||||
else if ("PUT".equals(method)) {
|
|
||||||
if ("application/x-www-form-urlencoded".equals(contentType)) {
|
|
||||||
String encodedFormParams = this
|
|
||||||
.getXWWWFormUrlencodedParams(formParams);
|
|
||||||
response = builder.type(contentType).put(ClientResponse.class,
|
|
||||||
encodedFormParams);
|
|
||||||
} else if(body == null) {
|
|
||||||
response = builder.put(ClientResponse.class, serialize(body));
|
|
||||||
} else {
|
} else {
|
||||||
response = builder.type(contentType).put(ClientResponse.class, serialize(body));
|
response = builder.type(contentType).post(ClientResponse.class, serialize(body, contentType));
|
||||||
}
|
}
|
||||||
|
} else if ("PUT".equals(method)) {
|
||||||
|
if (encodedFormParams != null) {
|
||||||
|
response = builder.type(contentType).put(ClientResponse.class, encodedFormParams);
|
||||||
|
} else if(body == null) {
|
||||||
|
response = builder.put(ClientResponse.class, serialize(body, contentType));
|
||||||
|
} else {
|
||||||
|
response = builder.type(contentType).put(ClientResponse.class, serialize(body, contentType));
|
||||||
}
|
}
|
||||||
else if ("DELETE".equals(method)) {
|
} else if ("DELETE".equals(method)) {
|
||||||
if ("application/x-www-form-urlencoded".equals(contentType)) {
|
if (encodedFormParams != null) {
|
||||||
String encodedFormParams = this
|
response = builder.type(contentType).delete(ClientResponse.class, encodedFormParams);
|
||||||
.getXWWWFormUrlencodedParams(formParams);
|
|
||||||
response = builder.type(contentType).delete(ClientResponse.class,
|
|
||||||
encodedFormParams);
|
|
||||||
} else if(body == null) {
|
} else if(body == null) {
|
||||||
response = builder.delete(ClientResponse.class);
|
response = builder.delete(ClientResponse.class);
|
||||||
} else {
|
} else {
|
||||||
response = builder.type(contentType).delete(ClientResponse.class, serialize(body));
|
response = builder.type(contentType).delete(ClientResponse.class, serialize(body, contentType));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new ApiException(500, "unknown method type " + method);
|
throw new ApiException(500, "unknown method type " + method);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) {
|
if (response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) {
|
||||||
return null;
|
return null;
|
||||||
}
|
} else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
|
||||||
else if(response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
|
if (returnType == null)
|
||||||
if(response.hasEntity()) {
|
return null;
|
||||||
return (String) response.getEntity(String.class);
|
else
|
||||||
}
|
return deserialize(response, returnType);
|
||||||
else {
|
} else {
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
String message = "error";
|
String message = "error";
|
||||||
String respBody = null;
|
String respBody = null;
|
||||||
if(response.hasEntity()) {
|
if (response.hasEntity()) {
|
||||||
try{
|
try {
|
||||||
respBody = String.valueOf(response.getEntity(String.class));
|
respBody = String.valueOf(response.getEntity(String.class));
|
||||||
message = respBody;
|
message = respBody;
|
||||||
}
|
} catch (RuntimeException e) {
|
||||||
catch (RuntimeException e) {
|
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,15 +516,14 @@ public class ApiClient {
|
|||||||
/**
|
/**
|
||||||
* Encode the given form parameters as request body.
|
* Encode the given form parameters as request body.
|
||||||
*/
|
*/
|
||||||
private String getXWWWFormUrlencodedParams(Map<String, String> formParams) {
|
private String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
|
||||||
StringBuilder formParamBuilder = new StringBuilder();
|
StringBuilder formParamBuilder = new StringBuilder();
|
||||||
|
|
||||||
for (Entry<String, String> param : formParams.entrySet()) {
|
for (Entry<String, Object> param : formParams.entrySet()) {
|
||||||
String keyStr = parameterToString(param.getKey());
|
String keyStr = param.getKey();
|
||||||
String valueStr = parameterToString(param.getValue());
|
String valueStr = parameterToString(param.getValue());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
formParamBuilder.append(URLEncoder.encode(keyStr, "utf8"))
|
formParamBuilder.append(URLEncoder.encode(param.getKey(), "utf8"))
|
||||||
.append("=")
|
.append("=")
|
||||||
.append(URLEncoder.encode(valueStr, "utf8"));
|
.append(URLEncoder.encode(valueStr, "utf8"));
|
||||||
formParamBuilder.append("&");
|
formParamBuilder.append("&");
|
||||||
@ -542,11 +531,12 @@ public class ApiClient {
|
|||||||
// move on to next
|
// move on to next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String encodedFormParams = formParamBuilder.toString();
|
String encodedFormParams = formParamBuilder.toString();
|
||||||
if (encodedFormParams.endsWith("&")) {
|
if (encodedFormParams.endsWith("&")) {
|
||||||
encodedFormParams = encodedFormParams.substring(0,
|
encodedFormParams = encodedFormParams.substring(0, encodedFormParams.length() - 1);
|
||||||
encodedFormParams.length() - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return encodedFormParams;
|
return encodedFormParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.*;
|
||||||
|
import com.fasterxml.jackson.databind.*;
|
||||||
|
import com.fasterxml.jackson.datatype.joda.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class JSON {
|
||||||
|
private ObjectMapper mapper;
|
||||||
|
|
||||||
|
public JSON() {
|
||||||
|
mapper = new ObjectMapper();
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
mapper.registerModule(new JodaModule());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the given Java object into JSON string.
|
||||||
|
*/
|
||||||
|
public String serialize(Object obj) throws ApiException {
|
||||||
|
try {
|
||||||
|
if (obj != null)
|
||||||
|
return mapper.writeValueAsString(obj);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ApiException(400, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize the given JSON string to Java object.
|
||||||
|
*
|
||||||
|
* @param body The JSON string
|
||||||
|
* @param returnType The type to deserialize inot
|
||||||
|
* @return The deserialized Java object
|
||||||
|
*/
|
||||||
|
public <T> T deserialize(String body, TypeRef returnType) throws ApiException {
|
||||||
|
JavaType javaType = mapper.constructType(returnType.getType());
|
||||||
|
try {
|
||||||
|
return mapper.readValue(body, javaType);
|
||||||
|
} catch (IOException e) {
|
||||||
|
if (returnType.getType().equals(String.class))
|
||||||
|
return (T) body;
|
||||||
|
else
|
||||||
|
throw new ApiException(500, e.getMessage(), null, body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +0,0 @@
|
|||||||
package io.swagger.client;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.*;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator.Feature;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.datatype.joda.*;
|
|
||||||
|
|
||||||
public class JsonUtil {
|
|
||||||
public static ObjectMapper mapper;
|
|
||||||
|
|
||||||
static {
|
|
||||||
mapper = new ObjectMapper();
|
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
|
||||||
mapper.registerModule(new JodaModule());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ObjectMapper getJsonMapper() {
|
|
||||||
return mapper;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,25 @@
|
|||||||
|
package io.swagger.client;
|
||||||
|
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class TypeRef<T> {
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public TypeRef() {
|
||||||
|
this.type = getGenericType(getClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Type getGenericType(Class<?> klass) {
|
||||||
|
Type superclass = klass.getGenericSuperclass();
|
||||||
|
if (superclass instanceof Class) {
|
||||||
|
throw new RuntimeException("No type parameter provided");
|
||||||
|
}
|
||||||
|
ParameterizedType parameterized = (ParameterizedType) superclass;
|
||||||
|
return parameterized.getActualTypeArguments()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import io.swagger.client.ApiException;
|
|||||||
import io.swagger.client.ApiClient;
|
import io.swagger.client.ApiClient;
|
||||||
import io.swagger.client.Configuration;
|
import io.swagger.client.Configuration;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
import io.swagger.client.TypeRef;
|
||||||
|
|
||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
|
|
||||||
@ -12,11 +13,6 @@ import java.util.*;
|
|||||||
import io.swagger.client.model.Pet;
|
import io.swagger.client.model.Pet;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataMultiPart;
|
|
||||||
import com.sun.jersey.multipart.file.FileDataBodyPart;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -57,7 +53,9 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,29 +71,10 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +93,9 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -130,29 +111,10 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,7 +133,7 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
queryParams.addAll(apiClient.parameterToPairs("multi", "status", status));
|
queryParams.addAll(apiClient.parameterToPairs("multi", "status", status));
|
||||||
@ -179,6 +141,8 @@ public class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final String[] accepts = {
|
final String[] accepts = {
|
||||||
"application/json", "application/xml"
|
"application/json", "application/xml"
|
||||||
};
|
};
|
||||||
@ -189,29 +153,11 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<List<Pet>>() {};
|
||||||
return (List<Pet>) apiClient.deserialize(response, "array", Pet.class);
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -230,7 +176,7 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
queryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags));
|
queryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags));
|
||||||
@ -238,6 +184,8 @@ public class PetApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final String[] accepts = {
|
final String[] accepts = {
|
||||||
"application/json", "application/xml"
|
"application/json", "application/xml"
|
||||||
};
|
};
|
||||||
@ -248,29 +196,11 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<List<Pet>>() {};
|
||||||
return (List<Pet>) apiClient.deserialize(response, "array", Pet.class);
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,7 +225,9 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -311,31 +243,13 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
String[] authNames = new String[] { "petstore_auth", "api_key" };
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
TypeRef returnType = new TypeRef<Pet>() {};
|
||||||
postBody = mp;
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "api_key", "petstore_auth" };
|
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
|
||||||
return (Pet) apiClient.deserialize(response, "", Pet.class);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
*
|
*
|
||||||
@ -360,12 +274,18 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (name != null)
|
||||||
|
formParams.put("name", name);
|
||||||
|
if (status != null)
|
||||||
|
formParams.put("status", status);
|
||||||
|
|
||||||
|
|
||||||
final String[] accepts = {
|
final String[] accepts = {
|
||||||
"application/json", "application/xml"
|
"application/json", "application/xml"
|
||||||
};
|
};
|
||||||
@ -376,43 +296,10 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if (name != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.field("name", apiClient.parameterToString(name), MediaType.MULTIPART_FORM_DATA_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.field("status", apiClient.parameterToString(status), MediaType.MULTIPART_FORM_DATA_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (name != null)
|
|
||||||
formParams.put("name", apiClient.parameterToString(name));
|
|
||||||
if (status != null)
|
|
||||||
formParams.put("status", apiClient.parameterToString(status));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -438,7 +325,7 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -446,6 +333,8 @@ public class PetApi {
|
|||||||
headerParams.put("api_key", apiClient.parameterToString(apiKey));
|
headerParams.put("api_key", apiClient.parameterToString(apiKey));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final String[] accepts = {
|
final String[] accepts = {
|
||||||
"application/json", "application/xml"
|
"application/json", "application/xml"
|
||||||
};
|
};
|
||||||
@ -456,29 +345,10 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -505,12 +375,18 @@ public class PetApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (additionalMetadata != null)
|
||||||
|
formParams.put("additionalMetadata", additionalMetadata);
|
||||||
|
if (file != null)
|
||||||
|
formParams.put("file", file);
|
||||||
|
|
||||||
|
|
||||||
final String[] accepts = {
|
final String[] accepts = {
|
||||||
"application/json", "application/xml"
|
"application/json", "application/xml"
|
||||||
};
|
};
|
||||||
@ -521,43 +397,10 @@ public class PetApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if (additionalMetadata != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.field("additionalMetadata", apiClient.parameterToString(additionalMetadata), MediaType.MULTIPART_FORM_DATA_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file != null) {
|
|
||||||
hasFields = true;
|
|
||||||
mp.field("file", file.getName());
|
|
||||||
mp.bodyPart(new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (additionalMetadata != null)
|
|
||||||
formParams.put("additionalMetadata", apiClient.parameterToString(additionalMetadata));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "petstore_auth" };
|
String[] authNames = new String[] { "petstore_auth" };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import io.swagger.client.ApiException;
|
|||||||
import io.swagger.client.ApiClient;
|
import io.swagger.client.ApiClient;
|
||||||
import io.swagger.client.Configuration;
|
import io.swagger.client.Configuration;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
import io.swagger.client.TypeRef;
|
||||||
|
|
||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
|
|
||||||
@ -12,11 +13,6 @@ import java.util.*;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import io.swagger.client.model.Order;
|
import io.swagger.client.model.Order;
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataMultiPart;
|
|
||||||
import com.sun.jersey.multipart.file.FileDataBodyPart;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -56,7 +52,9 @@ public class StoreApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -72,29 +70,11 @@ public class StoreApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { "api_key" };
|
String[] authNames = new String[] { "api_key" };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<Map<String, Integer>>() {};
|
||||||
return (Map<String, Integer>) apiClient.deserialize(response, "map", Map.class);
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,7 +93,9 @@ public class StoreApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -129,29 +111,11 @@ public class StoreApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<Order>() {};
|
||||||
return (Order) apiClient.deserialize(response, "", Order.class);
|
return apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +140,9 @@ public class StoreApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -192,29 +158,11 @@ public class StoreApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<Order>() {};
|
||||||
return (Order) apiClient.deserialize(response, "", Order.class);
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,7 +187,9 @@ public class StoreApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -255,29 +205,10 @@ public class StoreApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import io.swagger.client.ApiException;
|
|||||||
import io.swagger.client.ApiClient;
|
import io.swagger.client.ApiClient;
|
||||||
import io.swagger.client.Configuration;
|
import io.swagger.client.Configuration;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
import io.swagger.client.TypeRef;
|
||||||
|
|
||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
|
|
||||||
@ -12,11 +13,6 @@ import java.util.*;
|
|||||||
import io.swagger.client.model.User;
|
import io.swagger.client.model.User;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import com.sun.jersey.multipart.FormDataMultiPart;
|
|
||||||
import com.sun.jersey.multipart.file.FileDataBodyPart;
|
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -57,7 +53,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,29 +71,10 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,7 +93,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -130,29 +111,10 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,7 +133,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -187,29 +151,10 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -229,7 +174,7 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
queryParams.addAll(apiClient.parameterToPairs("", "username", username));
|
queryParams.addAll(apiClient.parameterToPairs("", "username", username));
|
||||||
@ -239,6 +184,8 @@ public class UserApi {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final String[] accepts = {
|
final String[] accepts = {
|
||||||
"application/json", "application/xml"
|
"application/json", "application/xml"
|
||||||
};
|
};
|
||||||
@ -249,29 +196,11 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<String>() {};
|
||||||
return (String) apiClient.deserialize(response, "", String.class);
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,7 +218,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -305,29 +236,10 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -352,7 +264,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -368,29 +282,11 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
TypeRef returnType = new TypeRef<User>() {};
|
||||||
return (User) apiClient.deserialize(response, "", User.class);
|
return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -416,7 +312,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -432,29 +330,10 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -479,7 +358,9 @@ public class UserApi {
|
|||||||
// query params
|
// query params
|
||||||
List<Pair> queryParams = new ArrayList<Pair>();
|
List<Pair> queryParams = new ArrayList<Pair>();
|
||||||
Map<String, String> headerParams = new HashMap<String, String>();
|
Map<String, String> headerParams = new HashMap<String, String>();
|
||||||
Map<String, String> formParams = new HashMap<String, String>();
|
Map<String, Object> formParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -495,29 +376,10 @@ public class UserApi {
|
|||||||
};
|
};
|
||||||
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
final String contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
|
||||||
boolean hasFields = false;
|
|
||||||
FormDataMultiPart mp = new FormDataMultiPart();
|
|
||||||
|
|
||||||
if(hasFields)
|
|
||||||
postBody = mp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
String[] authNames = new String[] { };
|
String[] authNames = new String[] { };
|
||||||
String response = apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
|
|
||||||
if(response != null){
|
apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null);
|
||||||
return ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
} catch (ApiException ex) {
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.swagger.client.model;
|
package io.swagger.client.model;
|
||||||
|
|
||||||
import io.swagger.client.model.Category;
|
import io.swagger.client.model.Category;
|
||||||
import io.swagger.client.model.Tag;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import io.swagger.client.model.Tag;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user