diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 4b048849a15..e34a582460f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -328,6 +328,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/"); + final String modelsFolder = (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); //Common files @@ -387,6 +388,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen if (FEIGN.equals(getLibrary())) { 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")); } 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()))) { @@ -431,7 +435,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen if (ProcessUtils.hasHttpSignatureMethods(openAPI)) { supportingFiles.add(new SupportingFile("auth/HttpSignatureAuth.mustache", authFolder, "HttpSignatureAuth.java")); } - supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar), "AbstractOpenApiSchema.java")); + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java")); forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); // Composed schemas can have the 'additionalProperties' keyword, as specified in JSON schema. @@ -445,7 +449,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen setJava8ModeAndAdditionalProperties(true); supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); - supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar), "AbstractOpenApiSchema.java")); + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", modelsFolder, "AbstractOpenApiSchema.java")); forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); } else if (RESTEASY.equals(getLibrary())) { setJava8ModeAndAdditionalProperties(true); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache index 0e9d13beab5..d85891ca4d7 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -35,6 +35,7 @@ import feign.slf4j.Slf4jLogger; import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.HttpBearerAuth; import {{invokerPackage}}.auth.ApiKeyAuth; +import {{invokerPackage}}.JacksonResponseDecoder; {{#hasOAuthMethods}} import {{invokerPackage}}.auth.ApiErrorDecoder; @@ -63,7 +64,7 @@ public class ApiClient { feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new JacksonDecoder(objectMapper)) + .decoder(new JacksonResponseDecoder(objectMapper)) {{#hasOAuthMethods}} .errorDecoder(new ApiErrorDecoder()) .retryer(new Retryer.Default(0, 0, 2)) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/JacksonResponseDecoder.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/JacksonResponseDecoder.mustache new file mode 100644 index 00000000000..34f58cdd643 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/JacksonResponseDecoder.mustache @@ -0,0 +1,38 @@ +package {{invokerPackage}}; + +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 {{modelPackage}}.HttpResponse; + +public class JacksonResponseDecoder extends JacksonDecoder { + + public JacksonResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class HttpResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(HttpResponse.class)) { + //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); + } else { + //The response is not encapsulated in the HttpResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache index de0ae82baaa..f31c17e7db6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache @@ -5,6 +5,7 @@ import {{invokerPackage}}.EncodingUtils; {{#legacyDates}} import {{invokerPackage}}.ParamExpander; {{/legacyDates}} +import {{modelPackage}}.HttpResponse; {{#imports}}import {{import}}; {{/imports}} @@ -49,8 +50,39 @@ public interface {{classname}} extends ApiClient.Api { {{/-last}}{{/headerParams}} }) {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - {{#hasQueryParams}} + /** + * {{summary}} + * Similar to {{operationId}} but it also returns the http response headers . + * {{notes}} +{{#allParams}} + * @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. +{{/returnType}} +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} +{{#isDeprecated}} + * @deprecated +{{/isDeprecated}} + */ +{{#isDeprecated}} + @Deprecated +{{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ +{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", +{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{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}}); + + + {{#hasQueryParams}} /** * {{summary}} * {{notes}} @@ -95,6 +127,47 @@ public interface {{classname}} extends ApiClient.Api { {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); /** + * {{summary}} + * {{notes}} + * Note, this is equivalent to the other {{operationId}} that receives the query parameters as a map, + * but this one also exposes the Http response headers + {{#allParams}} + {{^isQueryParam}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/isQueryParam}} + {{/allParams}} + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ * + {{#returnType}} + * @return {{.}} + {{/returnType}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ + {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", + {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{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 queryParams); + + + /** * A convenience class for generating query parameters for the * {{operationId}} method in a fluent style. */ diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/model/HttpResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/model/HttpResponse.mustache new file mode 100644 index 00000000000..172ac126d35 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/model/HttpResponse.mustache @@ -0,0 +1,24 @@ +package {{modelPackage}}; + +import java.util.Map; +import java.util.Collection; + +public class HttpResponse{ + + private Map> headers; + + private T body; + + public HttpResponse(Map> headers, T body) { + this.headers = headers; + this.body = body; + } + + public T getBody(){ + return body; + } + + public Map> getHeaders(){ + return headers; + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES b/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES index b26b7d34306..14b7ee2fd7b 100644 --- a/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign-no-nullable/.openapi-generator/FILES @@ -16,6 +16,7 @@ src/main/AndroidManifest.xml src/main/java/org/openapitools/client/ApiClient.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 @@ -64,6 +65,7 @@ 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 diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 19d32c4e314..231bab571be 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -22,6 +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.auth.ApiErrorDecoder; import org.openapitools.client.auth.OAuth; @@ -48,7 +49,7 @@ public class ApiClient { feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new JacksonDecoder(objectMapper)) + .decoder(new JacksonResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) .retryer(new Retryer.Default(0, 0, 2)) .logger(new Slf4jLogger()); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/JacksonResponseDecoder.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/JacksonResponseDecoder.java new file mode 100644 index 00000000000..4951d732f22 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/JacksonResponseDecoder.java @@ -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.HttpResponse; + +public class JacksonResponseDecoder extends JacksonDecoder { + + public JacksonResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class HttpResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(HttpResponse.class)) { + //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); + } else { + //The response is not encapsulated in the HttpResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 2cefc6e4185..cb47437091f 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -2,6 +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.Client; @@ -27,4 +28,20 @@ public interface AnotherFakeApi extends ApiClient.Api { "Accept: application/json", }) Client call123testSpecialTags(Client body); + + /** + * To test special tags + * Similar to call123testSpecialTags 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. + */ + @RequestLine("PATCH /another-fake/dummy") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse call123testSpecialTagsWithHttpInfo(Client body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java index 9029ef9ffe7..a2d2628c113 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.HttpResponse; import java.math.BigDecimal; import org.openapitools.client.model.Client; @@ -35,6 +36,21 @@ public interface FakeApi extends ApiClient.Api { }) void createXmlItem(XmlItem xmlItem); + /** + * creates an XmlItem + * Similar to createXmlItem but it also returns the http response headers . + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + */ + @RequestLine("POST /fake/create_xml_item") + @Headers({ + "Content-Type: application/xml", + "Accept: application/json", + }) + HttpResponse createXmlItemWithHttpInfo(XmlItem xmlItem); + + + /** * * Test serialization of outer boolean types @@ -48,6 +64,22 @@ public interface FakeApi extends ApiClient.Api { }) Boolean fakeOuterBooleanSerialize(Boolean body); + /** + * + * Similar to fakeOuterBooleanSerialize 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. + */ + @RequestLine("POST /fake/outer/boolean") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + HttpResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body); + + + /** * * Test serialization of object with outer number type @@ -61,6 +93,22 @@ public interface FakeApi extends ApiClient.Api { }) OuterComposite fakeOuterCompositeSerialize(OuterComposite body); + /** + * + * Similar to fakeOuterCompositeSerialize 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. + */ + @RequestLine("POST /fake/outer/composite") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + HttpResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body); + + + /** * * Test serialization of outer number types @@ -74,6 +122,22 @@ public interface FakeApi extends ApiClient.Api { }) BigDecimal fakeOuterNumberSerialize(BigDecimal body); + /** + * + * Similar to fakeOuterNumberSerialize 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. + */ + @RequestLine("POST /fake/outer/number") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + HttpResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body); + + + /** * * Test serialization of outer string types @@ -87,6 +151,22 @@ public interface FakeApi extends ApiClient.Api { }) String fakeOuterStringSerialize(String body); + /** + * + * Similar to fakeOuterStringSerialize 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. + */ + @RequestLine("POST /fake/outer/string") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + HttpResponse fakeOuterStringSerializeWithHttpInfo(String body); + + + /** * * For this test, the body for this request much reference a schema named `File`. @@ -99,6 +179,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithFileSchema(FileSchemaTestClass body); + /** + * + * Similar to testBodyWithFileSchema but it also returns the http response headers . + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + */ + @RequestLine("PUT /fake/body-with-file-schema") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body); + + + /** * * @@ -112,6 +207,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithQueryParams(@Param("query") String query, User body); + /** + * + * Similar to testBodyWithQueryParams but it also returns the http response headers . + * + * @param query (required) + * @param body (required) + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User body); + + /** * * @@ -135,6 +245,26 @@ public interface FakeApi extends ApiClient.Api { void testBodyWithQueryParams(User body, @QueryMap(encoded=true) Map queryParams); /** + * + * + * Note, this is equivalent to the other testBodyWithQueryParams that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param body (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query - (required)
  • + *
+ */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testBodyWithQueryParamsWithHttpInfo(User body, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testBodyWithQueryParams method in a fluent style. */ @@ -158,6 +288,22 @@ public interface FakeApi extends ApiClient.Api { }) Client testClientModel(Client body); + /** + * To test \"client\" model + * Similar to testClientModel but it also returns the http response headers . + * To test \"client\" model + * @param body client model (required) + * @return A HttpResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /fake") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testClientModelWithHttpInfo(Client body); + + + /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -183,6 +329,34 @@ public interface FakeApi extends ApiClient.Api { }) void testEndpointParameters(@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); + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Similar to testEndpointParameters but it also returns the http response headers . + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + */ + @RequestLine("POST /fake") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + HttpResponse 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); + + + /** * To test enum parameters * To test enum parameters @@ -205,6 +379,30 @@ public interface FakeApi extends ApiClient.Api { }) void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + /** + * To test enum parameters + * Similar to testEnumParameters but it also returns the http response headers . + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + HttpResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + + /** * To test enum parameters * To test enum parameters @@ -237,6 +435,35 @@ public interface FakeApi extends ApiClient.Api { void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); /** + * To test enum parameters + * To test enum parameters + * Note, this is equivalent to the other testEnumParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • enumQueryStringArray - Query parameter enum test (string array) (optional)
  • + *
  • enumQueryString - Query parameter enum test (string) (optional, default to -efg)
  • + *
  • enumQueryInteger - Query parameter enum test (double) (optional)
  • + *
  • enumQueryDouble - Query parameter enum test (double) (optional)
  • + *
+ */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + HttpResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testEnumParameters method in a fluent style. */ @@ -278,6 +505,27 @@ public interface FakeApi extends ApiClient.Api { }) void testGroupParameters(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group); + /** + * Fake endpoint to test group parameters (optional) + * Similar to testGroupParameters but it also returns the http response headers . + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + HttpResponse 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); + + /** * Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional) @@ -307,6 +555,32 @@ public interface FakeApi extends ApiClient.Api { void testGroupParameters(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * Note, this is equivalent to the other testGroupParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param booleanGroup Boolean in group parameters (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • requiredStringGroup - Required String in group parameters (required)
  • + *
  • requiredInt64Group - Required Integer in group parameters (required)
  • + *
  • stringGroup - String in group parameters (optional)
  • + *
  • int64Group - Integer in group parameters (optional)
  • + *
+ */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + HttpResponse testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testGroupParameters method in a fluent style. */ @@ -341,6 +615,21 @@ public interface FakeApi extends ApiClient.Api { }) void testInlineAdditionalProperties(Map param); + /** + * test inline additionalProperties + * Similar to testInlineAdditionalProperties but it also returns the http response headers . + * + * @param param request body (required) + */ + @RequestLine("POST /fake/inline-additionalProperties") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testInlineAdditionalPropertiesWithHttpInfo(Map param); + + + /** * test json serialization of form data * @@ -354,6 +643,22 @@ public interface FakeApi extends ApiClient.Api { }) void testJsonFormData(@Param("param") String param, @Param("param2") String param2); + /** + * test json serialization of form data + * Similar to testJsonFormData but it also returns the http response headers . + * + * @param param field1 (required) + * @param param2 field2 (required) + */ + @RequestLine("GET /fake/jsonFormData") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + HttpResponse testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2); + + + /** * * To test the collection format in query parameters @@ -369,6 +674,23 @@ public interface FakeApi extends ApiClient.Api { }) void testQueryParameterCollectionFormat(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context); + /** + * + * Similar to testQueryParameterCollectionFormat but it also returns the http response headers . + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}") + @Headers({ + "Accept: application/json", + }) + HttpResponse testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context); + + /** * * To test the collection format in query parameters @@ -394,6 +716,28 @@ public interface FakeApi extends ApiClient.Api { void testQueryParameterCollectionFormat(@QueryMap(encoded=true) Map queryParams); /** + * + * To test the collection format in query parameters + * Note, this is equivalent to the other testQueryParameterCollectionFormat that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • pipe - (required)
  • + *
  • ioutil - (required)
  • + *
  • http - (required)
  • + *
  • url - (required)
  • + *
  • context - (required)
  • + *
+ */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}") + @Headers({ + "Accept: application/json", + }) + HttpResponse testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testQueryParameterCollectionFormat method in a fluent style. */ diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index c22fbfa8d74..2ba4d90bbe6 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -2,6 +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.Client; @@ -27,4 +28,20 @@ public interface FakeClassnameTags123Api extends ApiClient.Api { "Accept: application/json", }) Client testClassname(Client body); + + /** + * To test class name in snake case + * Similar to testClassname 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. + */ + @RequestLine("PATCH /fake_classname_test") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testClassnameWithHttpInfo(Client body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java index cb7ab4bbe63..634b3f36c7e 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/PetApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.HttpResponse; import java.io.File; import org.openapitools.client.model.ModelApiResponse; @@ -30,6 +31,21 @@ public interface PetApi extends ApiClient.Api { }) void addPet(Pet body); + /** + * Add a new pet to the store + * Similar to addPet but it also returns the http response headers . + * + * @param body Pet object that needs to be added to the store (required) + */ + @RequestLine("POST /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse addPetWithHttpInfo(Pet body); + + + /** * Deletes a pet * @@ -43,6 +59,22 @@ public interface PetApi extends ApiClient.Api { }) void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); + /** + * Deletes a pet + * Similar to deletePet but it also returns the http response headers . + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + */ + @RequestLine("DELETE /pet/{petId}") + @Headers({ + "Accept: application/json", + "api_key: {apiKey}" + }) + HttpResponse deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey); + + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -55,6 +87,20 @@ public interface PetApi extends ApiClient.Api { }) List findPetsByStatus(@Param("status") List status); + /** + * Finds Pets by status + * Similar to findPetsByStatus 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. + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByStatusWithHttpInfo(@Param("status") List status); + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -77,6 +123,25 @@ public interface PetApi extends ApiClient.Api { List findPetsByStatus(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * Note, this is equivalent to the other findPetsByStatus that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • status - Status values that need to be considered for filter (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByStatus method in a fluent style. */ @@ -101,6 +166,22 @@ public interface PetApi extends ApiClient.Api { }) Set findPetsByTags(@Param("tags") Set tags); + /** + * Finds Pets by tags + * Similar to findPetsByTags 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. + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByTagsWithHttpInfo(@Param("tags") Set tags); + + /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -125,6 +206,27 @@ public interface PetApi extends ApiClient.Api { Set findPetsByTags(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Note, this is equivalent to the other findPetsByTags that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • tags - Tags to filter by (required)
  • + *
+ * @return Set<Pet> + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByTags method in a fluent style. */ @@ -147,6 +249,21 @@ public interface PetApi extends ApiClient.Api { }) Pet getPetById(@Param("petId") Long petId); + /** + * Find pet by ID + * Similar to getPetById 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. + */ + @RequestLine("GET /pet/{petId}") + @Headers({ + "Accept: application/json", + }) + HttpResponse getPetByIdWithHttpInfo(@Param("petId") Long petId); + + + /** * Update an existing pet * @@ -159,6 +276,21 @@ public interface PetApi extends ApiClient.Api { }) void updatePet(Pet body); + /** + * Update an existing pet + * Similar to updatePet but it also returns the http response headers . + * + * @param body Pet object that needs to be added to the store (required) + */ + @RequestLine("PUT /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse updatePetWithHttpInfo(Pet body); + + + /** * Updates a pet in the store with form data * @@ -173,6 +305,23 @@ public interface PetApi extends ApiClient.Api { }) void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + /** + * Updates a pet in the store with form data + * Similar to updatePetWithForm but it also returns the http response headers . + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + */ + @RequestLine("POST /pet/{petId}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + HttpResponse updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + + + /** * uploads an image * @@ -188,6 +337,24 @@ public interface PetApi extends ApiClient.Api { }) ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + /** + * uploads an image + * Similar to uploadFile but it also returns the http response headers . + * + * @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. + */ + @RequestLine("POST /pet/{petId}/uploadImage") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + HttpResponse uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + + + /** * uploads an image (required) * @@ -202,4 +369,22 @@ public interface PetApi extends ApiClient.Api { "Accept: application/json", }) ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + /** + * uploads an image (required) + * Similar to uploadFileWithRequiredFile but it also returns the http response headers . + * + * @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. + */ + @RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + HttpResponse uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java index 5ba8227e99b..8b01a453df5 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/StoreApi.java @@ -2,6 +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.Order; @@ -26,6 +27,20 @@ public interface StoreApi extends ApiClient.Api { }) void deleteOrder(@Param("orderId") String orderId); + /** + * Delete purchase order by ID + * Similar to deleteOrder but it also returns the http response headers . + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + */ + @RequestLine("DELETE /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + HttpResponse deleteOrderWithHttpInfo(@Param("orderId") String orderId); + + + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -37,6 +52,20 @@ public interface StoreApi extends ApiClient.Api { }) Map getInventory(); + /** + * Returns pet inventories by status + * Similar to getInventory 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. + */ + @RequestLine("GET /store/inventory") + @Headers({ + "Accept: application/json", + }) + HttpResponse> getInventoryWithHttpInfo(); + + + /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -49,6 +78,21 @@ public interface StoreApi extends ApiClient.Api { }) Order getOrderById(@Param("orderId") Long orderId); + /** + * Find purchase order by ID + * Similar to getOrderById but it also returns the http response headers . + * For valid response try integer IDs with value <= 5 or > 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. + */ + @RequestLine("GET /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + HttpResponse getOrderByIdWithHttpInfo(@Param("orderId") Long orderId); + + + /** * Place an order for a pet * @@ -61,4 +105,20 @@ public interface StoreApi extends ApiClient.Api { "Accept: application/json", }) Order placeOrder(Order body); + + /** + * Place an order for a pet + * Similar to placeOrder 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. + */ + @RequestLine("POST /store/order") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + HttpResponse placeOrderWithHttpInfo(Order body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java index 40b6010dab2..d7467d0ce71 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +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.User; @@ -27,6 +28,21 @@ public interface UserApi extends ApiClient.Api { }) void createUser(User body); + /** + * Create user + * Similar to createUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param body Created user object (required) + */ + @RequestLine("POST /user") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + HttpResponse createUserWithHttpInfo(User body); + + + /** * Creates list of users with given input array * @@ -39,6 +55,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithArrayInput(List body); + /** + * Creates list of users with given input array + * Similar to createUsersWithArrayInput but it also returns the http response headers . + * + * @param body List of user object (required) + */ + @RequestLine("POST /user/createWithArray") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + HttpResponse createUsersWithArrayInputWithHttpInfo(List body); + + + /** * Creates list of users with given input array * @@ -51,6 +82,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithListInput(List body); + /** + * Creates list of users with given input array + * Similar to createUsersWithListInput but it also returns the http response headers . + * + * @param body List of user object (required) + */ + @RequestLine("POST /user/createWithList") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + HttpResponse createUsersWithListInputWithHttpInfo(List body); + + + /** * Delete user * This can only be done by the logged in user. @@ -62,6 +108,20 @@ public interface UserApi extends ApiClient.Api { }) void deleteUser(@Param("username") String username); + /** + * Delete user + * Similar to deleteUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + */ + @RequestLine("DELETE /user/{username}") + @Headers({ + "Accept: application/json", + }) + HttpResponse deleteUserWithHttpInfo(@Param("username") String username); + + + /** * Get user by user name * @@ -74,6 +134,21 @@ public interface UserApi extends ApiClient.Api { }) User getUserByName(@Param("username") String username); + /** + * Get user by user name + * Similar to getUserByName 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. + */ + @RequestLine("GET /user/{username}") + @Headers({ + "Accept: application/json", + }) + HttpResponse getUserByNameWithHttpInfo(@Param("username") String username); + + + /** * Logs user into the system * @@ -87,6 +162,21 @@ public interface UserApi extends ApiClient.Api { }) String loginUser(@Param("username") String username, @Param("password") String password); + /** + * Logs user into the system + * Similar to loginUser but it also returns the http response headers . + * + * @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. + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + HttpResponse loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password); + + /** * Logs user into the system * @@ -110,6 +200,26 @@ public interface UserApi extends ApiClient.Api { String loginUser(@QueryMap(encoded=true) Map queryParams); /** + * Logs user into the system + * + * Note, this is equivalent to the other loginUser that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • username - The user name for login (required)
  • + *
  • password - The password for login in clear text (required)
  • + *
+ * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + HttpResponse loginUserWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * loginUser method in a fluent style. */ @@ -134,6 +244,19 @@ public interface UserApi extends ApiClient.Api { }) void logoutUser(); + /** + * Logs out current logged in user session + * Similar to logoutUser but it also returns the http response headers . + * + */ + @RequestLine("GET /user/logout") + @Headers({ + "Accept: application/json", + }) + HttpResponse logoutUserWithHttpInfo(); + + + /** * Updated user * This can only be done by the logged in user. @@ -146,4 +269,20 @@ public interface UserApi extends ApiClient.Api { "Accept: application/json", }) void updateUser(@Param("username") String username, User body); + + /** + * Updated user + * Similar to updateUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + */ + @RequestLine("PUT /user/{username}") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + HttpResponse updateUserWithHttpInfo(@Param("username") String username, User body); + + } diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HttpResponse.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HttpResponse.java new file mode 100644 index 00000000000..d4f45014034 --- /dev/null +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/model/HttpResponse.java @@ -0,0 +1,24 @@ +package org.openapitools.client.model; + +import java.util.Map; +import java.util.Collection; + +public class HttpResponse{ + + private Map> headers; + + private T body; + + public HttpResponse(Map> headers, T body) { + this.headers = headers; + this.body = body; + } + + public T getBody(){ + return body; + } + + public Map> getHeaders(){ + return headers; + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/.openapi-generator/FILES b/samples/client/petstore/java/feign/.openapi-generator/FILES index 81350a81f2d..defc79334ec 100644 --- a/samples/client/petstore/java/feign/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign/.openapi-generator/FILES @@ -16,6 +16,7 @@ src/main/AndroidManifest.xml src/main/java/org/openapitools/client/ApiClient.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 @@ -59,6 +60,7 @@ 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 diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 38890aba17e..006c875c83f 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -23,6 +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.auth.ApiErrorDecoder; import org.openapitools.client.auth.OAuth; @@ -49,7 +50,7 @@ public class ApiClient { feignBuilder = Feign.builder() .client(new OkHttpClient()) .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new JacksonDecoder(objectMapper)) + .decoder(new JacksonResponseDecoder(objectMapper)) .errorDecoder(new ApiErrorDecoder()) .retryer(new Retryer.Default(0, 0, 2)) .logger(new Slf4jLogger()); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/JacksonResponseDecoder.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/JacksonResponseDecoder.java new file mode 100644 index 00000000000..4951d732f22 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/JacksonResponseDecoder.java @@ -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.HttpResponse; + +public class JacksonResponseDecoder extends JacksonDecoder { + + public JacksonResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class HttpResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(HttpResponse.class)) { + //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); + } else { + //The response is not encapsulated in the HttpResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index a7d60c2b64f..1585b7dd75c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -2,6 +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.Client; @@ -27,4 +28,20 @@ public interface AnotherFakeApi extends ApiClient.Api { "Accept: application/json", }) Client call123testSpecialTags(Client client); + + /** + * To test special tags + * Similar to call123testSpecialTags 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. + */ + @RequestLine("PATCH /another-fake/dummy") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse call123testSpecialTagsWithHttpInfo(Client client); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java index cd9b94c2e12..7621ca7909b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -2,6 +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.InlineResponseDefault; @@ -25,4 +26,18 @@ public interface DefaultApi extends ApiClient.Api { "Accept: application/json", }) InlineResponseDefault fooGet(); + + /** + * + * Similar to fooGet but it also returns the http response headers . + * + * @return A HttpResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /foo") + @Headers({ + "Accept: application/json", + }) + HttpResponse fooGetWithHttpInfo(); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java index 85ef53e3695..fad7b590f40 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.HttpResponse; import java.math.BigDecimal; import org.openapitools.client.model.Client; @@ -36,6 +37,20 @@ public interface FakeApi extends ApiClient.Api { }) HealthCheckResult fakeHealthGet(); + /** + * Health check endpoint + * Similar to fakeHealthGet but it also returns the http response headers . + * + * @return A HttpResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /fake/health") + @Headers({ + "Accept: application/json", + }) + HttpResponse fakeHealthGetWithHttpInfo(); + + + /** * test http signature authentication * @@ -51,6 +66,23 @@ public interface FakeApi extends ApiClient.Api { }) void fakeHttpSignatureTest(Pet pet, @Param("query1") String query1, @Param("header1") String header1); + /** + * test http signature authentication + * Similar to fakeHttpSignatureTest but it also returns the http response headers . + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + */ + @RequestLine("GET /fake/http-signature-test?query_1={query1}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + "header_1: {header1}" + }) + HttpResponse fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("query1") String query1, @Param("header1") String header1); + + /** * test http signature authentication * @@ -76,6 +108,28 @@ public interface FakeApi extends ApiClient.Api { void fakeHttpSignatureTest(Pet pet, @Param("header1") String header1, @QueryMap(encoded=true) Map queryParams); /** + * test http signature authentication + * + * Note, this is equivalent to the other fakeHttpSignatureTest that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param pet Pet object that needs to be added to the store (required) + * @param header1 header parameter (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query1 - query parameter (optional)
  • + *
+ */ + @RequestLine("GET /fake/http-signature-test?query_1={query1}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + "header_1: {header1}" + }) + HttpResponse fakeHttpSignatureTestWithHttpInfo(Pet pet, @Param("header1") String header1, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * fakeHttpSignatureTest method in a fluent style. */ @@ -99,6 +153,22 @@ public interface FakeApi extends ApiClient.Api { }) Boolean fakeOuterBooleanSerialize(Boolean body); + /** + * + * Similar to fakeOuterBooleanSerialize 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. + */ + @RequestLine("POST /fake/outer/boolean") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + HttpResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body); + + + /** * * Test serialization of object with outer number type @@ -112,6 +182,22 @@ public interface FakeApi extends ApiClient.Api { }) OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite); + /** + * + * Similar to fakeOuterCompositeSerialize 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. + */ + @RequestLine("POST /fake/outer/composite") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + HttpResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite); + + + /** * * Test serialization of outer number types @@ -125,6 +211,22 @@ public interface FakeApi extends ApiClient.Api { }) BigDecimal fakeOuterNumberSerialize(BigDecimal body); + /** + * + * Similar to fakeOuterNumberSerialize 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. + */ + @RequestLine("POST /fake/outer/number") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + HttpResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body); + + + /** * * Test serialization of outer string types @@ -138,6 +240,22 @@ public interface FakeApi extends ApiClient.Api { }) String fakeOuterStringSerialize(String body); + /** + * + * Similar to fakeOuterStringSerialize 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. + */ + @RequestLine("POST /fake/outer/string") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + HttpResponse fakeOuterStringSerializeWithHttpInfo(String body); + + + /** * * Test serialization of enum (int) properties with examples @@ -151,6 +269,22 @@ public interface FakeApi extends ApiClient.Api { }) OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty); + /** + * + * Similar to fakePropertyEnumIntegerSerialize 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. + */ + @RequestLine("POST /fake/property/enum-int") + @Headers({ + "Content-Type: application/json", + "Accept: */*", + }) + HttpResponse fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty); + + + /** * * For this test, the body has to be a binary file. @@ -163,6 +297,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithBinary(File body); + /** + * + * Similar to testBodyWithBinary but it also returns the http response headers . + * For this test, the body has to be a binary file. + * @param body image to upload (required) + */ + @RequestLine("PUT /fake/body-with-binary") + @Headers({ + "Content-Type: image/png", + "Accept: application/json", + }) + HttpResponse testBodyWithBinaryWithHttpInfo(File body); + + + /** * * For this test, the body for this request must reference a schema named `File`. @@ -175,6 +324,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + /** + * + * Similar to testBodyWithFileSchema but it also returns the http response headers . + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass (required) + */ + @RequestLine("PUT /fake/body-with-file-schema") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass); + + + /** * * @@ -188,6 +352,21 @@ public interface FakeApi extends ApiClient.Api { }) void testBodyWithQueryParams(@Param("query") String query, User user); + /** + * + * Similar to testBodyWithQueryParams but it also returns the http response headers . + * + * @param query (required) + * @param user (required) + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testBodyWithQueryParamsWithHttpInfo(@Param("query") String query, User user); + + /** * * @@ -211,6 +390,26 @@ public interface FakeApi extends ApiClient.Api { void testBodyWithQueryParams(User user, @QueryMap(encoded=true) Map queryParams); /** + * + * + * Note, this is equivalent to the other testBodyWithQueryParams that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param user (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query - (required)
  • + *
+ */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testBodyWithQueryParamsWithHttpInfo(User user, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testBodyWithQueryParams method in a fluent style. */ @@ -234,6 +433,22 @@ public interface FakeApi extends ApiClient.Api { }) Client testClientModel(Client client); + /** + * To test \"client\" model + * Similar to testClientModel but it also returns the http response headers . + * To test \"client\" model + * @param client client model (required) + * @return A HttpResponse that wraps the response boyd and the http headers. + */ + @RequestLine("PATCH /fake") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testClientModelWithHttpInfo(Client client); + + + /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -259,6 +474,34 @@ public interface FakeApi extends ApiClient.Api { }) void testEndpointParameters(@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); + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Similar to testEndpointParameters but it also returns the http response headers . + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + */ + @RequestLine("POST /fake") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + HttpResponse 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); + + + /** * To test enum parameters * To test enum parameters @@ -281,6 +524,30 @@ public interface FakeApi extends ApiClient.Api { }) void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + /** + * To test enum parameters + * Similar to testEnumParameters but it also returns the http response headers . + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + HttpResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + + /** * To test enum parameters * To test enum parameters @@ -313,6 +580,35 @@ public interface FakeApi extends ApiClient.Api { void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); /** + * To test enum parameters + * To test enum parameters + * Note, this is equivalent to the other testEnumParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • enumQueryStringArray - Query parameter enum test (string array) (optional)
  • + *
  • enumQueryString - Query parameter enum test (string) (optional, default to -efg)
  • + *
  • enumQueryInteger - Query parameter enum test (double) (optional)
  • + *
  • enumQueryDouble - Query parameter enum test (double) (optional)
  • + *
+ */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + HttpResponse testEnumParametersWithHttpInfo(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testEnumParameters method in a fluent style. */ @@ -354,6 +650,27 @@ public interface FakeApi extends ApiClient.Api { }) void testGroupParameters(@Param("requiredStringGroup") Integer requiredStringGroup, @Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("requiredInt64Group") Long requiredInt64Group, @Param("stringGroup") Integer stringGroup, @Param("booleanGroup") Boolean booleanGroup, @Param("int64Group") Long int64Group); + /** + * Fake endpoint to test group parameters (optional) + * Similar to testGroupParameters but it also returns the http response headers . + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + HttpResponse 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); + + /** * Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional) @@ -383,6 +700,32 @@ public interface FakeApi extends ApiClient.Api { void testGroupParameters(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * Note, this is equivalent to the other testGroupParameters that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param booleanGroup Boolean in group parameters (optional) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • requiredStringGroup - Required String in group parameters (required)
  • + *
  • requiredInt64Group - Required Integer in group parameters (required)
  • + *
  • stringGroup - String in group parameters (optional)
  • + *
  • int64Group - Integer in group parameters (optional)
  • + *
+ */ + @RequestLine("DELETE /fake?required_string_group={requiredStringGroup}&required_int64_group={requiredInt64Group}&string_group={stringGroup}&int64_group={int64Group}") + @Headers({ + "Accept: application/json", + "required_boolean_group: {requiredBooleanGroup}", + + "boolean_group: {booleanGroup}" + }) + HttpResponse testGroupParametersWithHttpInfo(@Param("requiredBooleanGroup") Boolean requiredBooleanGroup, @Param("booleanGroup") Boolean booleanGroup, @QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testGroupParameters method in a fluent style. */ @@ -417,6 +760,21 @@ public interface FakeApi extends ApiClient.Api { }) void testInlineAdditionalProperties(Map requestBody); + /** + * test inline additionalProperties + * Similar to testInlineAdditionalProperties but it also returns the http response headers . + * + * @param requestBody request body (required) + */ + @RequestLine("POST /fake/inline-additionalProperties") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testInlineAdditionalPropertiesWithHttpInfo(Map requestBody); + + + /** * test json serialization of form data * @@ -430,6 +788,22 @@ public interface FakeApi extends ApiClient.Api { }) void testJsonFormData(@Param("param") String param, @Param("param2") String param2); + /** + * test json serialization of form data + * Similar to testJsonFormData but it also returns the http response headers . + * + * @param param field1 (required) + * @param param2 field2 (required) + */ + @RequestLine("GET /fake/jsonFormData") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + HttpResponse testJsonFormDataWithHttpInfo(@Param("param") String param, @Param("param2") String param2); + + + /** * * To test the collection format in query parameters @@ -447,6 +821,25 @@ public interface FakeApi extends ApiClient.Api { }) void testQueryParameterCollectionFormat(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context, @Param("allowEmpty") String allowEmpty, @Param("language") Map language); + /** + * + * Similar to testQueryParameterCollectionFormat but it also returns the http response headers . + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @param allowEmpty (required) + * @param language (optional) + */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}&language={language}&allowEmpty={allowEmpty}") + @Headers({ + "Accept: application/json", + }) + HttpResponse testQueryParameterCollectionFormatWithHttpInfo(@Param("pipe") List pipe, @Param("ioutil") List ioutil, @Param("http") List http, @Param("url") List url, @Param("context") List context, @Param("allowEmpty") String allowEmpty, @Param("language") Map language); + + /** * * To test the collection format in query parameters @@ -474,6 +867,30 @@ public interface FakeApi extends ApiClient.Api { void testQueryParameterCollectionFormat(@QueryMap(encoded=true) Map queryParams); /** + * + * To test the collection format in query parameters + * Note, this is equivalent to the other testQueryParameterCollectionFormat that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • pipe - (required)
  • + *
  • ioutil - (required)
  • + *
  • http - (required)
  • + *
  • url - (required)
  • + *
  • context - (required)
  • + *
  • language - (optional)
  • + *
  • allowEmpty - (required)
  • + *
