diff --git a/.gitattributes b/.gitattributes index def43c73b65..86e3f4ed4b1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ **/*.mustache linguist-vendored=true +* text=auto eol=lf diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache index 8c3ae87ef01..677b8304f80 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache @@ -31,6 +31,7 @@ import org.springframework.http.client.reactive.ClientHttpRequest; import org.springframework.web.client.RestClientException; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.BodyInserter; import org.springframework.web.reactive.function.BodyInserters; @@ -604,31 +605,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} { * @param returnType The return type into which to deserialize the response * @return The response body in chosen type */ - public Mono invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { + public ResponseSpec invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); - return requestBuilder.retrieve().bodyToMono(returnType); - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param the return type to use - * @param path The sub-path of the HTTP URL - * @param method The request method - * @param pathParams The path parameters - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @return The response body in chosen type - */ - public Flux invokeFluxAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { - final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); - return requestBuilder.retrieve().bodyToFlux(returnType); + return requestBuilder.retrieve(); } private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames) { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache index 5fbef45db81..dcd86e45fc9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/api.mustache @@ -18,12 +18,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -62,7 +64,7 @@ public class {{classname}} { * @see {{summary}} Documentation {{/externalDocs}} */ - public {{#returnType}}{{#isArray}}Flux<{{{returnBaseType}}}>{{/isArray}}{{^isArray}}Mono<{{{returnType}}}>{{/isArray}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + private ResponseSpec {{operationId}}RequestCreation({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}} {{#required}} @@ -125,7 +127,29 @@ public class {{classname}} { String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} - return apiClient.{{#isArray}}invokeFluxAPI{{/isArray}}{{^isArray}}invokeAPI{{/isArray}}("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * {{summary}} + * {{notes}} +{{#responses}} *

{{code}}{{#message}} - {{message}}{{/message}} +{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}} +{{/allParams}}{{#returnType}} * @return {{returnType}} +{{/returnType}} * @throws WebClientResponseException if an error occurs while attempting to invoke the API +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} + */ + public {{#returnType}}{{#isArray}}Flux<{{{returnBaseType}}}>{{/isArray}}{{^isArray}}Mono<{{{returnType}}}>{{/isArray}} {{/returnType}}{{^returnType}}Mono {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} + return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#isArray}}bodyToFlux{{/isArray}}{{^isArray}}bodyToMono{{/isArray}}(localVarReturnType); + } + + public {{#returnType}}{{#isArray}}Mono>>{{/isArray}}{{^isArray}}Mono>{{/isArray}} {{/returnType}}{{^returnType}}Mono> {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws WebClientResponseException { + {{#returnType}}ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}> localVarReturnType = new ParameterizedTypeReference<{{#isArray}}{{{returnBaseType}}}{{/isArray}}{{^isArray}}{{{returnType}}}{{/isArray}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {};{{/returnType}} + return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).{{#isArray}}toEntityList{{/isArray}}{{^isArray}}toEntity{{/isArray}}(localVarReturnType); } {{/operation}} } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java index a5823b9bbb3..ecf56b68430 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java @@ -29,6 +29,7 @@ import org.springframework.http.client.reactive.ClientHttpRequest; import org.springframework.web.client.RestClientException; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.BodyInserter; import org.springframework.web.reactive.function.BodyInserters; @@ -589,31 +590,9 @@ public class ApiClient extends JavaTimeFormatter { * @param returnType The return type into which to deserialize the response * @return The response body in chosen type */ - public Mono invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { + public ResponseSpec invokeAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); - return requestBuilder.retrieve().bodyToMono(returnType); - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param the return type to use - * @param path The sub-path of the HTTP URL - * @param method The request method - * @param pathParams The path parameters - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @return The response body in chosen type - */ - public Flux invokeFluxAPI(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { - final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames); - return requestBuilder.retrieve().bodyToFlux(returnType); + return requestBuilder.retrieve(); } private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map pathParams, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames) { diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index edc44d99937..20e60e88ad2 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -15,12 +15,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -53,7 +55,7 @@ public class AnotherFakeApi { * @return Client * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono call123testSpecialTags(Client body) throws WebClientResponseException { + private ResponseSpec call123testSpecialTagsRequestCreation(Client body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -81,4 +83,22 @@ public class AnotherFakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/another-fake/dummy", HttpMethod.PATCH, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * To test special tags + * To test special tags and operation ID starting with number + *

200 - successful operation + * @param body client model + * @return Client + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono call123testSpecialTags(Client body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return call123testSpecialTagsRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> call123testSpecialTagsWithHttpInfo(Client body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return call123testSpecialTagsRequestCreation(body).toEntity(localVarReturnType); + } } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index 95108f72e5e..aea0af298fa 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -23,12 +23,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -60,7 +62,7 @@ public class FakeApi { * @param xmlItem XmlItem Body * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono createXmlItem(XmlItem xmlItem) throws WebClientResponseException { + private ResponseSpec createXmlItemRequestCreation(XmlItem xmlItem) throws WebClientResponseException { Object postBody = xmlItem; // verify the required parameter 'xmlItem' is set if (xmlItem == null) { @@ -86,6 +88,23 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/create_xml_item", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * creates an XmlItem + * this route creates an XmlItem + *

200 - successful operation + * @param xmlItem XmlItem Body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono createXmlItem(XmlItem xmlItem) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createXmlItemRequestCreation(xmlItem).bodyToMono(localVarReturnType); + } + + public Mono> createXmlItemWithHttpInfo(XmlItem xmlItem) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createXmlItemRequestCreation(xmlItem).toEntity(localVarReturnType); + } /** * * Test serialization of outer boolean types @@ -94,7 +113,7 @@ public class FakeApi { * @return Boolean * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono fakeOuterBooleanSerialize(Boolean body) throws WebClientResponseException { + private ResponseSpec fakeOuterBooleanSerializeRequestCreation(Boolean body) throws WebClientResponseException { Object postBody = body; // create path and map variables final Map pathParams = new HashMap(); @@ -116,6 +135,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/outer/boolean", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * Test serialization of outer boolean types + *

200 - Output boolean + * @param body Input boolean as post body + * @return Boolean + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeOuterBooleanSerialize(Boolean body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterBooleanSerializeRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterBooleanSerializeRequestCreation(body).toEntity(localVarReturnType); + } /** * * Test serialization of object with outer number type @@ -124,7 +161,7 @@ public class FakeApi { * @return OuterComposite * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono fakeOuterCompositeSerialize(OuterComposite body) throws WebClientResponseException { + private ResponseSpec fakeOuterCompositeSerializeRequestCreation(OuterComposite body) throws WebClientResponseException { Object postBody = body; // create path and map variables final Map pathParams = new HashMap(); @@ -146,6 +183,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/outer/composite", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * Test serialization of object with outer number type + *

200 - Output composite + * @param body Input composite as post body + * @return OuterComposite + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeOuterCompositeSerialize(OuterComposite body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterCompositeSerializeRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterCompositeSerializeRequestCreation(body).toEntity(localVarReturnType); + } /** * * Test serialization of outer number types @@ -154,7 +209,7 @@ public class FakeApi { * @return BigDecimal * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono fakeOuterNumberSerialize(BigDecimal body) throws WebClientResponseException { + private ResponseSpec fakeOuterNumberSerializeRequestCreation(BigDecimal body) throws WebClientResponseException { Object postBody = body; // create path and map variables final Map pathParams = new HashMap(); @@ -176,6 +231,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/outer/number", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * Test serialization of outer number types + *

200 - Output number + * @param body Input number as post body + * @return BigDecimal + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeOuterNumberSerialize(BigDecimal body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterNumberSerializeRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterNumberSerializeRequestCreation(body).toEntity(localVarReturnType); + } /** * * Test serialization of outer string types @@ -184,7 +257,7 @@ public class FakeApi { * @return String * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono fakeOuterStringSerialize(String body) throws WebClientResponseException { + private ResponseSpec fakeOuterStringSerializeRequestCreation(String body) throws WebClientResponseException { Object postBody = body; // create path and map variables final Map pathParams = new HashMap(); @@ -206,6 +279,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/outer/string", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * Test serialization of outer string types + *

200 - Output string + * @param body Input string as post body + * @return String + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeOuterStringSerialize(String body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterStringSerializeRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> fakeOuterStringSerializeWithHttpInfo(String body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeOuterStringSerializeRequestCreation(body).toEntity(localVarReturnType); + } /** * * For this test, the body for this request much reference a schema named `File`. @@ -213,7 +304,7 @@ public class FakeApi { * @param body The body parameter * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testBodyWithFileSchema(FileSchemaTestClass body) throws WebClientResponseException { + private ResponseSpec testBodyWithFileSchemaRequestCreation(FileSchemaTestClass body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -239,6 +330,23 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/body-with-file-schema", HttpMethod.PUT, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + *

200 - Success + * @param body The body parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testBodyWithFileSchema(FileSchemaTestClass body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testBodyWithFileSchemaRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testBodyWithFileSchemaRequestCreation(body).toEntity(localVarReturnType); + } /** * * @@ -247,7 +355,7 @@ public class FakeApi { * @param body The body parameter * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testBodyWithQueryParams(String query, User body) throws WebClientResponseException { + private ResponseSpec testBodyWithQueryParamsRequestCreation(String query, User body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'query' is set if (query == null) { @@ -279,6 +387,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/body-with-query-params", HttpMethod.PUT, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * + *

200 - Success + * @param query The query parameter + * @param body The body parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testBodyWithQueryParams(String query, User body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testBodyWithQueryParamsRequestCreation(query, body).bodyToMono(localVarReturnType); + } + + public Mono> testBodyWithQueryParamsWithHttpInfo(String query, User body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testBodyWithQueryParamsRequestCreation(query, body).toEntity(localVarReturnType); + } /** * To test \"client\" model * To test \"client\" model @@ -287,7 +413,7 @@ public class FakeApi { * @return Client * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testClientModel(Client body) throws WebClientResponseException { + private ResponseSpec testClientModelRequestCreation(Client body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -315,6 +441,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake", HttpMethod.PATCH, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * To test \"client\" model + * To test \"client\" model + *

200 - successful operation + * @param body client model + * @return Client + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testClientModel(Client body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testClientModelRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> testClientModelWithHttpInfo(Client body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testClientModelRequestCreation(body).toEntity(localVarReturnType); + } /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -336,7 +480,7 @@ public class FakeApi { * @param paramCallback None * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws WebClientResponseException { + private ResponseSpec testEndpointParametersRequestCreation(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'number' is set if (number == null) { @@ -403,6 +547,37 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + *

400 - Invalid username supplied + *

404 - User not found + * @param number None + * @param _double None + * @param patternWithoutDelimiter None + * @param _byte None + * @param integer None + * @param int32 None + * @param int64 None + * @param _float None + * @param string None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @param paramCallback None + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testEndpointParametersRequestCreation(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback).bodyToMono(localVarReturnType); + } + + public Mono> testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testEndpointParametersRequestCreation(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback).toEntity(localVarReturnType); + } /** * To test enum parameters * To test enum parameters @@ -418,7 +593,7 @@ public class FakeApi { * @param enumFormString Form parameter enum test (string) * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws WebClientResponseException { + private ResponseSpec testEnumParametersRequestCreation(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws WebClientResponseException { Object postBody = null; // create path and map variables final Map pathParams = new HashMap(); @@ -454,6 +629,31 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * To test enum parameters + * To test enum parameters + *

400 - Invalid request + *

404 - Not found + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testEnumParametersRequestCreation(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString).bodyToMono(localVarReturnType); + } + + public Mono> testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testEnumParametersRequestCreation(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString).toEntity(localVarReturnType); + } /** * Fake endpoint to test group parameters (optional) * Fake endpoint to test group parameters (optional) @@ -466,7 +666,7 @@ public class FakeApi { * @param int64Group Integer in group parameters * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws WebClientResponseException { + private ResponseSpec testGroupParametersRequestCreation(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { @@ -507,6 +707,28 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake", HttpMethod.DELETE, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + *

400 - Someting wrong + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters + * @param booleanGroup Boolean in group parameters + * @param int64Group Integer in group parameters + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testGroupParametersRequestCreation(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group).bodyToMono(localVarReturnType); + } + + public Mono> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testGroupParametersRequestCreation(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group).toEntity(localVarReturnType); + } /** * test inline additionalProperties * @@ -514,7 +736,7 @@ public class FakeApi { * @param param request body * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testInlineAdditionalProperties(Map param) throws WebClientResponseException { + private ResponseSpec testInlineAdditionalPropertiesRequestCreation(Map param) throws WebClientResponseException { Object postBody = param; // verify the required parameter 'param' is set if (param == null) { @@ -540,6 +762,23 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/inline-additionalProperties", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * test inline additionalProperties + * + *

200 - successful operation + * @param param request body + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testInlineAdditionalProperties(Map param) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testInlineAdditionalPropertiesRequestCreation(param).bodyToMono(localVarReturnType); + } + + public Mono> testInlineAdditionalPropertiesWithHttpInfo(Map param) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testInlineAdditionalPropertiesRequestCreation(param).toEntity(localVarReturnType); + } /** * test json serialization of form data * @@ -548,7 +787,7 @@ public class FakeApi { * @param param2 field2 * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testJsonFormData(String param, String param2) throws WebClientResponseException { + private ResponseSpec testJsonFormDataRequestCreation(String param, String param2) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'param' is set if (param == null) { @@ -583,6 +822,24 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/jsonFormData", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * test json serialization of form data + * + *

200 - successful operation + * @param param field1 + * @param param2 field2 + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testJsonFormData(String param, String param2) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testJsonFormDataRequestCreation(param, param2).bodyToMono(localVarReturnType); + } + + public Mono> testJsonFormDataWithHttpInfo(String param, String param2) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testJsonFormDataRequestCreation(param, param2).toEntity(localVarReturnType); + } /** * * To test the collection format in query parameters @@ -594,7 +851,7 @@ public class FakeApi { * @param context The context parameter * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws WebClientResponseException { + private ResponseSpec testQueryParameterCollectionFormatRequestCreation(List pipe, List ioutil, List http, List url, List context) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'pipe' is set if (pipe == null) { @@ -640,4 +897,25 @@ public class FakeApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/test-query-paramters", HttpMethod.PUT, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * + * To test the collection format in query parameters + *

200 - Success + * @param pipe The pipe parameter + * @param ioutil The ioutil parameter + * @param http The http parameter + * @param url The url parameter + * @param context The context parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testQueryParameterCollectionFormatRequestCreation(pipe, ioutil, http, url, context).bodyToMono(localVarReturnType); + } + + public Mono> testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testQueryParameterCollectionFormatRequestCreation(pipe, ioutil, http, url, context).toEntity(localVarReturnType); + } } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 2a2d3f3e1d8..3ccd9ca33c6 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -15,12 +15,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -53,7 +55,7 @@ public class FakeClassnameTags123Api { * @return Client * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono testClassname(Client body) throws WebClientResponseException { + private ResponseSpec testClassnameRequestCreation(Client body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -81,4 +83,22 @@ public class FakeClassnameTags123Api { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake_classname_test", HttpMethod.PATCH, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * To test class name in snake case + * To test class name in snake case + *

200 - successful operation + * @param body client model + * @return Client + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono testClassname(Client body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testClassnameRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> testClassnameWithHttpInfo(Client body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return testClassnameRequestCreation(body).toEntity(localVarReturnType); + } } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java index 3749fe40927..7166d6b0336 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/PetApi.java @@ -18,12 +18,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -56,7 +58,7 @@ public class PetApi { * @param body Pet object that needs to be added to the store * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono addPet(Pet body) throws WebClientResponseException { + private ResponseSpec addPetRequestCreation(Pet body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -82,6 +84,24 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Add a new pet to the store + * + *

200 - successful operation + *

405 - Invalid input + * @param body Pet object that needs to be added to the store + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono addPet(Pet body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return addPetRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> addPetWithHttpInfo(Pet body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return addPetRequestCreation(body).toEntity(localVarReturnType); + } /** * Deletes a pet * @@ -91,7 +111,7 @@ public class PetApi { * @param apiKey The apiKey parameter * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono deletePet(Long petId, String apiKey) throws WebClientResponseException { + private ResponseSpec deletePetRequestCreation(Long petId, String apiKey) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'petId' is set if (petId == null) { @@ -119,6 +139,25 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.DELETE, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Deletes a pet + * + *

200 - successful operation + *

400 - Invalid pet value + * @param petId Pet id to delete + * @param apiKey The apiKey parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono deletePet(Long petId, String apiKey) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return deletePetRequestCreation(petId, apiKey).bodyToMono(localVarReturnType); + } + + public Mono> deletePetWithHttpInfo(Long petId, String apiKey) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return deletePetRequestCreation(petId, apiKey).toEntity(localVarReturnType); + } /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -128,7 +167,7 @@ public class PetApi { * @return List<Pet> * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Flux findPetsByStatus(List status) throws WebClientResponseException { + private ResponseSpec findPetsByStatusRequestCreation(List status) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'status' is set if (status == null) { @@ -154,7 +193,26 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeFluxAPI("/pet/findByStatus", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("/pet/findByStatus", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + *

200 - successful operation + *

400 - Invalid status value + * @param status Status values that need to be considered for filter + * @return List<Pet> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Flux findPetsByStatus(List status) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return findPetsByStatusRequestCreation(status).bodyToFlux(localVarReturnType); + } + + public Mono>> findPetsByStatusWithHttpInfo(List status) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return findPetsByStatusRequestCreation(status).toEntityList(localVarReturnType); } /** * Finds Pets by tags @@ -165,7 +223,7 @@ public class PetApi { * @return Set<Pet> * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Flux findPetsByTags(Set tags) throws WebClientResponseException { + private ResponseSpec findPetsByTagsRequestCreation(Set tags) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'tags' is set if (tags == null) { @@ -191,7 +249,26 @@ public class PetApi { String[] localVarAuthNames = new String[] { "petstore_auth" }; ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return apiClient.invokeFluxAPI("/pet/findByTags", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + return apiClient.invokeAPI("/pet/findByTags", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + *

200 - successful operation + *

400 - Invalid tag value + * @param tags Tags to filter by + * @return Set<Pet> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Flux findPetsByTags(Set tags) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return findPetsByTagsRequestCreation(tags).bodyToFlux(localVarReturnType); + } + + public Mono>> findPetsByTagsWithHttpInfo(Set tags) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return findPetsByTagsRequestCreation(tags).toEntityList(localVarReturnType); } /** * Find pet by ID @@ -203,7 +280,7 @@ public class PetApi { * @return Pet * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono getPetById(Long petId) throws WebClientResponseException { + private ResponseSpec getPetByIdRequestCreation(Long petId) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'petId' is set if (petId == null) { @@ -231,6 +308,26 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Find pet by ID + * Returns a single pet + *

200 - successful operation + *

400 - Invalid ID supplied + *

404 - Pet not found + * @param petId ID of pet to return + * @return Pet + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono getPetById(Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return getPetByIdRequestCreation(petId).bodyToMono(localVarReturnType); + } + + public Mono> getPetByIdWithHttpInfo(Long petId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return getPetByIdRequestCreation(petId).toEntity(localVarReturnType); + } /** * Update an existing pet * @@ -241,7 +338,7 @@ public class PetApi { * @param body Pet object that needs to be added to the store * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono updatePet(Pet body) throws WebClientResponseException { + private ResponseSpec updatePetRequestCreation(Pet body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -267,6 +364,26 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet", HttpMethod.PUT, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Update an existing pet + * + *

200 - successful operation + *

400 - Invalid ID supplied + *

404 - Pet not found + *

405 - Validation exception + * @param body Pet object that needs to be added to the store + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono updatePet(Pet body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return updatePetRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> updatePetWithHttpInfo(Pet body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return updatePetRequestCreation(body).toEntity(localVarReturnType); + } /** * Updates a pet in the store with form data * @@ -276,7 +393,7 @@ public class PetApi { * @param status Updated status of the pet * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono updatePetWithForm(Long petId, String name, String status) throws WebClientResponseException { + private ResponseSpec updatePetWithFormRequestCreation(Long petId, String name, String status) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'petId' is set if (petId == null) { @@ -309,6 +426,25 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Updates a pet in the store with form data + * + *

405 - Invalid input + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono updatePetWithForm(Long petId, String name, String status) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return updatePetWithFormRequestCreation(petId, name, status).bodyToMono(localVarReturnType); + } + + public Mono> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return updatePetWithFormRequestCreation(petId, name, status).toEntity(localVarReturnType); + } /** * uploads an image * @@ -319,7 +455,7 @@ public class PetApi { * @return ModelApiResponse * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono uploadFile(Long petId, String additionalMetadata, File file) throws WebClientResponseException { + private ResponseSpec uploadFileRequestCreation(Long petId, String additionalMetadata, File file) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'petId' is set if (petId == null) { @@ -354,6 +490,26 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/pet/{petId}/uploadImage", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * uploads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return ModelApiResponse + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono uploadFile(Long petId, String additionalMetadata, File file) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return uploadFileRequestCreation(petId, additionalMetadata, file).bodyToMono(localVarReturnType); + } + + public Mono> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return uploadFileRequestCreation(petId, additionalMetadata, file).toEntity(localVarReturnType); + } /** * uploads an image (required) * @@ -364,7 +520,7 @@ public class PetApi { * @return ModelApiResponse * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws WebClientResponseException { + private ResponseSpec uploadFileWithRequiredFileRequestCreation(Long petId, File requiredFile, String additionalMetadata) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'petId' is set if (petId == null) { @@ -403,4 +559,24 @@ public class PetApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/fake/{petId}/uploadImageWithRequiredFile", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * uploads an image (required) + * + *

200 - successful operation + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server + * @return ModelApiResponse + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return uploadFileWithRequiredFileRequestCreation(petId, requiredFile, additionalMetadata).bodyToMono(localVarReturnType); + } + + public Mono> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return uploadFileWithRequiredFileRequestCreation(petId, requiredFile, additionalMetadata).toEntity(localVarReturnType); + } } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java index 98d603a2545..3cd8dd6270c 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/StoreApi.java @@ -15,12 +15,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -53,7 +55,7 @@ public class StoreApi { * @param orderId ID of the order that needs to be deleted * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono deleteOrder(String orderId) throws WebClientResponseException { + private ResponseSpec deleteOrderRequestCreation(String orderId) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'orderId' is set if (orderId == null) { @@ -79,6 +81,24 @@ public class StoreApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.DELETE, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + *

400 - Invalid ID supplied + *

404 - Order not found + * @param orderId ID of the order that needs to be deleted + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono deleteOrder(String orderId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return deleteOrderRequestCreation(orderId).bodyToMono(localVarReturnType); + } + + public Mono> deleteOrderWithHttpInfo(String orderId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return deleteOrderRequestCreation(orderId).toEntity(localVarReturnType); + } /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -86,7 +106,7 @@ public class StoreApi { * @return Map<String, Integer> * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono> getInventory() throws WebClientResponseException { + private ResponseSpec getInventoryRequestCreation() throws WebClientResponseException { Object postBody = null; // create path and map variables final Map pathParams = new HashMap(); @@ -108,6 +128,23 @@ public class StoreApi { ParameterizedTypeReference> localVarReturnType = new ParameterizedTypeReference>() {}; return apiClient.invokeAPI("/store/inventory", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + *

200 - successful operation + * @return Map<String, Integer> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> getInventory() throws WebClientResponseException { + ParameterizedTypeReference> localVarReturnType = new ParameterizedTypeReference>() {}; + return getInventoryRequestCreation().bodyToMono(localVarReturnType); + } + + public Mono>> getInventoryWithHttpInfo() throws WebClientResponseException { + ParameterizedTypeReference> localVarReturnType = new ParameterizedTypeReference>() {}; + return getInventoryRequestCreation().toEntity(localVarReturnType); + } /** * Find purchase order by ID * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -118,7 +155,7 @@ public class StoreApi { * @return Order * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono getOrderById(Long orderId) throws WebClientResponseException { + private ResponseSpec getOrderByIdRequestCreation(Long orderId) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'orderId' is set if (orderId == null) { @@ -146,6 +183,26 @@ public class StoreApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + *

200 - successful operation + *

400 - Invalid ID supplied + *

404 - Order not found + * @param orderId ID of pet that needs to be fetched + * @return Order + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono getOrderById(Long orderId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return getOrderByIdRequestCreation(orderId).bodyToMono(localVarReturnType); + } + + public Mono> getOrderByIdWithHttpInfo(Long orderId) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return getOrderByIdRequestCreation(orderId).toEntity(localVarReturnType); + } /** * Place an order for a pet * @@ -155,7 +212,7 @@ public class StoreApi { * @return Order * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono placeOrder(Order body) throws WebClientResponseException { + private ResponseSpec placeOrderRequestCreation(Order body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -181,4 +238,23 @@ public class StoreApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/store/order", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Place an order for a pet + * + *

200 - successful operation + *

400 - Invalid Order + * @param body order placed for purchasing the pet + * @return Order + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono placeOrder(Order body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return placeOrderRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> placeOrderWithHttpInfo(Order body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return placeOrderRequestCreation(body).toEntity(localVarReturnType); + } } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java index 62188c93a1c..38eb9e61c3b 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/UserApi.java @@ -15,12 +15,14 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; +import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @@ -52,7 +54,7 @@ public class UserApi { * @param body Created user object * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono createUser(User body) throws WebClientResponseException { + private ResponseSpec createUserRequestCreation(User body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -76,6 +78,23 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Create user + * This can only be done by the logged in user. + *

0 - successful operation + * @param body Created user object + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono createUser(User body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createUserRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> createUserWithHttpInfo(User body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createUserRequestCreation(body).toEntity(localVarReturnType); + } /** * Creates list of users with given input array * @@ -83,7 +102,7 @@ public class UserApi { * @param body List of user object * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono createUsersWithArrayInput(List body) throws WebClientResponseException { + private ResponseSpec createUsersWithArrayInputRequestCreation(List body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -107,6 +126,7 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/createWithArray", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + /** * Creates list of users with given input array * @@ -114,7 +134,23 @@ public class UserApi { * @param body List of user object * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono createUsersWithListInput(List body) throws WebClientResponseException { + public Mono createUsersWithArrayInput(List body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createUsersWithArrayInputRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> createUsersWithArrayInputWithHttpInfo(List body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createUsersWithArrayInputRequestCreation(body).toEntity(localVarReturnType); + } + /** + * Creates list of users with given input array + * + *

0 - successful operation + * @param body List of user object + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec createUsersWithListInputRequestCreation(List body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { @@ -138,6 +174,23 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/createWithList", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Creates list of users with given input array + * + *

0 - successful operation + * @param body List of user object + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono createUsersWithListInput(List body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createUsersWithListInputRequestCreation(body).bodyToMono(localVarReturnType); + } + + public Mono> createUsersWithListInputWithHttpInfo(List body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return createUsersWithListInputRequestCreation(body).toEntity(localVarReturnType); + } /** * Delete user * This can only be done by the logged in user. @@ -146,7 +199,7 @@ public class UserApi { * @param username The name that needs to be deleted * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono deleteUser(String username) throws WebClientResponseException { + private ResponseSpec deleteUserRequestCreation(String username) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'username' is set if (username == null) { @@ -172,6 +225,24 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/{username}", HttpMethod.DELETE, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Delete user + * This can only be done by the logged in user. + *

400 - Invalid username supplied + *

404 - User not found + * @param username The name that needs to be deleted + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono deleteUser(String username) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return deleteUserRequestCreation(username).bodyToMono(localVarReturnType); + } + + public Mono> deleteUserWithHttpInfo(String username) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return deleteUserRequestCreation(username).toEntity(localVarReturnType); + } /** * Get user by user name * @@ -182,7 +253,7 @@ public class UserApi { * @return User * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono getUserByName(String username) throws WebClientResponseException { + private ResponseSpec getUserByNameRequestCreation(String username) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'username' is set if (username == null) { @@ -210,6 +281,26 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/{username}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Get user by user name + * + *

200 - successful operation + *

400 - Invalid username supplied + *

404 - User not found + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono getUserByName(String username) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return getUserByNameRequestCreation(username).bodyToMono(localVarReturnType); + } + + public Mono> getUserByNameWithHttpInfo(String username) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return getUserByNameRequestCreation(username).toEntity(localVarReturnType); + } /** * Logs user into the system * @@ -220,7 +311,7 @@ public class UserApi { * @return String * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono loginUser(String username, String password) throws WebClientResponseException { + private ResponseSpec loginUserRequestCreation(String username, String password) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'username' is set if (username == null) { @@ -253,13 +344,33 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/login", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Logs user into the system + * + *

200 - successful operation + *

400 - Invalid username/password supplied + * @param username The user name for login + * @param password The password for login in clear text + * @return String + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono loginUser(String username, String password) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return loginUserRequestCreation(username, password).bodyToMono(localVarReturnType); + } + + public Mono> loginUserWithHttpInfo(String username, String password) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return loginUserRequestCreation(username, password).toEntity(localVarReturnType); + } /** * Logs out current logged in user session * *

0 - successful operation * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono logoutUser() throws WebClientResponseException { + private ResponseSpec logoutUserRequestCreation() throws WebClientResponseException { Object postBody = null; // create path and map variables final Map pathParams = new HashMap(); @@ -279,6 +390,22 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/logout", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Logs out current logged in user session + * + *

0 - successful operation + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono logoutUser() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return logoutUserRequestCreation().bodyToMono(localVarReturnType); + } + + public Mono> logoutUserWithHttpInfo() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return logoutUserRequestCreation().toEntity(localVarReturnType); + } /** * Updated user * This can only be done by the logged in user. @@ -288,7 +415,7 @@ public class UserApi { * @param body Updated user object * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono updateUser(String username, User body) throws WebClientResponseException { + private ResponseSpec updateUserRequestCreation(String username, User body) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'username' is set if (username == null) { @@ -318,4 +445,23 @@ public class UserApi { ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/user/{username}", HttpMethod.PUT, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } + + /** + * Updated user + * This can only be done by the logged in user. + *

400 - Invalid user supplied + *

404 - User not found + * @param username name that need to be deleted + * @param body Updated user object + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono updateUser(String username, User body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return updateUserRequestCreation(username, body).bodyToMono(localVarReturnType); + } + + public Mono> updateUserWithHttpInfo(String username, User body) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return updateUserRequestCreation(username, body).toEntity(localVarReturnType); + } }