[Java][Feign] Add http status to feign result (#10583)

* Add .circleci/config.yml

* Add Http status to the feign response wrapper

* Add Http status to the feign response wrapper

* Add Http status to the feign response wrapper

Fix typo

* Add Http status to the feign response wrapper

Fix typo

* Rename HttpResponse to ApiResponse
This commit is contained in:
Hugo Alves 2021-10-18 17:04:32 +01:00 committed by GitHub
parent 357f186c4e
commit ff286aa06f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 393 additions and 198 deletions

View File

@ -389,8 +389,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
modelDocTemplateFiles.remove("model_doc.mustache");
apiDocTemplateFiles.remove("api_doc.mustache");
//Templates to decode response headers
supportingFiles.add(new SupportingFile("model/HttpResponse.mustache", modelsFolder, "HttpResponse.java"));
supportingFiles.add(new SupportingFile("JacksonResponseDecoder.mustache", invokerFolder, "JacksonResponseDecoder.java"));
supportingFiles.add(new SupportingFile("model/ApiResponse.mustache", modelsFolder, "ApiResponse.java"));
supportingFiles.add(new SupportingFile("ApiResponseDecoder.mustache", invokerFolder, "ApiResponseDecoder.java"));
}
if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || RETROFIT_2.equals(getLibrary()) || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) {

View File

@ -35,7 +35,7 @@ import feign.slf4j.Slf4jLogger;
import {{invokerPackage}}.auth.HttpBasicAuth;
import {{invokerPackage}}.auth.HttpBearerAuth;
import {{invokerPackage}}.auth.ApiKeyAuth;
import {{invokerPackage}}.JacksonResponseDecoder;
import {{invokerPackage}}.ApiResponseDecoder;
{{#hasOAuthMethods}}
import {{invokerPackage}}.auth.ApiErrorDecoder;
@ -64,7 +64,7 @@ public class ApiClient {
feignBuilder = Feign.builder()
.client(new OkHttpClient())
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonResponseDecoder(objectMapper))
.decoder(new ApiResponseDecoder(objectMapper))
{{#hasOAuthMethods}}
.errorDecoder(new ApiErrorDecoder())
.retryer(new Retryer.Default(0, 0, 2))

View File

@ -12,26 +12,26 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import {{modelPackage}}.HttpResponse;
import {{modelPackage}}.ApiResponse;
public class JacksonResponseDecoder extends JacksonDecoder {
public class ApiResponseDecoder extends JacksonDecoder {
public JacksonResponseDecoder(ObjectMapper mapper) {
public ApiResponseDecoder(ObjectMapper mapper) {
super(mapper);
}
@Override
public Object decode(Response response, Type type) throws IOException {
Map<String, Collection<String>> responseHeaders = Collections.unmodifiableMap(response.headers());
//Detects if the type is an instance of the parameterized class HttpResponse
//Detects if the type is an instance of the parameterized class ApiResponse
Type responseBodyType;
if (Types.getRawType(type).isAssignableFrom(HttpResponse.class)) {
//The HttpResponse class has a single type parameter, the Dto class itself
if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) {
//The ApiResponse class has a single type parameter, the Dto class itself
responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0];
Object body = super.decode(response, responseBodyType);
return new HttpResponse(responseHeaders, body);
return new ApiResponse(response.status(), responseHeaders, body);
} else {
//The response is not encapsulated in the HttpResponse, decode the Dto as normal
//The response is not encapsulated in the ApiResponse, decode the Dto as normal
return super.decode(response, type);
}
}

View File

@ -5,7 +5,7 @@ import {{invokerPackage}}.EncodingUtils;
{{#legacyDates}}
import {{invokerPackage}}.ParamExpander;
{{/legacyDates}}
import {{modelPackage}}.HttpResponse;
import {{modelPackage}}.ApiResponse;
{{#imports}}import {{import}};
{{/imports}}
@ -59,7 +59,7 @@ public interface {{classname}} extends ApiClient.Api {
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
{{/allParams}}
{{#returnType}}
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
{{/returnType}}
{{#externalDocs}}
* {{description}}
@ -79,7 +79,7 @@ public interface {{classname}} extends ApiClient.Api {
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}},
{{/-last}}{{/headerParams}}
})
HttpResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
{{#hasQueryParams}}
@ -164,7 +164,7 @@ public interface {{classname}} extends ApiClient.Api {
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}},
{{/-last}}{{/headerParams}}
})
HttpResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map<String, Object> queryParams);
/**

View File

@ -5,7 +5,7 @@ import feign.RetryableException;
import feign.codec.ErrorDecoder;
/**
* Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 402 may indicate an expired token
* Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token
* All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder
*/
public class ApiErrorDecoder implements ErrorDecoder {

View File

@ -0,0 +1,43 @@
package {{modelPackage}};
import java.util.Map;
import java.util.List;
public class ApiResponse<T>{
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
public int getStatusCode() {
return statusCode;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public T getData() {
return data;
}
}

View File

@ -1,24 +0,0 @@
package {{modelPackage}};
import java.util.Map;
import java.util.Collection;
public class HttpResponse<T>{
private Map<String, Collection<String>> headers;
private T body;
public HttpResponse(Map<String, Collection<String>> headers, T body) {
this.headers = headers;
this.body = body;
}
public T getBody(){
return body;
}
public Map<String, Collection<String>> getHeaders(){
return headers;
}
}

View File

@ -14,9 +14,9 @@ pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiResponseDecoder.java
src/main/java/org/openapitools/client/CustomInstantDeserializer.java
src/main/java/org/openapitools/client/EncodingUtils.java
src/main/java/org/openapitools/client/JacksonResponseDecoder.java
src/main/java/org/openapitools/client/ParamExpander.java
src/main/java/org/openapitools/client/RFC3339DateFormat.java
src/main/java/org/openapitools/client/ServerConfiguration.java
@ -46,6 +46,7 @@ src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java
src/main/java/org/openapitools/client/model/Animal.java
src/main/java/org/openapitools/client/model/ApiResponse.java
src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayTest.java
@ -65,7 +66,6 @@ src/main/java/org/openapitools/client/model/EnumTest.java
src/main/java/org/openapitools/client/model/FileSchemaTestClass.java
src/main/java/org/openapitools/client/model/FormatTest.java
src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java
src/main/java/org/openapitools/client/model/HttpResponse.java
src/main/java/org/openapitools/client/model/MapTest.java
src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
src/main/java/org/openapitools/client/model/Model200Response.java

View File

@ -22,7 +22,7 @@ import feign.slf4j.Slf4jLogger;
import org.openapitools.client.auth.HttpBasicAuth;
import org.openapitools.client.auth.HttpBearerAuth;
import org.openapitools.client.auth.ApiKeyAuth;
import org.openapitools.client.JacksonResponseDecoder;
import org.openapitools.client.ApiResponseDecoder;
import org.openapitools.client.auth.ApiErrorDecoder;
import org.openapitools.client.auth.OAuth;
@ -49,7 +49,7 @@ public class ApiClient {
feignBuilder = Feign.builder()
.client(new OkHttpClient())
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonResponseDecoder(objectMapper))
.decoder(new ApiResponseDecoder(objectMapper))
.errorDecoder(new ApiErrorDecoder())
.retryer(new Retryer.Default(0, 0, 2))
.logger(new Slf4jLogger());

View File

@ -0,0 +1,38 @@
package org.openapitools.client;
import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Response;
import feign.Types;
import feign.jackson.JacksonDecoder;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.openapitools.client.model.ApiResponse;
public class ApiResponseDecoder extends JacksonDecoder {
public ApiResponseDecoder(ObjectMapper mapper) {
super(mapper);
}
@Override
public Object decode(Response response, Type type) throws IOException {
Map<String, Collection<String>> responseHeaders = Collections.unmodifiableMap(response.headers());
//Detects if the type is an instance of the parameterized class ApiResponse
Type responseBodyType;
if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) {
//The ApiResponse class has a single type parameter, the Dto class itself
responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0];
Object body = super.decode(response, responseBodyType);
return new ApiResponse(response.status(), responseHeaders, body);
} else {
//The response is not encapsulated in the ApiResponse, decode the Dto as normal
return super.decode(response, type);
}
}
}

View File

@ -29,7 +29,7 @@ public class JacksonResponseDecoder extends JacksonDecoder {
//The HttpResponse class has a single type parameter, the Dto class itself
responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0];
Object body = super.decode(response, responseBodyType);
return new HttpResponse(responseHeaders, body);
return new HttpResponse(responseHeaders, body, response.status());
} else {
//The response is not encapsulated in the HttpResponse, decode the Dto as normal
return super.decode(response, type);

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.Client;
@ -34,14 +34,14 @@ public interface AnotherFakeApi extends ApiClient.Api {
* Similar to <code>call123testSpecialTags</code> but it also returns the http response headers .
* To test special tags and operation ID starting with number
* @param body client model (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("PATCH /another-fake/dummy")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Client> call123testSpecialTagsWithHttpInfo(Client body);
ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
@ -47,7 +47,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/xml",
"Accept: application/json",
})
HttpResponse<Void> createXmlItemWithHttpInfo(XmlItem xmlItem);
ApiResponse<Void> createXmlItemWithHttpInfo(XmlItem xmlItem);
@ -69,14 +69,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterBooleanSerialize</code> but it also returns the http response headers .
* Test serialization of outer boolean types
* @param body Input boolean as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/boolean")
@Headers({
"Content-Type: */*",
"Accept: */*",
})
HttpResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body);
ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body);
@ -98,14 +98,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterCompositeSerialize</code> but it also returns the http response headers .
* Test serialization of object with outer number type
* @param body Input composite as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/composite")
@Headers({
"Content-Type: */*",
"Accept: */*",
})
HttpResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body);
ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body);
@ -127,14 +127,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterNumberSerialize</code> but it also returns the http response headers .
* Test serialization of outer number types
* @param body Input number as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/number")
@Headers({
"Content-Type: */*",
"Accept: */*",
})
HttpResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body);
ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body);
@ -156,14 +156,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterStringSerialize</code> but it also returns the http response headers .
* Test serialization of outer string types
* @param body Input string as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/string")
@Headers({
"Content-Type: */*",
"Accept: */*",
})
HttpResponse<String> fakeOuterStringSerializeWithHttpInfo(String body);
ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body);
@ -190,7 +190,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body);
ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body);
@ -219,7 +219,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User body);
ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User body);
/**
@ -261,7 +261,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithQueryParamsWithHttpInfo(User body, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(User body, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -293,14 +293,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>testClientModel</code> but it also returns the http response headers .
* To test \&quot;client\&quot; model
* @param body client model (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("PATCH /fake")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Client> testClientModelWithHttpInfo(Client body);
ApiResponse<Client> testClientModelWithHttpInfo(Client body);
@ -353,7 +353,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
HttpResponse<Void> testEndpointParametersWithHttpInfo(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
ApiResponse<Void> testEndpointParametersWithHttpInfo(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
@ -400,7 +400,7 @@ public interface FakeApi extends ApiClient.Api {
"enum_header_string: {enumHeaderString}"
})
HttpResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List<String> enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString);
ApiResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List<String> enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString);
/**
@ -460,7 +460,7 @@ public interface FakeApi extends ApiClient.Api {
"enum_header_string: {enumHeaderString}"
})
HttpResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -523,7 +523,7 @@ public interface FakeApi extends ApiClient.Api {
"boolean_group: {booleanGroup}"
})
HttpResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group);
ApiResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group);
/**
@ -577,7 +577,7 @@ public interface FakeApi extends ApiClient.Api {
"boolean_group: {booleanGroup}"
})
HttpResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -626,7 +626,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> param);
ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> param);
@ -655,7 +655,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
HttpResponse<Void> testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2);
ApiResponse<Void> testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2);
@ -688,7 +688,7 @@ public interface FakeApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List<String> pipe, @Param("ioutil") List<String> ioutil, @Param("http") List<String> http, @Param("url") List<String> url, @Param("context") List<String> context);
ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List<String> pipe, @Param("ioutil") List<String> ioutil, @Param("http") List<String> http, @Param("url") List<String> url, @Param("context") List<String> context);
/**
@ -734,7 +734,7 @@ public interface FakeApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.Client;
@ -34,14 +34,14 @@ public interface FakeClassnameTags123Api extends ApiClient.Api {
* Similar to <code>testClassname</code> but it also returns the http response headers .
* To test class name in snake case
* @param body client model (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("PATCH /fake_classname_test")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Client> testClassnameWithHttpInfo(Client body);
ApiResponse<Client> testClassnameWithHttpInfo(Client body);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
@ -42,7 +42,7 @@ public interface PetApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> addPetWithHttpInfo(Pet body);
ApiResponse<Void> addPetWithHttpInfo(Pet body);
@ -71,7 +71,7 @@ public interface PetApi extends ApiClient.Api {
"Accept: application/json",
"api_key: {apiKey}"
})
HttpResponse<Void> deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey);
ApiResponse<Void> deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey);
@ -92,13 +92,13 @@ public interface PetApi extends ApiClient.Api {
* Similar to <code>findPetsByStatus</code> but it also returns the http response headers .
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /pet/findByStatus?status={status}")
@Headers({
"Accept: application/json",
})
HttpResponse<List<Pet>> findPetsByStatusWithHttpInfo(@Param("status") List<String> status);
ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@Param("status") List<String> status);
/**
@ -138,7 +138,7 @@ public interface PetApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<List<Pet>> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -171,7 +171,7 @@ public interface PetApi extends ApiClient.Api {
* Similar to <code>findPetsByTags</code> but it also returns the http response headers .
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
* @deprecated
*/
@Deprecated
@ -179,7 +179,7 @@ public interface PetApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@Param("tags") Set<String> tags);
ApiResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@Param("tags") Set<String> tags);
/**
@ -223,7 +223,7 @@ public interface PetApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -254,13 +254,13 @@ public interface PetApi extends ApiClient.Api {
* Similar to <code>getPetById</code> but it also returns the http response headers .
* Returns a single pet
* @param petId ID of pet to return (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /pet/{petId}")
@Headers({
"Accept: application/json",
})
HttpResponse<Pet> getPetByIdWithHttpInfo(@Param("petId") Long petId);
ApiResponse<Pet> getPetByIdWithHttpInfo(@Param("petId") Long petId);
@ -287,7 +287,7 @@ public interface PetApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> updatePetWithHttpInfo(Pet body);
ApiResponse<Void> updatePetWithHttpInfo(Pet body);
@ -318,7 +318,7 @@ public interface PetApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
HttpResponse<Void> updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
ApiResponse<Void> updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
@ -344,14 +344,14 @@ public interface PetApi extends ApiClient.Api {
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /pet/{petId}/uploadImage")
@Headers({
"Content-Type: multipart/form-data",
"Accept: application/json",
})
HttpResponse<ModelApiResponse> uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
@ -377,14 +377,14 @@ public interface PetApi extends ApiClient.Api {
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile")
@Headers({
"Content-Type: multipart/form-data",
"Accept: application/json",
})
HttpResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata);
ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.Order;
@ -37,7 +37,7 @@ public interface StoreApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> deleteOrderWithHttpInfo(@Param("orderId") String orderId);
ApiResponse<Void> deleteOrderWithHttpInfo(@Param("orderId") String orderId);
@ -56,13 +56,13 @@ public interface StoreApi extends ApiClient.Api {
* Returns pet inventories by status
* Similar to <code>getInventory</code> but it also returns the http response headers .
* Returns a map of status codes to quantities
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /store/inventory")
@Headers({
"Accept: application/json",
})
HttpResponse<Map<String, Integer>> getInventoryWithHttpInfo();
ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo();
@ -83,13 +83,13 @@ public interface StoreApi extends ApiClient.Api {
* Similar to <code>getOrderById</code> but it also returns the http response headers .
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /store/order/{orderId}")
@Headers({
"Accept: application/json",
})
HttpResponse<Order> getOrderByIdWithHttpInfo(@Param("orderId") Long orderId);
ApiResponse<Order> getOrderByIdWithHttpInfo(@Param("orderId") Long orderId);
@ -111,14 +111,14 @@ public interface StoreApi extends ApiClient.Api {
* Similar to <code>placeOrder</code> but it also returns the http response headers .
*
* @param body order placed for purchasing the pet (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /store/order")
@Headers({
"Content-Type: */*",
"Accept: application/json",
})
HttpResponse<Order> placeOrderWithHttpInfo(Order body);
ApiResponse<Order> placeOrderWithHttpInfo(Order body);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.User;
@ -39,7 +39,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: */*",
"Accept: application/json",
})
HttpResponse<Void> createUserWithHttpInfo(User body);
ApiResponse<Void> createUserWithHttpInfo(User body);
@ -66,7 +66,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: */*",
"Accept: application/json",
})
HttpResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body);
ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body);
@ -93,7 +93,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: */*",
"Accept: application/json",
})
HttpResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body);
ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body);
@ -118,7 +118,7 @@ public interface UserApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> deleteUserWithHttpInfo(@Param("username") String username);
ApiResponse<Void> deleteUserWithHttpInfo(@Param("username") String username);
@ -139,13 +139,13 @@ public interface UserApi extends ApiClient.Api {
* Similar to <code>getUserByName</code> but it also returns the http response headers .
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /user/{username}")
@Headers({
"Accept: application/json",
})
HttpResponse<User> getUserByNameWithHttpInfo(@Param("username") String username);
ApiResponse<User> getUserByNameWithHttpInfo(@Param("username") String username);
@ -168,13 +168,13 @@ public interface UserApi extends ApiClient.Api {
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /user/login?username={username}&password={password}")
@Headers({
"Accept: application/json",
})
HttpResponse<String> loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password);
ApiResponse<String> loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password);
/**
@ -216,7 +216,7 @@ public interface UserApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<String> loginUserWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<String> loginUserWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -253,7 +253,7 @@ public interface UserApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> logoutUserWithHttpInfo();
ApiResponse<Void> logoutUserWithHttpInfo();
@ -282,7 +282,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: */*",
"Accept: application/json",
})
HttpResponse<Void> updateUserWithHttpInfo(@Param("username") String username, User body);
ApiResponse<Void> updateUserWithHttpInfo(@Param("username") String username, User body);
}