+ */ + @RequestLine("PUT /fake/test-query-parameters?pipe={pipe}&ioutil={ioutil}&http={http}&url={url}&context={context}&language={language}&allowEmpty={allowEmpty}") + @Headers({ + "Accept: application/json", + }) + HttpResponse testQueryParameterCollectionFormatWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * testQueryParameterCollectionFormat method in a fluent style. */ diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 17c6bfa6695..733d9d3ad26 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -2,6 +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.Client; @@ -27,4 +28,20 @@ public interface FakeClassnameTags123Api extends ApiClient.Api { "Accept: application/json", }) Client testClassname(Client client); + + /** + * To test class name in snake case + * Similar to testClassname 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. + */ + @RequestLine("PATCH /fake_classname_test") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse testClassnameWithHttpInfo(Client client); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java index 10cb8950f63..bf38d9e518e 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java @@ -2,6 +2,7 @@ package org.openapitools.client.api; import org.openapitools.client.ApiClient; import org.openapitools.client.EncodingUtils; +import org.openapitools.client.model.HttpResponse; import java.io.File; import org.openapitools.client.model.ModelApiResponse; @@ -30,6 +31,21 @@ public interface PetApi extends ApiClient.Api { }) void addPet(Pet pet); + /** + * Add a new pet to the store + * Similar to addPet but it also returns the http response headers . + * + * @param pet Pet object that needs to be added to the store (required) + */ + @RequestLine("POST /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse addPetWithHttpInfo(Pet pet); + + + /** * Deletes a pet * @@ -43,6 +59,22 @@ public interface PetApi extends ApiClient.Api { }) void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); + /** + * Deletes a pet + * Similar to deletePet but it also returns the http response headers . + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + */ + @RequestLine("DELETE /pet/{petId}") + @Headers({ + "Accept: application/json", + "api_key: {apiKey}" + }) + HttpResponse deletePetWithHttpInfo(@Param("petId") Long petId, @Param("apiKey") String apiKey); + + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -55,6 +87,20 @@ public interface PetApi extends ApiClient.Api { }) List findPetsByStatus(@Param("status") List status); + /** + * Finds Pets by status + * Similar to findPetsByStatus 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. + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByStatusWithHttpInfo(@Param("status") List status); + + /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -77,6 +123,25 @@ public interface PetApi extends ApiClient.Api { List findPetsByStatus(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * Note, this is equivalent to the other findPetsByStatus that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • status - Status values that need to be considered for filter (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByStatusWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByStatus method in a fluent style. */ @@ -101,6 +166,22 @@ public interface PetApi extends ApiClient.Api { }) Set findPetsByTags(@Param("tags") Set tags); + /** + * Finds Pets by tags + * Similar to findPetsByTags 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. + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByTagsWithHttpInfo(@Param("tags") Set tags); + + /** * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -125,6 +206,27 @@ public interface PetApi extends ApiClient.Api { Set findPetsByTags(@QueryMap(encoded=true) Map queryParams); /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Note, this is equivalent to the other findPetsByTags that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • tags - Tags to filter by (required)
  • + *
+ * @return Set<Pet> + * @deprecated + */ + @Deprecated + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + HttpResponse> findPetsByTagsWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * findPetsByTags method in a fluent style. */ @@ -147,6 +249,21 @@ public interface PetApi extends ApiClient.Api { }) Pet getPetById(@Param("petId") Long petId); + /** + * Find pet by ID + * Similar to getPetById 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. + */ + @RequestLine("GET /pet/{petId}") + @Headers({ + "Accept: application/json", + }) + HttpResponse getPetByIdWithHttpInfo(@Param("petId") Long petId); + + + /** * Update an existing pet * @@ -159,6 +276,21 @@ public interface PetApi extends ApiClient.Api { }) void updatePet(Pet pet); + /** + * Update an existing pet + * Similar to updatePet but it also returns the http response headers . + * + * @param pet Pet object that needs to be added to the store (required) + */ + @RequestLine("PUT /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse updatePetWithHttpInfo(Pet pet); + + + /** * Updates a pet in the store with form data * @@ -173,6 +305,23 @@ public interface PetApi extends ApiClient.Api { }) void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + /** + * Updates a pet in the store with form data + * Similar to updatePetWithForm but it also returns the http response headers . + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + */ + @RequestLine("POST /pet/{petId}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + HttpResponse updatePetWithFormWithHttpInfo(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + + + /** * uploads an image * @@ -188,6 +337,24 @@ public interface PetApi extends ApiClient.Api { }) ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + /** + * uploads an image + * Similar to uploadFile but it also returns the http response headers . + * + * @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. + */ + @RequestLine("POST /pet/{petId}/uploadImage") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + HttpResponse uploadFileWithHttpInfo(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + + + /** * uploads an image (required) * @@ -202,4 +369,22 @@ public interface PetApi extends ApiClient.Api { "Accept: application/json", }) ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + /** + * uploads an image (required) + * Similar to uploadFileWithRequiredFile but it also returns the http response headers . + * + * @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. + */ + @RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + HttpResponse uploadFileWithRequiredFileWithHttpInfo(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java index 21611cabe79..638e6df824c 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java @@ -2,6 +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.Order; @@ -26,6 +27,20 @@ public interface StoreApi extends ApiClient.Api { }) void deleteOrder(@Param("orderId") String orderId); + /** + * Delete purchase order by ID + * Similar to deleteOrder but it also returns the http response headers . + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @param orderId ID of the order that needs to be deleted (required) + */ + @RequestLine("DELETE /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + HttpResponse deleteOrderWithHttpInfo(@Param("orderId") String orderId); + + + /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -37,6 +52,20 @@ public interface StoreApi extends ApiClient.Api { }) Map getInventory(); + /** + * Returns pet inventories by status + * Similar to getInventory 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. + */ + @RequestLine("GET /store/inventory") + @Headers({ + "Accept: application/json", + }) + HttpResponse> getInventoryWithHttpInfo(); + + + /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -49,6 +78,21 @@ public interface StoreApi extends ApiClient.Api { }) Order getOrderById(@Param("orderId") Long orderId); + /** + * Find purchase order by ID + * Similar to getOrderById but it also returns the http response headers . + * For valid response try integer IDs with value <= 5 or > 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. + */ + @RequestLine("GET /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + HttpResponse getOrderByIdWithHttpInfo(@Param("orderId") Long orderId); + + + /** * Place an order for a pet * @@ -61,4 +105,20 @@ public interface StoreApi extends ApiClient.Api { "Accept: application/json", }) Order placeOrder(Order order); + + /** + * Place an order for a pet + * Similar to placeOrder 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. + */ + @RequestLine("POST /store/order") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse placeOrderWithHttpInfo(Order order); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java index f7f9fcb3194..99e634ab9ac 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java @@ -2,6 +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.User; @@ -27,6 +28,21 @@ public interface UserApi extends ApiClient.Api { }) void createUser(User user); + /** + * Create user + * Similar to createUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param user Created user object (required) + */ + @RequestLine("POST /user") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse createUserWithHttpInfo(User user); + + + /** * Creates list of users with given input array * @@ -39,6 +55,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithArrayInput(List user); + /** + * Creates list of users with given input array + * Similar to createUsersWithArrayInput but it also returns the http response headers . + * + * @param user List of user object (required) + */ + @RequestLine("POST /user/createWithArray") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse createUsersWithArrayInputWithHttpInfo(List user); + + + /** * Creates list of users with given input array * @@ -51,6 +82,21 @@ public interface UserApi extends ApiClient.Api { }) void createUsersWithListInput(List user); + /** + * Creates list of users with given input array + * Similar to createUsersWithListInput but it also returns the http response headers . + * + * @param user List of user object (required) + */ + @RequestLine("POST /user/createWithList") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse createUsersWithListInputWithHttpInfo(List user); + + + /** * Delete user * This can only be done by the logged in user. @@ -62,6 +108,20 @@ public interface UserApi extends ApiClient.Api { }) void deleteUser(@Param("username") String username); + /** + * Delete user + * Similar to deleteUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + */ + @RequestLine("DELETE /user/{username}") + @Headers({ + "Accept: application/json", + }) + HttpResponse deleteUserWithHttpInfo(@Param("username") String username); + + + /** * Get user by user name * @@ -74,6 +134,21 @@ public interface UserApi extends ApiClient.Api { }) User getUserByName(@Param("username") String username); + /** + * Get user by user name + * Similar to getUserByName 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. + */ + @RequestLine("GET /user/{username}") + @Headers({ + "Accept: application/json", + }) + HttpResponse getUserByNameWithHttpInfo(@Param("username") String username); + + + /** * Logs user into the system * @@ -87,6 +162,21 @@ public interface UserApi extends ApiClient.Api { }) String loginUser(@Param("username") String username, @Param("password") String password); + /** + * Logs user into the system + * Similar to loginUser but it also returns the http response headers . + * + * @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. + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + HttpResponse loginUserWithHttpInfo(@Param("username") String username, @Param("password") String password); + + /** * Logs user into the system * @@ -110,6 +200,26 @@ public interface UserApi extends ApiClient.Api { String loginUser(@QueryMap(encoded=true) Map queryParams); /** + * Logs user into the system + * + * Note, this is equivalent to the other loginUser that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • username - The user name for login (required)
  • + *
  • password - The password for login in clear text (required)
  • + *
+ * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + HttpResponse loginUserWithHttpInfo(@QueryMap(encoded=true) Map queryParams); + + + /** * A convenience class for generating query parameters for the * loginUser method in a fluent style. */ @@ -134,6 +244,19 @@ public interface UserApi extends ApiClient.Api { }) void logoutUser(); + /** + * Logs out current logged in user session + * Similar to logoutUser but it also returns the http response headers . + * + */ + @RequestLine("GET /user/logout") + @Headers({ + "Accept: application/json", + }) + HttpResponse logoutUserWithHttpInfo(); + + + /** * Updated user * This can only be done by the logged in user. @@ -146,4 +269,20 @@ public interface UserApi extends ApiClient.Api { "Accept: application/json", }) void updateUser(@Param("username") String username, User user); + + /** + * Updated user + * Similar to updateUser but it also returns the http response headers . + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + */ + @RequestLine("PUT /user/{username}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + HttpResponse updateUserWithHttpInfo(@Param("username") String username, User user); + + } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HttpResponse.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HttpResponse.java new file mode 100644 index 00000000000..d4f45014034 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/HttpResponse.java @@ -0,0 +1,24 @@ +package org.openapitools.client.model; + +import java.util.Map; +import java.util.Collection; + +public class HttpResponse{ + + private Map> headers; + + private T body; + + public HttpResponse(Map> headers, T body) { + this.headers = headers; + this.body = body; + } + + public T getBody(){ + return body; + } + + public Map> getHeaders(){ + return headers; + } +} \ No newline at end of file