forked from loafle/openapi-generator-original
Minor improvement to Java API client accept and content-type header
This commit is contained in:
parent
095771d345
commit
141b580c8c
@ -64,13 +64,19 @@ public class {{classname}} {
|
||||
{{#queryParams}}if ({{paramName}} != null)
|
||||
queryParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
|
||||
{{/queryParams}}
|
||||
{{#headerParams}}headerParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
|
||||
{{/headerParams}}
|
||||
String[] contentTypes = {
|
||||
|
||||
final String[] accepts = {
|
||||
{{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
{{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
{{#headerParams}}headerParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
|
||||
{{/headerParams}}
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -92,7 +98,7 @@ public class {{classname}} {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "{{httpMethod}}", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "{{httpMethod}}", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return {{#returnType}}({{{returnType}}}) ApiInvoker.deserialize(response, "{{returnContainer}}", {{returnBaseType}}.class){{/returnType}};
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import com.sun.jersey.multipart.FormDataMultiPart;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@ -105,6 +106,31 @@ public class ApiInvoker {
|
||||
return String.valueOf(param);
|
||||
}
|
||||
}
|
||||
|
||||
public static String selectHeaderAccept(String[] accepts) {
|
||||
if (accepts.length == 0) return "application/json";
|
||||
if (Arrays.asList(accepts).contains("application/json")) return "application/json";
|
||||
return joinString(accepts, ",");
|
||||
}
|
||||
|
||||
public static String selectHeaderContentType(String[] contentTypes) {
|
||||
if (contentTypes.length == 0) return "application/json";
|
||||
if (Arrays.asList(contentTypes).contains("application/json")) return "application/json";
|
||||
return contentTypes[0];
|
||||
}
|
||||
|
||||
public static String joinString(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
public void enableDebug() {
|
||||
isDebug = true;
|
||||
}
|
||||
@ -163,7 +189,7 @@ public class ApiInvoker {
|
||||
}
|
||||
}
|
||||
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String accept, String contentType) throws ApiException {
|
||||
Client client = getClient(host);
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
@ -180,7 +206,7 @@ public class ApiInvoker {
|
||||
}
|
||||
String querystring = b.toString();
|
||||
|
||||
Builder builder = client.resource(host + path + querystring).accept("application/json");
|
||||
Builder builder = client.resource(host + path + querystring).accept(accept);
|
||||
for(String key : headerParams.keySet()) {
|
||||
builder = builder.header(key, headerParams.get(key));
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import com.sun.jersey.multipart.FormDataMultiPart;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@ -105,6 +106,31 @@ public class ApiInvoker {
|
||||
return String.valueOf(param);
|
||||
}
|
||||
}
|
||||
|
||||
public static String selectHeaderAccept(String[] accepts) {
|
||||
if (accepts.length == 0) return "application/json";
|
||||
if (Arrays.asList(accepts).contains("application/json")) return "application/json";
|
||||
return joinString(accepts, ",");
|
||||
}
|
||||
|
||||
public static String selectHeaderContentType(String[] contentTypes) {
|
||||
if (contentTypes.length == 0) return "application/json";
|
||||
if (Arrays.asList(contentTypes).contains("application/json")) return "application/json";
|
||||
return contentTypes[0];
|
||||
}
|
||||
|
||||
public static String joinString(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
public void enableDebug() {
|
||||
isDebug = true;
|
||||
}
|
||||
@ -163,7 +189,7 @@ public class ApiInvoker {
|
||||
}
|
||||
}
|
||||
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType) throws ApiException {
|
||||
public String invokeAPI(String host, String path, String method, Map<String, String> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String accept, String contentType) throws ApiException {
|
||||
Client client = getClient(host);
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
@ -180,7 +206,7 @@ public class ApiInvoker {
|
||||
}
|
||||
String querystring = b.toString();
|
||||
|
||||
Builder builder = client.resource(host + path + querystring).accept("application/json");
|
||||
Builder builder = client.resource(host + path + querystring).accept(accept);
|
||||
for(String key : headerParams.keySet()) {
|
||||
builder = builder.header(key, headerParams.get(key));
|
||||
}
|
||||
|
@ -56,11 +56,17 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -74,7 +80,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -106,11 +112,17 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -124,7 +136,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -158,11 +170,17 @@ public class PetApi {
|
||||
queryParams.put("status", ApiInvoker.parameterToString(status));
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -176,7 +194,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "array", Pet.class);
|
||||
}
|
||||
@ -210,11 +228,17 @@ public class PetApi {
|
||||
queryParams.put("tags", ApiInvoker.parameterToString(tags));
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -228,7 +252,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (List<Pet>) ApiInvoker.deserialize(response, "array", Pet.class);
|
||||
}
|
||||
@ -266,11 +290,17 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -284,7 +314,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (Pet) ApiInvoker.deserialize(response, "", Pet.class);
|
||||
}
|
||||
@ -324,11 +354,17 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
"application/x-www-form-urlencoded"
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -350,7 +386,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -388,13 +424,19 @@ public class PetApi {
|
||||
Map<String, String> formParams = new HashMap<String, String>();
|
||||
|
||||
|
||||
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -408,7 +450,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -448,11 +490,17 @@ public class PetApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -475,7 +523,7 @@ public class PetApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
|
@ -55,11 +55,17 @@ public class StoreApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -73,7 +79,7 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (Map<String, Integer>) ApiInvoker.deserialize(response, "map", Map.class);
|
||||
}
|
||||
@ -105,11 +111,17 @@ public class StoreApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -123,7 +135,7 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||
}
|
||||
@ -161,11 +173,17 @@ public class StoreApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -179,7 +197,7 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (Order) ApiInvoker.deserialize(response, "", Order.class);
|
||||
}
|
||||
@ -217,11 +235,17 @@ public class StoreApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -235,7 +259,7 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
|
@ -56,11 +56,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -74,7 +80,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -106,11 +112,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -124,7 +136,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -156,11 +168,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -174,7 +192,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -211,11 +229,17 @@ public class UserApi {
|
||||
queryParams.put("password", ApiInvoker.parameterToString(password));
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -229,7 +253,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (String) ApiInvoker.deserialize(response, "", String.class);
|
||||
}
|
||||
@ -260,11 +284,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -278,7 +308,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -316,11 +346,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -334,7 +370,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return (User) ApiInvoker.deserialize(response, "", User.class);
|
||||
}
|
||||
@ -373,11 +409,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -391,7 +433,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
@ -429,11 +471,17 @@ public class UserApi {
|
||||
|
||||
|
||||
|
||||
String[] contentTypes = {
|
||||
final String[] accepts = {
|
||||
"application/json", "application/xml"
|
||||
};
|
||||
final String accept = ApiInvoker.selectHeaderAccept(accepts);
|
||||
|
||||
final String[] contentTypes = {
|
||||
|
||||
};
|
||||
final String contentType = ApiInvoker.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
|
||||
|
||||
if(contentType.startsWith("multipart/form-data")) {
|
||||
boolean hasFields = false;
|
||||
@ -447,7 +495,7 @@ public class UserApi {
|
||||
}
|
||||
|
||||
try {
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
|
||||
String response = apiInvoker.invokeAPI(basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType);
|
||||
if(response != null){
|
||||
return ;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user