View File

@ -5,7 +5,7 @@ import feign.RetryableException;
import feign.codec.ErrorDecoder;
/**
* Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 402 may indicate an expired token
* Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token
* All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder
*/
public class ApiErrorDecoder implements ErrorDecoder {

View File

@ -0,0 +1,43 @@
package org.openapitools.client.model;
import java.util.Map;
import java.util.List;
public class ApiResponse<T>{
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
public int getStatusCode() {
return statusCode;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public T getData() {
return data;
}
}

View File

@ -9,9 +9,12 @@ public class HttpResponse<T>{
private T body;
public HttpResponse(Map<String, Collection<String>> headers, T body) {
private int status;
public HttpResponse(Map<String, Collection<String>> headers, T body, int status) {
this.headers = headers;
this.body = body;
this.status = status;
}
public T getBody(){
@ -21,4 +24,8 @@ public class HttpResponse<T>{
public Map<String, Collection<String>> getHeaders(){
return headers;
}
public int getStatus(){
return status;
}
}

View File

@ -14,9 +14,9 @@ pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiResponseDecoder.java
src/main/java/org/openapitools/client/CustomInstantDeserializer.java
src/main/java/org/openapitools/client/EncodingUtils.java
src/main/java/org/openapitools/client/JacksonResponseDecoder.java
src/main/java/org/openapitools/client/ParamExpander.java
src/main/java/org/openapitools/client/RFC3339DateFormat.java
src/main/java/org/openapitools/client/ServerConfiguration.java
@ -40,6 +40,7 @@ src/main/java/org/openapitools/client/auth/OauthClientCredentialsGrant.java
src/main/java/org/openapitools/client/auth/OauthPasswordGrant.java
src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java
src/main/java/org/openapitools/client/model/Animal.java
src/main/java/org/openapitools/client/model/ApiResponse.java
src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java
src/main/java/org/openapitools/client/model/ArrayTest.java
@ -60,7 +61,6 @@ src/main/java/org/openapitools/client/model/Foo.java
src/main/java/org/openapitools/client/model/FormatTest.java
src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java
src/main/java/org/openapitools/client/model/HealthCheckResult.java
src/main/java/org/openapitools/client/model/HttpResponse.java
src/main/java/org/openapitools/client/model/InlineResponseDefault.java
src/main/java/org/openapitools/client/model/MapTest.java
src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java

View File

@ -23,7 +23,7 @@ import feign.slf4j.Slf4jLogger;
import org.openapitools.client.auth.HttpBasicAuth;
import org.openapitools.client.auth.HttpBearerAuth;
import org.openapitools.client.auth.ApiKeyAuth;
import org.openapitools.client.JacksonResponseDecoder;
import org.openapitools.client.ApiResponseDecoder;
import org.openapitools.client.auth.ApiErrorDecoder;
import org.openapitools.client.auth.OAuth;
@ -50,7 +50,7 @@ public class ApiClient {
feignBuilder = Feign.builder()
.client(new OkHttpClient())
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonResponseDecoder(objectMapper))
.decoder(new ApiResponseDecoder(objectMapper))
.errorDecoder(new ApiErrorDecoder())
.retryer(new Retryer.Default(0, 0, 2))
.logger(new Slf4jLogger());

View File

@ -0,0 +1,38 @@
package org.openapitools.client;
import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Response;
import feign.Types;
import feign.jackson.JacksonDecoder;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.openapitools.client.model.ApiResponse;
public class ApiResponseDecoder extends JacksonDecoder {
public ApiResponseDecoder(ObjectMapper mapper) {
super(mapper);
}
@Override
public Object decode(Response response, Type type) throws IOException {
Map<String, Collection<String>> responseHeaders = Collections.unmodifiableMap(response.headers());
//Detects if the type is an instance of the parameterized class ApiResponse
Type responseBodyType;
if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) {
//The ApiResponse class has a single type parameter, the Dto class itself
responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0];
Object body = super.decode(response, responseBodyType);
return new ApiResponse(response.status(), responseHeaders, body);
} else {
//The response is not encapsulated in the ApiResponse, decode the Dto as normal
return super.decode(response, type);
}
}
}

View File

@ -29,7 +29,7 @@ public class JacksonResponseDecoder extends JacksonDecoder {
//The HttpResponse class has a single type parameter, the Dto class itself
responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0];
Object body = super.decode(response, responseBodyType);
return new HttpResponse(responseHeaders, body);
return new HttpResponse(responseHeaders, body, response.status());
} else {
//The response is not encapsulated in the HttpResponse, decode the Dto as normal
return super.decode(response, type);

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.Client;
@ -34,14 +34,14 @@ public interface AnotherFakeApi extends ApiClient.Api {
* Similar to <code>call123testSpecialTags</code> but it also returns the http response headers .
* To test special tags and operation ID starting with number
* @param client client model (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("PATCH /another-fake/dummy")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Client> call123testSpecialTagsWithHttpInfo(Client client);
ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client client);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.InlineResponseDefault;
@ -31,13 +31,13 @@ public interface DefaultApi extends ApiClient.Api {
*
* Similar to <code>fooGet</code> but it also returns the http response headers .
*
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /foo")
@Headers({
"Accept: application/json",
})
HttpResponse<InlineResponseDefault> fooGetWithHttpInfo();
ApiResponse<InlineResponseDefault> fooGetWithHttpInfo();
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
@ -41,13 +41,13 @@ public interface FakeApi extends ApiClient.Api {
* Health check endpoint
* Similar to <code>fakeHealthGet</code> but it also returns the http response headers .
*
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /fake/health")
@Headers({
"Accept: application/json",
})
HttpResponse<HealthCheckResult> fakeHealthGetWithHttpInfo();
ApiResponse<HealthCheckResult> fakeHealthGetWithHttpInfo();
@ -80,7 +80,7 @@ public interface FakeApi extends ApiClient.Api {
"Accept: application/json",
"header_1: {header1}"
})
HttpResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("query1") String query1, @Param("header1") String header1);
ApiResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("query1") String query1, @Param("header1") String header1);
/**
@ -126,7 +126,7 @@ public interface FakeApi extends ApiClient.Api {
"Accept: application/json",
"header_1: {header1}"
})
HttpResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("header1") String header1, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("header1") String header1, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -158,14 +158,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterBooleanSerialize</code> but it also returns the http response headers .
* Test serialization of outer boolean types
* @param body Input boolean as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/boolean")
@Headers({
"Content-Type: application/json",
"Accept: */*",
})
HttpResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body);
ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body);
@ -187,14 +187,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterCompositeSerialize</code> but it also returns the http response headers .
* Test serialization of object with outer number type
* @param outerComposite Input composite as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/composite")
@Headers({
"Content-Type: application/json",
"Accept: */*",
})
HttpResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite);
ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite);
@ -216,14 +216,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterNumberSerialize</code> but it also returns the http response headers .
* Test serialization of outer number types
* @param body Input number as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/number")
@Headers({
"Content-Type: application/json",
"Accept: */*",
})
HttpResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body);
ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body);
@ -245,14 +245,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakeOuterStringSerialize</code> but it also returns the http response headers .
* Test serialization of outer string types
* @param body Input string as post body (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/outer/string")
@Headers({
"Content-Type: application/json",
"Accept: */*",
})
HttpResponse<String> fakeOuterStringSerializeWithHttpInfo(String body);
ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body);
@ -274,14 +274,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>fakePropertyEnumIntegerSerialize</code> but it also returns the http response headers .
* Test serialization of enum (int) properties with examples
* @param outerObjectWithEnumProperty Input enum (int) as post body (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/property/enum-int")
@Headers({
"Content-Type: application/json",
"Accept: */*",
})
HttpResponse<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty);
ApiResponse<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty);
@ -308,7 +308,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: image/png",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithBinaryWithHttpInfo(File body);
ApiResponse<Void> testBodyWithBinaryWithHttpInfo(File body);
@ -335,7 +335,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass);
ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass);
@ -364,7 +364,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User user);
ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User user);
/**
@ -406,7 +406,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testBodyWithQueryParamsWithHttpInfo(User user, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(User user, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -438,14 +438,14 @@ public interface FakeApi extends ApiClient.Api {
* Similar to <code>testClientModel</code> but it also returns the http response headers .
* To test \&quot;client\&quot; model
* @param client client model (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("PATCH /fake")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Client> testClientModelWithHttpInfo(Client client);
ApiResponse<Client> testClientModelWithHttpInfo(Client client);
@ -498,7 +498,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
HttpResponse<Void> testEndpointParametersWithHttpInfo(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
ApiResponse<Void> testEndpointParametersWithHttpInfo(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback);
@ -545,7 +545,7 @@ public interface FakeApi extends ApiClient.Api {
"enum_header_string: {enumHeaderString}"
})
HttpResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List<String> enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString);
ApiResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List<String> enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString);
/**
@ -605,7 +605,7 @@ public interface FakeApi extends ApiClient.Api {
"enum_header_string: {enumHeaderString}"
})
HttpResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List<String> enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List<String> enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -668,7 +668,7 @@ public interface FakeApi extends ApiClient.Api {
"boolean_group: {booleanGroup}"
})
HttpResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group);
ApiResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group);
/**
@ -722,7 +722,7 @@ public interface FakeApi extends ApiClient.Api {
"boolean_group: {booleanGroup}"
})
HttpResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -771,7 +771,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> requestBody);
ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> requestBody);
@ -800,7 +800,7 @@ public interface FakeApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
HttpResponse<Void> testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2);
ApiResponse<Void> testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2);
@ -837,7 +837,7 @@ public interface FakeApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List<String> pipe, @Param("ioutil") List<String> ioutil, @Param("http") List<String> http, @Param("url") List<String> url, @Param("context") List<String> context, @Param("allowEmpty") String allowEmpty, @Param("language") Map<String, String> language);
ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List<String> pipe, @Param("ioutil") List<String> ioutil, @Param("http") List<String> http, @Param("url") List<String> url, @Param("context") List<String> context, @Param("allowEmpty") String allowEmpty, @Param("language") Map<String, String> language);
/**
@ -887,7 +887,7 @@ public interface FakeApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.Client;
@ -34,14 +34,14 @@ public interface FakeClassnameTags123Api extends ApiClient.Api {
* Similar to <code>testClassname</code> but it also returns the http response headers .
* To test class name in snake case
* @param client client model (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("PATCH /fake_classname_test")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Client> testClassnameWithHttpInfo(Client client);
ApiResponse<Client> testClassnameWithHttpInfo(Client client);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
@ -42,7 +42,7 @@ public interface PetApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> addPetWithHttpInfo(Pet pet);
ApiResponse<Void> addPetWithHttpInfo(Pet pet);
@ -71,7 +71,7 @@ public interface PetApi extends ApiClient.Api {
"Accept: application/json",
"api_key: {apiKey}"
})
HttpResponse<Void> deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey);
ApiResponse<Void> deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey);
@ -92,13 +92,13 @@ public interface PetApi extends ApiClient.Api {
* Similar to <code>findPetsByStatus</code> but it also returns the http response headers .
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /pet/findByStatus?status={status}")
@Headers({
"Accept: application/json",
})
HttpResponse<List<Pet>> findPetsByStatusWithHttpInfo(@Param("status") List<String> status);
ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@Param("status") List<String> status);
/**
@ -138,7 +138,7 @@ public interface PetApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<List<Pet>> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -171,7 +171,7 @@ public interface PetApi extends ApiClient.Api {
* Similar to <code>findPetsByTags</code> but it also returns the http response headers .
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
* @deprecated
*/
@Deprecated
@ -179,7 +179,7 @@ public interface PetApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@Param("tags") Set<String> tags);
ApiResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@Param("tags") Set<String> tags);
/**
@ -223,7 +223,7 @@ public interface PetApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<Set<Pet>> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -254,13 +254,13 @@ public interface PetApi extends ApiClient.Api {
* Similar to <code>getPetById</code> but it also returns the http response headers .
* Returns a single pet
* @param petId ID of pet to return (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /pet/{petId}")
@Headers({
"Accept: application/json",
})
HttpResponse<Pet> getPetByIdWithHttpInfo(@Param("petId") Long petId);
ApiResponse<Pet> getPetByIdWithHttpInfo(@Param("petId") Long petId);
@ -287,7 +287,7 @@ public interface PetApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> updatePetWithHttpInfo(Pet pet);
ApiResponse<Void> updatePetWithHttpInfo(Pet pet);
@ -318,7 +318,7 @@ public interface PetApi extends ApiClient.Api {
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
HttpResponse<Void> updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
ApiResponse<Void> updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status);
@ -344,14 +344,14 @@ public interface PetApi extends ApiClient.Api {
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /pet/{petId}/uploadImage")
@Headers({
"Content-Type: multipart/form-data",
"Accept: application/json",
})
HttpResponse<ModelApiResponse> uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
@ -377,14 +377,14 @@ public interface PetApi extends ApiClient.Api {
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile")
@Headers({
"Content-Type: multipart/form-data",
"Accept: application/json",
})
HttpResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata);
ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.Order;
@ -37,7 +37,7 @@ public interface StoreApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> deleteOrderWithHttpInfo(@Param("orderId") String orderId);
ApiResponse<Void> deleteOrderWithHttpInfo(@Param("orderId") String orderId);
@ -56,13 +56,13 @@ public interface StoreApi extends ApiClient.Api {
* Returns pet inventories by status
* Similar to <code>getInventory</code> but it also returns the http response headers .
* Returns a map of status codes to quantities
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /store/inventory")
@Headers({
"Accept: application/json",
})
HttpResponse<Map<String, Integer>> getInventoryWithHttpInfo();
ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo();
@ -83,13 +83,13 @@ public interface StoreApi extends ApiClient.Api {
* Similar to <code>getOrderById</code> but it also returns the http response headers .
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /store/order/{orderId}")
@Headers({
"Accept: application/json",
})
HttpResponse<Order> getOrderByIdWithHttpInfo(@Param("orderId") Long orderId);
ApiResponse<Order> getOrderByIdWithHttpInfo(@Param("orderId") Long orderId);
@ -111,14 +111,14 @@ public interface StoreApi extends ApiClient.Api {
* Similar to <code>placeOrder</code> but it also returns the http response headers .
*
* @param order order placed for purchasing the pet (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("POST /store/order")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Order> placeOrderWithHttpInfo(Order order);
ApiResponse<Order> placeOrderWithHttpInfo(Order order);
}

View File

@ -2,7 +2,7 @@ package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.EncodingUtils;
import org.openapitools.client.model.HttpResponse;
import org.openapitools.client.model.ApiResponse;
import org.openapitools.client.model.User;
@ -39,7 +39,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> createUserWithHttpInfo(User user);
ApiResponse<Void> createUserWithHttpInfo(User user);
@ -66,7 +66,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user);
ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user);
@ -93,7 +93,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user);
ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user);
@ -118,7 +118,7 @@ public interface UserApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> deleteUserWithHttpInfo(@Param("username") String username);
ApiResponse<Void> deleteUserWithHttpInfo(@Param("username") String username);
@ -139,13 +139,13 @@ public interface UserApi extends ApiClient.Api {
* Similar to <code>getUserByName</code> but it also returns the http response headers .
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /user/{username}")
@Headers({
"Accept: application/json",
})
HttpResponse<User> getUserByNameWithHttpInfo(@Param("username") String username);
ApiResponse<User> getUserByNameWithHttpInfo(@Param("username") String username);
@ -168,13 +168,13 @@ public interface UserApi extends ApiClient.Api {
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return A HttpResponse that wraps the response boyd and the http headers.
* @return A ApiResponse that wraps the response boyd and the http headers.
*/
@RequestLine("GET /user/login?username={username}&password={password}")
@Headers({
"Accept: application/json",
})
HttpResponse<String> loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password);
ApiResponse<String> loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password);
/**
@ -216,7 +216,7 @@ public interface UserApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<String> loginUserWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
ApiResponse<String> loginUserWithHttpInfo(@QueryMap(encoded=true) Map<String, Object> queryParams);
/**
@ -253,7 +253,7 @@ public interface UserApi extends ApiClient.Api {
@Headers({
"Accept: application/json",
})
HttpResponse<Void> logoutUserWithHttpInfo();
ApiResponse<Void> logoutUserWithHttpInfo();
@ -282,7 +282,7 @@ public interface UserApi extends ApiClient.Api {
"Content-Type: application/json",
"Accept: application/json",
})
HttpResponse<Void> updateUserWithHttpInfo(@Param("username") String username, User user);
ApiResponse<Void> updateUserWithHttpInfo(@Param("username") String username, User user);
}

View File

@ -5,7 +5,7 @@ import feign.RetryableException;
import feign.codec.ErrorDecoder;
/**
* Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 402 may indicate an expired token
* Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token
* All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder
*/
public class ApiErrorDecoder implements ErrorDecoder {

View File

@ -0,0 +1,43 @@
package org.openapitools.client.model;
import java.util.Map;
import java.util.List;
public class ApiResponse<T>{
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
public int getStatusCode() {
return statusCode;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public T getData() {
return data;
}
}

View File

@ -9,9 +9,12 @@ public class HttpResponse<T>{
private T body;
public HttpResponse(Map<String, Collection<String>> headers, T body) {
private int status;
public HttpResponse(Map<String, Collection<String>> headers, T body, int status) {
this.headers = headers;
this.body = body;
this.status = status;
}
public T getBody(){
@ -21,4 +24,8 @@ public class HttpResponse<T>{
public Map<String, Collection<String>> getHeaders(){
return headers;
}
public int getStatus(){
return status;
}
}