[Java-client] Add Spring 5 WebClient as new library (#435)

This commit is contained in:
Daonomic 2018-07-04 10:40:57 +03:00 committed by Jérémie Bresson
parent d6e950f681
commit b90c53deb6
126 changed files with 12210 additions and 0 deletions

View File

@ -851,6 +851,7 @@
<module>samples/client/petstore/jaxrs-cxf-client</module>
<module>samples/client/petstore/java/resttemplate</module>
<module>samples/client/petstore/java/resttemplate-withXml</module>
<module>samples/client/petstore/java/webclient</module>
<module>samples/client/petstore/java/vertx</module>
<module>samples/client/petstore/java/resteasy</module>
<module>samples/client/petstore/java/google-api-client</module>

View File

@ -467,6 +467,7 @@ Here is a list of template creators:
* Java (Jersey2): @xhh
* Java (okhttp-gson): @xhh
* Java (RestTemplate): @nbruno
* Java (Spring 5 WebClient): @daonomic
* Java (RESTEasy): @gayathrigs
* Java (Vertx): @lopesmcc
* Java (Google APIs Client Library): @charlescapps

View File

@ -16,6 +16,7 @@
./bin/java-petstore-jersey2-java6.sh
./bin/java-petstore-resttemplate.sh
./bin/java-petstore-resttemplate-withxml.sh
./bin/java-petstore-webclient.sh
./bin/java-petstore-resteasy.sh
./bin/java-petstore-google-api-client.sh
./bin/java-petstore-rest-assured.sh

View File

@ -0,0 +1,4 @@
{
"library": "webclient",
"artifactId": "petstore-webclient"
}

45
bin/java-petstore-webclient.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-webclient.json -o samples/client/petstore/java/webclient -DhideGenerationTimestamp=true $@"
echo "Removing files and folders under samples/client/petstore/java/webclient/src/main"
rm -rf samples/client/petstore/java/webclient/src/main
find samples/client/petstore/java/webclient -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags
# copy additional manually written unit-tests
mkdir samples/client/petstore/java/webclient/src/test/java/org/openapitools/client
mkdir samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/auth
mkdir samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model
cp CI/samples.ci/client/petstore/java/test-manual/webclient/ApiClientTest.java samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/ApiClientTest.java
cp CI/samples.ci/client/petstore/java/test-manual/webclient/auth/ApiKeyAuthTest.java samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/auth/ApiKeyAuthTest.java
cp CI/samples.ci/client/petstore/java/test-manual/webclient/auth/HttpBasicAuthTest.java samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/auth/HttpBasicAuthTest.java
cp CI/samples.ci/client/petstore/java/test-manual/webclient/model/EnumValueTest.java samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/EnumValueTest.java

View File

@ -75,6 +75,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
public static final String OKHTTP_GSON = "okhttp-gson";
public static final String RESTEASY = "resteasy";
public static final String RESTTEMPLATE = "resttemplate";
public static final String WEBCLIENT = "webclient";
public static final String REST_ASSURED = "rest-assured";
public static final String RETROFIT_1 = "retrofit";
public static final String RETROFIT_2 = "retrofit2";
@ -120,6 +121,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.");
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.8.0. JSON processing: Gson 2.6.1 (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)");
supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.8.9");
supportedLibraries.put(WEBCLIENT, "HTTP client: Spring WebClient 5.0.7-RELEASE. JSON processing: Jackson 2.9.5");
supportedLibraries.put(RESTEASY, "HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.8.9");
supportedLibraries.put(VERTX, "HTTP client: VertX client 3.2.4. JSON processing: Jackson 2.8.9");
supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.23.0. JSON processing: Jackson 2.8.9");
@ -151,6 +153,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
@Override
public void processOpts() {
if (WEBCLIENT.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) {
dateLibrary = "java8";
}
super.processOpts();
if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA2)) {
@ -280,6 +286,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen
} else if (RESTTEMPLATE.equals(getLibrary())) {
additionalProperties.put("jackson", "true");
supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java"));
} else if (WEBCLIENT.equals(getLibrary())) {
additionalProperties.put("jackson", "true");
} else if (VERTX.equals(getLibrary())) {
typeMapping.put("file", "AsyncFile");
importMapping.put("AsyncFile", "io.vertx.core.file.AsyncFile");

View File

@ -0,0 +1,640 @@
package {{invokerPackage}};
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.RequestEntity.BodyBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
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.ClientResponse;
import org.springframework.web.reactive.function.BodyInserter;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone;
import {{invokerPackage}}.auth.Authentication;
import {{invokerPackage}}.auth.HttpBasicAuth;
import {{invokerPackage}}.auth.ApiKeyAuth;
import {{invokerPackage}}.auth.OAuth;
{{>generatedAnnotation}}
public class ApiClient {
public enum CollectionFormat {
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
private final String separator;
private CollectionFormat(String separator) {
this.separator = separator;
}
private String collectionToString(Collection<? extends CharSequence> collection) {
return StringUtils.collectionToDelimitedString(collection, separator);
}
}
private HttpHeaders defaultHeaders = new HttpHeaders();
private String basePath = "{{basePath}}";
private final WebClient webClient;
private final DateFormat dateFormat;
private Map<String, Authentication> authentications;
public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.webClient = buildWebClient(new ObjectMapper(), this.dateFormat);
}
public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildWebClient(mapper.copy(), format), format);
}
private ApiClient(WebClient webClient, DateFormat format) {
this.webClient = webClient;
this.dateFormat = format;
}
public DateFormat createDefaultDateFormat() {
DateFormat dateFormat = new RFC3339DateFormat();
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return dateFormat;
}
protected void init() {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}}
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}
/**
* Build the RestTemplate used to make HTTP requests.
* @return RestTemplate
*/
public static WebClient buildWebClient(ObjectMapper mapper, DateFormat dateFormat) {
mapper.setDateFormat(dateFormat);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ExchangeStrategies strategies = ExchangeStrategies
.builder()
.codecs(clientDefaultCodecsConfigurer -> {
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper, MediaType.APPLICATION_JSON));
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper, MediaType.APPLICATION_JSON));
}).build();
WebClient.Builder webClient = WebClient.builder().exchangeStrategies(strategies);
return webClient.build();
}
/**
* Get the current base path
* @return String the base path
*/
public String getBasePath() {
return basePath;
}
/**
* Set the base path, which should include the host
* @param basePath the base path
* @return ApiClient this client
*/
public ApiClient setBasePath(String basePath) {
this.basePath = basePath;
return this;
}
/**
* Get authentications (key: authentication name, value: authentication).
* @return Map the currently configured authentication types
*/
public Map<String, Authentication> getAuthentications() {
return authentications;
}
/**
* Get authentication for the given name.
*
* @param authName The authentication name
* @return The authentication, null if not found
*/
public Authentication getAuthentication(String authName) {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
* @param username the username
*/
public void setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setUsername(username);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
* Helper method to set password for the first HTTP basic authentication.
* @param password the password
*/
public void setPassword(String password) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
* Helper method to set API key value for the first API key authentication.
* @param apiKey the API key
*/
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKey(apiKey);
return;
}
}
throw new RuntimeException("No API key authentication configured!");
}
/**
* Helper method to set API key prefix for the first API key authentication.
* @param apiKeyPrefix the API key prefix
*/
public void setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
return;
}
}
throw new RuntimeException("No API key authentication configured!");
}
/**
* Helper method to set access token for the first OAuth2 authentication.
* @param accessToken the access token
*/
public void setAccessToken(String accessToken) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken);
return;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
}
/**
* Set the User-Agent header's value (by adding to the default header map).
* @param userAgent the user agent string
* @return ApiClient this client
*/
public ApiClient setUserAgent(String userAgent) {
addDefaultHeader("User-Agent", userAgent);
return this;
}
/**
* Add a default header.
*
* @param name The header's name
* @param value The header's value
* @return ApiClient this client
*/
public ApiClient addDefaultHeader(String name, String value) {
if (defaultHeaders.containsKey(name)) {
defaultHeaders.remove(name);
}
defaultHeaders.add(name, value);
return this;
}
/**
* Get the date format used to parse/format date parameters.
* @return DateFormat format
*/
public DateFormat getDateFormat() {
return dateFormat;
}
/**
* Parse the given string into Date object.
*/
public Date parseDate(String str) {
try {
return dateFormat.parse(str);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* Format the given Date object into string.
*/
public String formatDate(Date date) {
return dateFormat.format(date);
}
/**
* Format the given parameter object into string.
* @param param the object to convert
* @return String the parameter represented as a String
*/
public String parameterToString(Object param) {
if (param == null) {
return "";
} else if (param instanceof Date) {
return formatDate( (Date) param);
} else if (param instanceof Collection) {
StringBuilder b = new StringBuilder();
for(Object o : (Collection<?>) param) {
if(b.length() > 0) {
b.append(",");
}
b.append(String.valueOf(o));
}
return b.toString();
} else {
return String.valueOf(param);
}
}
/**
* Converts a parameter to a {@link MultiValueMap} for use in REST requests
* @param collectionFormat The format to convert to
* @param name The name of the parameter
* @param value The parameter's value
* @return a Map containing the String value(s) of the input parameter
*/
public MultiValueMap<String, String> parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) {
final MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
if (name == null || name.isEmpty() || value == null) {
return params;
}
if(collectionFormat == null) {
collectionFormat = CollectionFormat.CSV;
}
Collection<?> valueCollection = null;
if (value instanceof Collection) {
valueCollection = (Collection<?>) value;
} else {
params.add(name, parameterToString(value));
return params;
}
if (valueCollection.isEmpty()){
return params;
}
if (collectionFormat.equals(CollectionFormat.MULTI)) {
for (Object item : valueCollection) {
params.add(name, parameterToString(item));
}
return params;
}
List<String> values = new ArrayList<String>();
for(Object o : valueCollection) {
values.add(parameterToString(o));
}
params.add(name, collectionFormat.collectionToString(values));
return params;
}
/**
* Check if the given {@code String} is a JSON MIME.
* @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise
*/
public boolean isJsonMime(String mediaType) {
// "* / *" is default to JSON
if ("*/*".equals(mediaType)) {
return true;
}
try {
return isJsonMime(MediaType.parseMediaType(mediaType));
} catch (InvalidMediaTypeException e) {
}
return false;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise
*/
public boolean isJsonMime(MediaType mediaType) {
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$"));
}
/**
* Select the Accept header's value from the given accepts array:
* if JSON exists in the given array, use it;
* otherwise use all of them (joining into a string)
*
* @param accepts The accepts array to select from
* @return List The list of MediaTypes to use for the Accept header
*/
public List<MediaType> selectHeaderAccept(String[] accepts) {
if (accepts.length == 0) {
return null;
}
for (String accept : accepts) {
MediaType mediaType = MediaType.parseMediaType(accept);
if (isJsonMime(mediaType)) {
return Collections.singletonList(mediaType);
}
}
return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts));
}
/**
* Select the Content-Type header's value from the given array:
* if JSON exists in the given array, use it;
* otherwise use the first one of the array.
*
* @param contentTypes The Content-Type array to select from
* @return MediaType The Content-Type header to use. If the given array is empty, JSON will be used.
*/
public MediaType selectHeaderContentType(String[] contentTypes) {
if (contentTypes.length == 0) {
return MediaType.APPLICATION_JSON;
}
for (String contentType : contentTypes) {
MediaType mediaType = MediaType.parseMediaType(contentType);
if (isJsonMime(mediaType)) {
return mediaType;
}
}
return MediaType.parseMediaType(contentTypes[0]);
}
/**
* Select the body to use for the request
* @param obj the body object
* @param formParams the form parameters
* @param contentType the content type of the request
* @return Object the selected body
*/
protected BodyInserter<?, ? super ClientHttpRequest> selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) {
boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType);
return isForm ? BodyInserters.fromMultipartData(formParams) : (obj != null ? BodyInserters.fromObject(obj) : null);
}
/**
* Invoke API by sending HTTP request with the given options.
*
* @param <T> the return type to use
* @param path The sub-path of the HTTP URL
* @param method The request method
* @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 <T> Mono<T> invokeAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
return requestBuilder.exchange()
.flatMap(response -> {
HttpStatus statusCode = response.statusCode();
if (response.statusCode() == HttpStatus.NO_CONTENT) {
return Mono.empty();
} else if (statusCode.is2xxSuccessful()) {
if (returnType == null) {
return Mono.empty();
} else {
return response.bodyToMono(returnType);
}
} else {
return Mono.error(new RestClientException("API returned " + statusCode + " and it wasn't handled by the RestTemplate error handler"));
}
});
}
/**
* Invoke API by sending HTTP request with the given options.
*
* @param <T> the return type to use
* @param path The sub-path of the HTTP URL
* @param method The request method
* @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 <T> Flux<T> invokeFluxAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
return requestBuilder.exchange()
.flatMapMany(response -> {
HttpStatus statusCode = response.statusCode();
ClientResponse.Headers headers = response.headers();
if (response.statusCode() == HttpStatus.NO_CONTENT) {
return Flux.empty();
} else if (statusCode.is2xxSuccessful()) {
if (returnType == null) {
return Flux.empty();
} else {
return response.bodyToFlux(returnType);
}
} else {
return Flux.error(new RestClientException("API returned " + statusCode + " and it wasn't handled by the RestTemplate error handler"));
}
});
}
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames) {
updateParamsForAuth(authNames, queryParams, headerParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
if (queryParams != null) {
//encode the query parameters in case they contain unsafe characters
for (List<String> values : queryParams.values()) {
if (values != null) {
for (int i = 0; i < values.size(); i++) {
try {
values.set(i, URLEncoder.encode(values.get(i), "utf8"));
} catch (UnsupportedEncodingException e) {
}
}
}
}
builder.queryParams(queryParams);
}
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build().toUri());
if(accept != null) {
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
}
if(contentType != null) {
requestBuilder.contentType(contentType);
}
addHeadersToRequest(headerParams, requestBuilder);
addHeadersToRequest(defaultHeaders, requestBuilder);
requestBuilder.body(selectBody(body, formParams, contentType));
return requestBuilder;
}
/**
* Add headers to the request that is being built
* @param headers The headers to add
* @param requestBuilder The current request
*/
protected void addHeadersToRequest(HttpHeaders headers, WebClient.RequestBodySpec requestBuilder) {
for (Entry<String, List<String>> entry : headers.entrySet()) {
List<String> values = entry.getValue();
for(String value : values) {
if (value != null) {
requestBuilder.header(entry.getKey(), value);
}
}
}
}
/**
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
* @param queryParams The query parameters
* @param headerParams The header parameters
*/
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
if (auth == null) {
throw new RestClientException("Authentication undefined: " + authName);
}
auth.applyToParams(queryParams, headerParams);
}
}
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
logRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
logResponse(response);
return response;
}
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
log.info("URI: " + request.getURI());
log.info("HTTP Method: " + request.getMethod());
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
}
private void logResponse(ClientHttpResponse response) throws IOException {
log.info("HTTP Status Code: " + response.getRawStatusCode());
log.info("Status Text: " + response.getStatusText());
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
log.info("Response Body: " + bodyToString(response.getBody()));
}
private String headersToString(HttpHeaders headers) {
StringBuilder builder = new StringBuilder();
for(Entry<String, List<String>> entry : headers.entrySet()) {
builder.append(entry.getKey()).append("=[");
for(String value : entry.getValue()) {
builder.append(value).append(",");
}
builder.setLength(builder.length() - 1); // Get rid of trailing comma
builder.append("],");
}
builder.setLength(builder.length() - 1); // Get rid of trailing comma
return builder.toString();
}
private String bodyToString(InputStream body) throws IOException {
StringBuilder builder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
String line = bufferedReader.readLine();
while (line != null) {
builder.append(line).append(System.lineSeparator());
line = bufferedReader.readLine();
}
bufferedReader.close();
return builder.toString();
}
}
}

View File

@ -0,0 +1,107 @@
package {{package}};
import {{invokerPackage}}.ApiClient;
{{#imports}}import {{import}};
{{/imports}}
{{^fullJavaUtil}}import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;{{/fullJavaUtil}}
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
{{>generatedAnnotation}}
{{#operations}}
public class {{classname}} {
private ApiClient {{localVariablePrefix}}apiClient;
public {{classname}}() {
this(new ApiClient());
}
@Autowired
public {{classname}}(ApiClient apiClient) {
this.{{localVariablePrefix}}apiClient = apiClient;
}
public ApiClient getApiClient() {
return {{localVariablePrefix}}apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.{{localVariablePrefix}}apiClient = apiClient;
}
{{#operation}}
/**
* {{summary}}
* {{notes}}
{{#responses}} * <p><b>{{code}}</b>{{#message}} - {{message}}{{/message}}
{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}}
{{/allParams}}{{#returnType}} * @return {{returnType}}
{{/returnType}} * @throws RestClientException if an error occurs while attempting to invoke the API
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
public {{#returnType}}{{#isListContainer}}Flux<{{{returnBaseType}}}>{{/isListContainer}}{{^isListContainer}}Mono<{{{returnType}}}>{{/isListContainer}} {{/returnType}}{{^returnType}}Mono<Void> {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws RestClientException {
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter '{{paramName}}' when calling {{operationId}}");
}
{{/required}}{{/allParams}}{{#hasPathParams}}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();{{#pathParams}}
uriVariables.put("{{baseName}}", {{{paramName}}});{{/pathParams}}{{/hasPathParams}}
String {{localVariablePrefix}}path = UriComponentsBuilder.fromPath("{{{path}}}"){{#hasPathParams}}.buildAndExpand(uriVariables){{/hasPathParams}}{{^hasPathParams}}.build(){{/hasPathParams}}.toUriString();
final MultiValueMap<String, String> {{localVariablePrefix}}queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders {{localVariablePrefix}}headerParams = new HttpHeaders();
final MultiValueMap<String, Object> {{localVariablePrefix}}formParams = new LinkedMultiValueMap<String, Object>();{{#hasQueryParams}}
{{#queryParams}}{{localVariablePrefix}}queryParams.putAll({{localVariablePrefix}}apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{collectionFormat}}}".toUpperCase()){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));{{#hasMore}}
{{/hasMore}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}}
{{#headerParams}}if ({{paramName}} != null)
{{localVariablePrefix}}headerParams.add("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}}));{{#hasMore}}
{{/hasMore}}{{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}}
{{#formParams}}if ({{paramName}} != null)
{{localVariablePrefix}}formParams.add("{{baseName}}", {{#isFile}}new FileSystemResource({{paramName}}){{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});{{#hasMore}}
{{/hasMore}}{{/formParams}}{{/hasFormParams}}
final String[] {{localVariablePrefix}}accepts = { {{#hasProduces}}
{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
{{/hasProduces}}};
final List<MediaType> {{localVariablePrefix}}accept = {{localVariablePrefix}}apiClient.selectHeaderAccept({{localVariablePrefix}}accepts);
final String[] {{localVariablePrefix}}contentTypes = { {{#hasConsumes}}
{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
{{/hasConsumes}}};
final MediaType {{localVariablePrefix}}contentType = {{localVariablePrefix}}apiClient.selectHeaderContentType({{localVariablePrefix}}contentTypes);
String[] {{localVariablePrefix}}authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
{{#returnType}}ParameterizedTypeReference<{{#isListContainer}}{{{returnBaseType}}}{{/isListContainer}}{{^isListContainer}}{{{returnType}}}{{/isListContainer}}> {{localVariablePrefix}}returnType = new ParameterizedTypeReference<{{#isListContainer}}{{{returnBaseType}}}{{/isListContainer}}{{^isListContainer}}{{{returnType}}}{{/isListContainer}}>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> {{localVariablePrefix}}returnType = new ParameterizedTypeReference<Void>() {};{{/returnType}}
return {{localVariablePrefix}}apiClient.{{#isListContainer}}invokeFluxAPI{{/isListContainer}}{{^isListContainer}}invokeAPI{{/isListContainer}}({{localVariablePrefix}}path, HttpMethod.{{httpMethod}}, {{localVariablePrefix}}queryParams, {{localVariablePrefix}}postBody, {{localVariablePrefix}}headerParams, {{localVariablePrefix}}formParams, {{localVariablePrefix}}accept, {{localVariablePrefix}}contentType, {{localVariablePrefix}}authNames, {{localVariablePrefix}}returnType);
}
{{/operation}}
}
{{/operations}}

View File

@ -0,0 +1,45 @@
{{>licenseInfo}}
package {{package}};
import {{invokerPackage}}.ApiException;
{{#imports}}import {{import}};
{{/imports}}
import org.junit.Test;
import org.junit.Ignore;
{{^fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{/fullJavaUtil}}
/**
* API tests for {{classname}}
*/
@Ignore
public class {{classname}}Test {
private final {{classname}} api = new {{classname}}();
{{#operations}}{{#operation}}
/**
* {{summary}}
*
* {{notes}}
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void {{operationId}}Test() throws ApiException {
{{#allParams}}
{{{dataType}}} {{paramName}} = null;
{{/allParams}}
{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#isListContainer}}.collectList().block(){{/isListContainer}}{{^isListContainer}}.block(){{/isListContainer}};
// TODO: test validations
}
{{/operation}}{{/operations}}
}

View File

@ -0,0 +1,60 @@
package {{invokerPackage}}.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
private String apiKey;
private String apiKeyPrefix;
public ApiKeyAuth(String location, String paramName) {
this.location = location;
this.paramName = paramName;
}
public String getLocation() {
return location;
}
public String getParamName() {
return paramName;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiKeyPrefix() {
return apiKeyPrefix;
}
public void setApiKeyPrefix(String apiKeyPrefix) {
this.apiKeyPrefix = apiKeyPrefix;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
if (apiKey == null) {
return;
}
String value;
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;
} else {
value = apiKey;
}
if (location.equals("query")) {
queryParams.add(paramName, value);
} else if (location.equals("header")) {
headerParams.add(paramName, value);
}
}
}

View File

@ -0,0 +1,13 @@
package {{invokerPackage}}.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
public interface Authentication {
/**
* Apply authentication settings to header and / or query parameters.
* @param queryParams The query parameters for the request
* @param headerParams The header parameters for the request
*/
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams);
}

View File

@ -0,0 +1,39 @@
package {{invokerPackage}}.auth;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.springframework.http.HttpHeaders;
import org.springframework.util.Base64Utils;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}
public class HttpBasicAuth implements Authentication {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
if (username == null && password == null) {
return;
}
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8)));
}
}

View File

@ -0,0 +1,24 @@
package {{invokerPackage}}.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}
public class OAuth implements Authentication {
private String accessToken;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
if (accessToken != null) {
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
}
}
}

View File

@ -0,0 +1,5 @@
package {{invokerPackage}}.auth;
public enum OAuthFlow {
accessCode, implicit, password, application
}

View File

@ -0,0 +1,135 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<packaging>jar</packaging>
<name>{{artifactId}}</name>
<version>{{artifactVersion}}</version>
<url>{{artifactUrl}}</url>
<description>{{artifactDescription}}</description>
<scm>
<connection>{{scmConnection}}</connection>
<developerConnection>{{scmDeveloperConnection}}</developerConnection>
<url>{{scmUrl}}</url>
</scm>
<licenses>
<license>
<name>{{licenseName}}</name>
<url>{{licenseUrl}}</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>{{developerName}}</name>
<email>{{developerEmail}}</email>
<organization>{{developerOrganization}}</organization>
<organizationUrl>{{developerOrganizationUrl}}</organizationUrl>
</developer>
</developers>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor-version}</version>
</dependency>
<!-- HTTP client: Spring RestTemplate -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<version>${spring-web-version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.ipc</groupId>
<artifactId>reactor-netty</artifactId>
<version>${reactor-netty-version}</version>
</dependency>
<!-- JSON processing: jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
{{#java8}}
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
{{/java8}}
{{#joda}}
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${jodatime-version}</version>
</dependency>
{{/joda}}
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.20</swagger-annotations-version>
<spring-web-version>5.0.7.RELEASE</spring-web-version>
<jackson-version>2.9.5</jackson-version>
<junit-version>4.12</junit-version>
<reactor-version>3.1.8.RELEASE</reactor-version>
<reactor-netty-version>0.7.8.RELEASE</reactor-netty-version>
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>
{{/joda}}
</properties>
</project>

View File

@ -0,0 +1,21 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# exclude jar for gradle wrapper
!gradle/wrapper/*.jar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# build files
**/target
target
.gradle
build

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1 @@
3.1.0-SNAPSHOT

View File

@ -0,0 +1,17 @@
#
# Generated by: https://openapi-generator.tech
#
language: java
jdk:
- oraclejdk8
- oraclejdk7
before_install:
# ensure gradlew has proper permission
- chmod a+x ./gradlew
script:
# test using maven
- mvn test
# uncomment below to test using gradle
# - gradle test
# uncomment below to test using sbt
# - sbt test

View File

@ -0,0 +1,214 @@
# petstore-webclient
OpenAPI Petstore
- API version: 1.0.0
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
## Requirements
Building the API client library requires:
1. Java 1.7+
2. Maven/Gradle
## Installation
To install the API client library to your local Maven repository, simply execute:
```shell
mvn clean install
```
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
```shell
mvn clean deploy
```
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>petstore-webclient</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```
### Gradle users
Add this dependency to your project's build file:
```groovy
compile "org.openapitools:petstore-webclient:1.0.0"
```
### Others
At first generate the JAR by executing:
```shell
mvn clean package
```
Then manually install the following JARs:
* `target/petstore-webclient-1.0.0.jar`
* `target/lib/*.jar`
## Getting Started
Please follow the [installation](#installation) instruction and execute the following Java code:
```java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.AnotherFakeApi;
import java.io.File;
import java.util.*;
public class AnotherFakeApiExample {
public static void main(String[] args) {
AnotherFakeApi apiInstance = new AnotherFakeApi();
Client client = new Client(); // Client | client model
try {
Client result = apiInstance.testSpecialTags(client);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
e.printStackTrace();
}
}
}
```
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**testSpecialTags**](docs/AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
## Documentation for Models
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Animal](docs/Animal.md)
- [AnimalFarm](docs/AnimalFarm.md)
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [ArrayTest](docs/ArrayTest.md)
- [Capitalization](docs/Capitalization.md)
- [Cat](docs/Cat.md)
- [Category](docs/Category.md)
- [ClassModel](docs/ClassModel.md)
- [Client](docs/Client.md)
- [Dog](docs/Dog.md)
- [EnumArrays](docs/EnumArrays.md)
- [EnumClass](docs/EnumClass.md)
- [EnumTest](docs/EnumTest.md)
- [FormatTest](docs/FormatTest.md)
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [MapTest](docs/MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model200Response](docs/Model200Response.md)
- [ModelApiResponse](docs/ModelApiResponse.md)
- [ModelReturn](docs/ModelReturn.md)
- [Name](docs/Name.md)
- [NumberOnly](docs/NumberOnly.md)
- [Order](docs/Order.md)
- [OuterComposite](docs/OuterComposite.md)
- [OuterEnum](docs/OuterEnum.md)
- [Pet](docs/Pet.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [StringBooleanMap](docs/StringBooleanMap.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)
## Documentation for Authorization
Authentication schemes defined for the API:
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### api_key_query
- **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string
### http_basic_test
- **Type**: HTTP basic authentication
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets
## Recommendation
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
## Author

View File

@ -0,0 +1,129 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'org.openapitools'
version = '1.0.0'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
repositories {
jcenter()
}
if(hasProperty('target') && target == 'android') {
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 25
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Rename the aar correctly
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
dependencies {
provided 'javax.annotation:jsr250-api:1.0'
}
}
afterEvaluate {
android.libraryVariants.all { variant ->
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
task.description = "Create jar artifact for ${variant.name}"
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
artifacts.add('archives', task);
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
} else {
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
pom.artifactId = 'petstore-webclient'
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
ext {
swagger_annotations_version = "1.5.17"
jackson_version = "2.8.9"
jersey_version = "1.19.4"
jodatime_version = "2.9.9"
junit_version = "4.12"
}
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.sun.jersey:jersey-client:$jersey_version"
compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
testCompile "junit:junit:$junit_version"
}

View File

@ -0,0 +1,11 @@
# AdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapProperty** | **Map&lt;String, String&gt;** | | [optional]
**mapOfMapProperty** | [**Map&lt;String, Map&lt;String, String&gt;&gt;**](Map.md) | | [optional]

View File

@ -0,0 +1,11 @@
# Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**className** | **String** | |
**color** | **String** | | [optional]

View File

@ -0,0 +1,9 @@
# AnimalFarm
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

View File

@ -0,0 +1,54 @@
# AnotherFakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testSpecialTags**](AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
<a name="testSpecialTags"></a>
# **testSpecialTags**
> Client testSpecialTags(client)
To test special tags
To test special tags
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.AnotherFakeApi;
AnotherFakeApi apiInstance = new AnotherFakeApi();
Client client = new Client(); // Client | client model
try {
Client result = apiInstance.testSpecialTags(client);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json

View File

@ -0,0 +1,10 @@
# ArrayOfArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayArrayNumber** | [**List&lt;List&lt;BigDecimal&gt;&gt;**](List.md) | | [optional]

View File

@ -0,0 +1,10 @@
# ArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayNumber** | [**List&lt;BigDecimal&gt;**](BigDecimal.md) | | [optional]

View File

@ -0,0 +1,12 @@
# ArrayTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayOfString** | **List&lt;String&gt;** | | [optional]
**arrayArrayOfInteger** | [**List&lt;List&lt;Long&gt;&gt;**](List.md) | | [optional]
**arrayArrayOfModel** | [**List&lt;List&lt;ReadOnlyFirst&gt;&gt;**](List.md) | | [optional]

View File

@ -0,0 +1,15 @@
# Capitalization
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**smallCamel** | **String** | | [optional]
**capitalCamel** | **String** | | [optional]
**smallSnake** | **String** | | [optional]
**capitalSnake** | **String** | | [optional]
**scAETHFlowPoints** | **String** | | [optional]
**ATT_NAME** | **String** | Name of the pet | [optional]

View File

@ -0,0 +1,10 @@
# Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **Boolean** | | [optional]

View File

@ -0,0 +1,11 @@
# Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**name** | **String** | | [optional]

View File

@ -0,0 +1,10 @@
# ClassModel
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**propertyClass** | **String** | | [optional]

View File

@ -0,0 +1,10 @@
# Client
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client** | **String** | | [optional]

View File

@ -0,0 +1,10 @@
# Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **String** | | [optional]

View File

@ -0,0 +1,27 @@
# EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional]
**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) | | [optional]
<a name="JustSymbolEnum"></a>
## Enum: JustSymbolEnum
Name | Value
---- | -----
GREATER_THAN_OR_EQUAL_TO | &quot;&gt;&#x3D;&quot;
DOLLAR | &quot;$&quot;
<a name="List<ArrayEnumEnum>"></a>
## Enum: List&lt;ArrayEnumEnum&gt;
Name | Value
---- | -----
FISH | &quot;fish&quot;
CRAB | &quot;crab&quot;

View File

@ -0,0 +1,14 @@
# EnumClass
## Enum
* `_ABC` (value: `"_abc"`)
* `_EFG` (value: `"-efg"`)
* `_XYZ_` (value: `"(xyz)"`)

View File

@ -0,0 +1,48 @@
# EnumTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional]
**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | |
**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional]
**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional]
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
<a name="EnumStringEnum"></a>
## Enum: EnumStringEnum
Name | Value
---- | -----
UPPER | &quot;UPPER&quot;
LOWER | &quot;lower&quot;
EMPTY | &quot;&quot;
<a name="EnumStringRequiredEnum"></a>
## Enum: EnumStringRequiredEnum
Name | Value
---- | -----
UPPER | &quot;UPPER&quot;
LOWER | &quot;lower&quot;
EMPTY | &quot;&quot;
<a name="EnumIntegerEnum"></a>
## Enum: EnumIntegerEnum
Name | Value
---- | -----
NUMBER_1 | 1
NUMBER_MINUS_1 | -1
<a name="EnumNumberEnum"></a>
## Enum: EnumNumberEnum
Name | Value
---- | -----
NUMBER_1_DOT_1 | 1.1
NUMBER_MINUS_1_DOT_2 | -1.2

View File

@ -0,0 +1,510 @@
# FakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
# **fakeOuterBooleanSerialize**
> Boolean fakeOuterBooleanSerialize(body)
Test serialization of outer boolean types
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
Boolean body = true; // Boolean | Input boolean as post body
try {
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **Boolean**| Input boolean as post body | [optional]
### Return type
**Boolean**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
<a name="fakeOuterCompositeSerialize"></a>
# **fakeOuterCompositeSerialize**
> OuterComposite fakeOuterCompositeSerialize(outerComposite)
Test serialization of object with outer number type
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body
try {
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
### Return type
[**OuterComposite**](OuterComposite.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
<a name="fakeOuterNumberSerialize"></a>
# **fakeOuterNumberSerialize**
> BigDecimal fakeOuterNumberSerialize(body)
Test serialization of outer number types
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
try {
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **BigDecimal**| Input number as post body | [optional]
### Return type
[**BigDecimal**](BigDecimal.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
<a name="fakeOuterStringSerialize"></a>
# **fakeOuterStringSerialize**
> String fakeOuterStringSerialize(body)
Test serialization of outer string types
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String body = "body_example"; // String | Input string as post body
try {
String result = apiInstance.fakeOuterStringSerialize(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **String**| Input string as post body | [optional]
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
<a name="testBodyWithQueryParams"></a>
# **testBodyWithQueryParams**
> testBodyWithQueryParams(query, user)
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String query = "query_example"; // String |
User user = new User(); // User |
try {
apiInstance.testBodyWithQueryParams(query, user);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithQueryParams");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**query** | **String**| |
**user** | [**User**](User.md)| |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
<a name="testClientModel"></a>
# **testClientModel**
> Client testClientModel(client)
To test \&quot;client\&quot; model
To test \&quot;client\&quot; model
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
Client client = new Client(); // Client | client model
try {
Client result = apiInstance.testClientModel(client);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testClientModel");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
<a name="testEndpointParameters"></a>
# **testEndpointParameters**
> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.FakeApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: http_basic_test
HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test");
http_basic_test.setUsername("YOUR USERNAME");
http_basic_test.setPassword("YOUR PASSWORD");
FakeApi apiInstance = new FakeApi();
BigDecimal number = new BigDecimal(); // BigDecimal | None
Double _double = 3.4D; // Double | None
String patternWithoutDelimiter = "null"; // String | None
byte[] _byte = null; // byte[] | None
Integer integer = null; // Integer | None
Integer int32 = null; // Integer | None
Long int64 = nullL; // Long | None
Float _float = nullF; // Float | None
String string = "null"; // String | None
File binary = new File("null"); // File | None
LocalDate date = new LocalDate(); // LocalDate | None
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
String password = "null"; // String | None
String paramCallback = "null"; // String | None
try {
apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEndpointParameters");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**number** | **BigDecimal**| None | [default to null]
**_double** | **Double**| None | [default to null]
**patternWithoutDelimiter** | **String**| None | [default to null]
**_byte** | **byte[]**| None | [default to null]
**integer** | **Integer**| None | [optional] [default to null]
**int32** | **Integer**| None | [optional] [default to null]
**int64** | **Long**| None | [optional] [default to null]
**_float** | **Float**| None | [optional] [default to null]
**string** | **String**| None | [optional] [default to null]
**binary** | **File**| None | [optional] [default to null]
**date** | **LocalDate**| None | [optional] [default to null]
**dateTime** | **OffsetDateTime**| None | [optional] [default to null]
**password** | **String**| None | [optional] [default to null]
**paramCallback** | **String**| None | [optional] [default to null]
### Return type
null (empty response body)
### Authorization
[http_basic_test](../README.md#http_basic_test)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
<a name="testEnumParameters"></a>
# **testEnumParameters**
> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
To test enum parameters
To test enum parameters
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
List<String> enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List<String> | Header parameter enum test (string array)
String enumHeaderString = "-efg"; // String | Header parameter enum test (string)
List<String> enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List<String> | Query parameter enum test (string array)
String enumQueryString = "-efg"; // String | Query parameter enum test (string)
Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double)
Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
List<String> enumFormStringArray = "$"; // List<String> | Form parameter enum test (string array)
String enumFormString = "-efg"; // String | Form parameter enum test (string)
try {
apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEnumParameters");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumHeaderStringArray** | [**List&lt;String&gt;**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $]
**enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
**enumQueryStringArray** | [**List&lt;String&gt;**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $]
**enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
**enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2]
**enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2]
**enumFormStringArray** | [**List&lt;String&gt;**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $]
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
<a name="testInlineAdditionalProperties"></a>
# **testInlineAdditionalProperties**
> testInlineAdditionalProperties(requestBody)
test inline additionalProperties
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
Map<String, String> requestBody = new HashMap(); // Map<String, String> | request body
try {
apiInstance.testInlineAdditionalProperties(requestBody);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**requestBody** | [**Map&lt;String, String&gt;**](String.md)| request body |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "null"; // String | field1
String param2 = "null"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 | [default to null]
**param2** | **String**| field2 | [default to null]
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined

View File

@ -0,0 +1,64 @@
# FakeClassnameTags123Api
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
<a name="testClassname"></a>
# **testClassname**
> Client testClassname(client)
To test class name in snake case
To test class name in snake case
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.FakeClassnameTags123Api;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: api_key_query
ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query");
api_key_query.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key_query.setApiKeyPrefix("Token");
FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api();
Client client = new Client(); // Client | client model
try {
Client result = apiInstance.testClassname(client);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeClassnameTags123Api#testClassname");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
[api_key_query](../README.md#api_key_query)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json

View File

@ -0,0 +1,22 @@
# FormatTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**integer** | **Integer** | | [optional]
**int32** | **Integer** | | [optional]
**int64** | **Long** | | [optional]
**number** | [**BigDecimal**](BigDecimal.md) | |
**_float** | **Float** | | [optional]
**_double** | **Double** | | [optional]
**string** | **String** | | [optional]
**_byte** | **byte[]** | |
**binary** | [**File**](File.md) | | [optional]
**date** | [**LocalDate**](LocalDate.md) | |
**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional]
**uuid** | [**UUID**](UUID.md) | | [optional]
**password** | **String** | |

View File

@ -0,0 +1,11 @@
# HasOnlyReadOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **String** | | [optional]
**foo** | **String** | | [optional]

View File

@ -0,0 +1,21 @@
# MapTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapMapOfString** | [**Map&lt;String, Map&lt;String, String&gt;&gt;**](Map.md) | | [optional]
**mapOfEnumString** | [**Map&lt;String, InnerEnum&gt;**](#Map&lt;String, InnerEnum&gt;) | | [optional]
**directMap** | **Map&lt;String, Boolean&gt;** | | [optional]
**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
<a name="Map<String, InnerEnum>"></a>
## Enum: Map&lt;String, InnerEnum&gt;
Name | Value
---- | -----
UPPER | &quot;UPPER&quot;
LOWER | &quot;lower&quot;

View File

@ -0,0 +1,12 @@
# MixedPropertiesAndAdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**uuid** | [**UUID**](UUID.md) | | [optional]
**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional]
**map** | [**Map&lt;String, Animal&gt;**](Animal.md) | | [optional]

View File

@ -0,0 +1,11 @@
# Model200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **Integer** | | [optional]
**propertyClass** | **String** | | [optional]

View File

@ -0,0 +1,12 @@
# ModelApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **Integer** | | [optional]
**type** | **String** | | [optional]
**message** | **String** | | [optional]

View File

@ -0,0 +1,10 @@
# ModelReturn
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_return** | **Integer** | | [optional]

View File

@ -0,0 +1,13 @@
# Name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **Integer** | |
**snakeCase** | **Integer** | | [optional]
**property** | **String** | | [optional]
**_123number** | **Integer** | | [optional]

View File

@ -0,0 +1,10 @@
# NumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]

View File

@ -0,0 +1,24 @@
# Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**petId** | **Long** | | [optional]
**quantity** | **Integer** | | [optional]
**shipDate** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional]
**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional]
**complete** | **Boolean** | | [optional]
<a name="StatusEnum"></a>
## Enum: StatusEnum
Name | Value
---- | -----
PLACED | &quot;placed&quot;
APPROVED | &quot;approved&quot;
DELIVERED | &quot;delivered&quot;

View File

@ -0,0 +1,12 @@
# OuterComposite
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
**myString** | **String** | | [optional]
**myBoolean** | **Boolean** | | [optional]

View File

@ -0,0 +1,14 @@
# OuterEnum
## Enum
* `PLACED` (value: `"placed"`)
* `APPROVED` (value: `"approved"`)
* `DELIVERED` (value: `"delivered"`)

View File

@ -0,0 +1,24 @@
# Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**category** | [**Category**](Category.md) | | [optional]
**name** | **String** | |
**photoUrls** | **List&lt;String&gt;** | |
**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional]
**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional]
<a name="StatusEnum"></a>
## Enum: StatusEnum
Name | Value
---- | -----
AVAILABLE | &quot;available&quot;
PENDING | &quot;pending&quot;
SOLD | &quot;sold&quot;

View File

@ -0,0 +1,494 @@
# PetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
<a name="addPet"></a>
# **addPet**
> addPet(pet)
Add a new pet to the store
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
apiInstance.addPet(pet);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#addPet");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
null (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
<a name="deletePet"></a>
# **deletePet**
> deletePet(petId, apiKey)
Deletes a pet
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | Pet id to delete
String apiKey = "apiKey_example"; // String |
try {
apiInstance.deletePet(petId, apiKey);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#deletePet");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| Pet id to delete |
**apiKey** | **String**| | [optional]
### Return type
null (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="findPetsByStatus"></a>
# **findPetsByStatus**
> List&lt;Pet&gt; findPetsByStatus(status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
List<String> status = Arrays.asList("status_example"); // List<String> | Status values that need to be considered for filter
try {
List<Pet> result = apiInstance.findPetsByStatus(status);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#findPetsByStatus");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold]
### Return type
[**List&lt;Pet&gt;**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
<a name="findPetsByTags"></a>
# **findPetsByTags**
> List&lt;Pet&gt; findPetsByTags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
List<String> tags = Arrays.asList("tags_example"); // List<String> | Tags to filter by
try {
List<Pet> result = apiInstance.findPetsByTags(tags);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#findPetsByTags");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by |
### Return type
[**List&lt;Pet&gt;**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
<a name="getPetById"></a>
# **getPetById**
> Pet getPetById(petId)
Find pet by ID
Returns a single pet
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet to return
try {
Pet result = apiInstance.getPetById(petId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#getPetById");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet to return |
### Return type
[**Pet**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
<a name="updatePet"></a>
# **updatePet**
> updatePet(pet)
Update an existing pet
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
apiInstance.updatePet(pet);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#updatePet");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
null (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: Not defined
<a name="updatePetWithForm"></a>
# **updatePetWithForm**
> updatePetWithForm(petId, name, status)
Updates a pet in the store with form data
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet that needs to be updated
String name = "null"; // String | Updated name of the pet
String status = "null"; // String | Updated status of the pet
try {
apiInstance.updatePetWithForm(petId, name, status);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#updatePetWithForm");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet that needs to be updated |
**name** | **String**| Updated name of the pet | [optional] [default to null]
**status** | **String**| Updated status of the pet | [optional] [default to null]
### Return type
null (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: Not defined
<a name="uploadFile"></a>
# **uploadFile**
> ModelApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet to update
String additionalMetadata = "null"; // String | Additional data to pass to server
File file = new File("null"); // File | file to upload
try {
ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#uploadFile");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet to update |
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
**file** | **File**| file to upload | [optional] [default to null]
### Return type
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
<a name="uploadFileWithRequiredFile"></a>
# **uploadFileWithRequiredFile**
> ModelApiResponse uploadFileWithRequiredFile(petId, file, additionalMetadata)
uploads an image (required)
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.PetApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: petstore_auth
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Long petId = 56L; // Long | ID of pet to update
File file = new File("null"); // File | file to upload
String additionalMetadata = "null"; // String | Additional data to pass to server
try {
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, file, additionalMetadata);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **Long**| ID of pet to update |
**file** | **File**| file to upload | [default to null]
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
### Return type
[**ModelApiResponse**](ModelApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json

View File

@ -0,0 +1,11 @@
# ReadOnlyFirst
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **String** | | [optional]
**baz** | **String** | | [optional]

View File

@ -0,0 +1,10 @@
# SpecialModelName
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**$specialPropertyName** | **Long** | | [optional]

View File

@ -0,0 +1,195 @@
# StoreApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
<a name="deleteOrder"></a>
# **deleteOrder**
> deleteOrder(orderId)
Delete purchase order by ID
For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.StoreApi;
StoreApi apiInstance = new StoreApi();
String orderId = "orderId_example"; // String | ID of the order that needs to be deleted
try {
apiInstance.deleteOrder(orderId);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#deleteOrder");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of the order that needs to be deleted |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="getInventory"></a>
# **getInventory**
> Map&lt;String, Integer&gt; getInventory()
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```java
// Import classes:
//import org.openapitools.client.ApiClient;
//import org.openapitools.client.ApiException;
//import org.openapitools.client.Configuration;
//import org.openapitools.client.auth.*;
//import org.openapitools.client.api.StoreApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
StoreApi apiInstance = new StoreApi();
try {
Map<String, Integer> result = apiInstance.getInventory();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#getInventory");
e.printStackTrace();
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Map&lt;String, Integer&gt;**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
<a name="getOrderById"></a>
# **getOrderById**
> Order getOrderById(orderId)
Find purchase order by ID
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.StoreApi;
StoreApi apiInstance = new StoreApi();
Long orderId = 56L; // Long | ID of pet that needs to be fetched
try {
Order result = apiInstance.getOrderById(orderId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#getOrderById");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **Long**| ID of pet that needs to be fetched |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
<a name="placeOrder"></a>
# **placeOrder**
> Order placeOrder(order)
Place an order for a pet
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.StoreApi;
StoreApi apiInstance = new StoreApi();
Order order = new Order(); // Order | order placed for purchasing the pet
try {
Order result = apiInstance.placeOrder(order);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling StoreApi#placeOrder");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json

View File

@ -0,0 +1,9 @@
# StringBooleanMap
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

View File

@ -0,0 +1,11 @@
# Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**name** | **String** | | [optional]

View File

@ -0,0 +1,17 @@
# User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **Long** | | [optional]
**username** | **String** | | [optional]
**firstName** | **String** | | [optional]
**lastName** | **String** | | [optional]
**email** | **String** | | [optional]
**password** | **String** | | [optional]
**phone** | **String** | | [optional]
**userStatus** | **Integer** | User Status | [optional]

View File

@ -0,0 +1,360 @@
# UserApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
<a name="createUser"></a>
# **createUser**
> createUser(user)
Create user
This can only be done by the logged in user.
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
User user = new User(); // User | Created user object
try {
apiInstance.createUser(user);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#createUser");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md)| Created user object |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="createUsersWithArrayInput"></a>
# **createUsersWithArrayInput**
> createUsersWithArrayInput(user)
Creates list of users with given input array
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
List<User> user = Arrays.asList(new List()); // List<User> | List of user object
try {
apiInstance.createUsersWithArrayInput(user);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#createUsersWithArrayInput");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List&lt;User&gt;**](List.md)| List of user object |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="createUsersWithListInput"></a>
# **createUsersWithListInput**
> createUsersWithListInput(user)
Creates list of users with given input array
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
List<User> user = Arrays.asList(new List()); // List<User> | List of user object
try {
apiInstance.createUsersWithListInput(user);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#createUsersWithListInput");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user** | [**List&lt;User&gt;**](List.md)| List of user object |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="deleteUser"></a>
# **deleteUser**
> deleteUser(username)
Delete user
This can only be done by the logged in user.
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be deleted
try {
apiInstance.deleteUser(username);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#deleteUser");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be deleted |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="getUserByName"></a>
# **getUserByName**
> User getUserByName(username)
Get user by user name
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing.
try {
User result = apiInstance.getUserByName(username);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#getUserByName");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type
[**User**](User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
<a name="loginUser"></a>
# **loginUser**
> String loginUser(username, password)
Logs user into the system
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
String username = "username_example"; // String | The user name for login
String password = "password_example"; // String | The password for login in clear text
try {
String result = apiInstance.loginUser(username, password);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#loginUser");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text |
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
<a name="logoutUser"></a>
# **logoutUser**
> logoutUser()
Logs out current logged in user session
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
try {
apiInstance.logoutUser();
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#logoutUser");
e.printStackTrace();
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
<a name="updateUser"></a>
# **updateUser**
> updateUser(username, user)
Updated user
This can only be done by the logged in user.
### Example
```java
// Import classes:
//import org.openapitools.client.ApiException;
//import org.openapitools.client.api.UserApi;
UserApi apiInstance = new UserApi();
String username = "username_example"; // String | name that need to be deleted
User user = new User(); // User | Updated user object
try {
apiInstance.updateUser(username, user);
} catch (ApiException e) {
System.err.println("Exception when calling UserApi#updateUser");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted |
**user** | [**User**](User.md)| Updated user object |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,2 @@
# Uncomment to build for Android
#target = android

View File

@ -0,0 +1,6 @@
#Tue May 17 23:08:05 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip

View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1,118 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>petstore-webclient</artifactId>
<packaging>jar</packaging>
<name>petstore-webclient</name>
<version>1.0.0</version>
<url>https://github.com/openapitools/openapi-generator</url>
<description>OpenAPI Java</description>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>
<licenses>
<license>
<name>Unlicense</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>OpenAPI</name>
<email>team@openapitools.org</email>
<organization>OpenAPI</organization>
<organizationUrl>http://openapitools.org</organizationUrl>
</developer>
</developers>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor-version}</version>
</dependency>
<!-- HTTP client: Spring RestTemplate -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<version>${spring-web-version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.ipc</groupId>
<artifactId>reactor-netty</artifactId>
<version>${reactor-netty-version}</version>
</dependency>
<!-- JSON processing: jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.20</swagger-annotations-version>
<spring-web-version>5.0.7.RELEASE</spring-web-version>
<jackson-version>2.9.5</jackson-version>
<junit-version>4.12</junit-version>
<reactor-version>3.1.8.RELEASE</reactor-version>
<reactor-netty-version>0.7.8.RELEASE</reactor-netty-version>
</properties>
</project>

View File

@ -0,0 +1 @@
rootProject.name = "petstore-webclient"

View File

@ -0,0 +1,3 @@
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
<application />
</manifest>

View File

@ -0,0 +1,641 @@
package org.openapitools.client;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.RequestEntity.BodyBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
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.ClientResponse;
import org.springframework.web.reactive.function.BodyInserter;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone;
import org.openapitools.client.auth.Authentication;
import org.openapitools.client.auth.HttpBasicAuth;
import org.openapitools.client.auth.ApiKeyAuth;
import org.openapitools.client.auth.OAuth;
public class ApiClient {
public enum CollectionFormat {
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
private final String separator;
private CollectionFormat(String separator) {
this.separator = separator;
}
private String collectionToString(Collection<? extends CharSequence> collection) {
return StringUtils.collectionToDelimitedString(collection, separator);
}
}
private HttpHeaders defaultHeaders = new HttpHeaders();
private String basePath = "http://petstore.swagger.io:80/v2";
private final WebClient webClient;
private final DateFormat dateFormat;
private Map<String, Authentication> authentications;
public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.webClient = buildWebClient(new ObjectMapper(), this.dateFormat);
}
public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildWebClient(mapper.copy(), format), format);
}
private ApiClient(WebClient webClient, DateFormat format) {
this.webClient = webClient;
this.dateFormat = format;
}
public DateFormat createDefaultDateFormat() {
DateFormat dateFormat = new RFC3339DateFormat();
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return dateFormat;
}
protected void init() {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("petstore_auth", new OAuth());
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}
/**
* Build the RestTemplate used to make HTTP requests.
* @return RestTemplate
*/
public static WebClient buildWebClient(ObjectMapper mapper, DateFormat dateFormat) {
mapper.setDateFormat(dateFormat);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ExchangeStrategies strategies = ExchangeStrategies
.builder()
.codecs(clientDefaultCodecsConfigurer -> {
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper, MediaType.APPLICATION_JSON));
clientDefaultCodecsConfigurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper, MediaType.APPLICATION_JSON));
}).build();
WebClient.Builder webClient = WebClient.builder().exchangeStrategies(strategies);
return webClient.build();
}
/**
* Get the current base path
* @return String the base path
*/
public String getBasePath() {
return basePath;
}
/**
* Set the base path, which should include the host
* @param basePath the base path
* @return ApiClient this client
*/
public ApiClient setBasePath(String basePath) {
this.basePath = basePath;
return this;
}
/**
* Get authentications (key: authentication name, value: authentication).
* @return Map the currently configured authentication types
*/
public Map<String, Authentication> getAuthentications() {
return authentications;
}
/**
* Get authentication for the given name.
*
* @param authName The authentication name
* @return The authentication, null if not found
*/
public Authentication getAuthentication(String authName) {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
* @param username the username
*/
public void setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setUsername(username);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
* Helper method to set password for the first HTTP basic authentication.
* @param password the password
*/
public void setPassword(String password) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
* Helper method to set API key value for the first API key authentication.
* @param apiKey the API key
*/
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKey(apiKey);
return;
}
}
throw new RuntimeException("No API key authentication configured!");
}
/**
* Helper method to set API key prefix for the first API key authentication.
* @param apiKeyPrefix the API key prefix
*/
public void setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
return;
}
}
throw new RuntimeException("No API key authentication configured!");
}
/**
* Helper method to set access token for the first OAuth2 authentication.
* @param accessToken the access token
*/
public void setAccessToken(String accessToken) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setAccessToken(accessToken);
return;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
}
/**
* Set the User-Agent header's value (by adding to the default header map).
* @param userAgent the user agent string
* @return ApiClient this client
*/
public ApiClient setUserAgent(String userAgent) {
addDefaultHeader("User-Agent", userAgent);
return this;
}
/**
* Add a default header.
*
* @param name The header's name
* @param value The header's value
* @return ApiClient this client
*/
public ApiClient addDefaultHeader(String name, String value) {
if (defaultHeaders.containsKey(name)) {
defaultHeaders.remove(name);
}
defaultHeaders.add(name, value);
return this;
}
/**
* Get the date format used to parse/format date parameters.
* @return DateFormat format
*/
public DateFormat getDateFormat() {
return dateFormat;
}
/**
* Parse the given string into Date object.
*/
public Date parseDate(String str) {
try {
return dateFormat.parse(str);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* Format the given Date object into string.
*/
public String formatDate(Date date) {
return dateFormat.format(date);
}
/**
* Format the given parameter object into string.
* @param param the object to convert
* @return String the parameter represented as a String
*/
public String parameterToString(Object param) {
if (param == null) {
return "";
} else if (param instanceof Date) {
return formatDate( (Date) param);
} else if (param instanceof Collection) {
StringBuilder b = new StringBuilder();
for(Object o : (Collection<?>) param) {
if(b.length() > 0) {
b.append(",");
}
b.append(String.valueOf(o));
}
return b.toString();
} else {
return String.valueOf(param);
}
}
/**
* Converts a parameter to a {@link MultiValueMap} for use in REST requests
* @param collectionFormat The format to convert to
* @param name The name of the parameter
* @param value The parameter's value
* @return a Map containing the String value(s) of the input parameter
*/
public MultiValueMap<String, String> parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) {
final MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
if (name == null || name.isEmpty() || value == null) {
return params;
}
if(collectionFormat == null) {
collectionFormat = CollectionFormat.CSV;
}
Collection<?> valueCollection = null;
if (value instanceof Collection) {
valueCollection = (Collection<?>) value;
} else {
params.add(name, parameterToString(value));
return params;
}
if (valueCollection.isEmpty()){
return params;
}
if (collectionFormat.equals(CollectionFormat.MULTI)) {
for (Object item : valueCollection) {
params.add(name, parameterToString(item));
}
return params;
}
List<String> values = new ArrayList<String>();
for(Object o : valueCollection) {
values.add(parameterToString(o));
}
params.add(name, collectionFormat.collectionToString(values));
return params;
}
/**
* Check if the given {@code String} is a JSON MIME.
* @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise
*/
public boolean isJsonMime(String mediaType) {
// "* / *" is default to JSON
if ("*/*".equals(mediaType)) {
return true;
}
try {
return isJsonMime(MediaType.parseMediaType(mediaType));
} catch (InvalidMediaTypeException e) {
}
return false;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* @param mediaType the input MediaType
* @return boolean true if the MediaType represents JSON, false otherwise
*/
public boolean isJsonMime(MediaType mediaType) {
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$"));
}
/**
* Select the Accept header's value from the given accepts array:
* if JSON exists in the given array, use it;
* otherwise use all of them (joining into a string)
*
* @param accepts The accepts array to select from
* @return List The list of MediaTypes to use for the Accept header
*/
public List<MediaType> selectHeaderAccept(String[] accepts) {
if (accepts.length == 0) {
return null;
}
for (String accept : accepts) {
MediaType mediaType = MediaType.parseMediaType(accept);
if (isJsonMime(mediaType)) {
return Collections.singletonList(mediaType);
}
}
return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts));
}
/**
* Select the Content-Type header's value from the given array:
* if JSON exists in the given array, use it;
* otherwise use the first one of the array.
*
* @param contentTypes The Content-Type array to select from
* @return MediaType The Content-Type header to use. If the given array is empty, JSON will be used.
*/
public MediaType selectHeaderContentType(String[] contentTypes) {
if (contentTypes.length == 0) {
return MediaType.APPLICATION_JSON;
}
for (String contentType : contentTypes) {
MediaType mediaType = MediaType.parseMediaType(contentType);
if (isJsonMime(mediaType)) {
return mediaType;
}
}
return MediaType.parseMediaType(contentTypes[0]);
}
/**
* Select the body to use for the request
* @param obj the body object
* @param formParams the form parameters
* @param contentType the content type of the request
* @return Object the selected body
*/
protected BodyInserter<?, ? super ClientHttpRequest> selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) {
boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType);
return isForm ? BodyInserters.fromMultipartData(formParams) : (obj != null ? BodyInserters.fromObject(obj) : null);
}
/**
* Invoke API by sending HTTP request with the given options.
*
* @param <T> the return type to use
* @param path The sub-path of the HTTP URL
* @param method The request method
* @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 <T> Mono<T> invokeAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
return requestBuilder.exchange()
.flatMap(response -> {
HttpStatus statusCode = response.statusCode();
if (response.statusCode() == HttpStatus.NO_CONTENT) {
return Mono.empty();
} else if (statusCode.is2xxSuccessful()) {
if (returnType == null) {
return Mono.empty();
} else {
return response.bodyToMono(returnType);
}
} else {
return Mono.error(new RestClientException("API returned " + statusCode + " and it wasn't handled by the RestTemplate error handler"));
}
});
}
/**
* Invoke API by sending HTTP request with the given options.
*
* @param <T> the return type to use
* @param path The sub-path of the HTTP URL
* @param method The request method
* @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 <T> Flux<T> invokeFluxAPI(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
final WebClient.RequestBodySpec requestBuilder = prepareRequest(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
return requestBuilder.exchange()
.flatMapMany(response -> {
HttpStatus statusCode = response.statusCode();
ClientResponse.Headers headers = response.headers();
if (response.statusCode() == HttpStatus.NO_CONTENT) {
return Flux.empty();
} else if (statusCode.is2xxSuccessful()) {
if (returnType == null) {
return Flux.empty();
} else {
return response.bodyToFlux(returnType);
}
} else {
return Flux.error(new RestClientException("API returned " + statusCode + " and it wasn't handled by the RestTemplate error handler"));
}
});
}
private WebClient.RequestBodySpec prepareRequest(String path, HttpMethod method, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames) {
updateParamsForAuth(authNames, queryParams, headerParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
if (queryParams != null) {
//encode the query parameters in case they contain unsafe characters
for (List<String> values : queryParams.values()) {
if (values != null) {
for (int i = 0; i < values.size(); i++) {
try {
values.set(i, URLEncoder.encode(values.get(i), "utf8"));
} catch (UnsupportedEncodingException e) {
}
}
}
}
builder.queryParams(queryParams);
}
final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build().toUri());
if(accept != null) {
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
}
if(contentType != null) {
requestBuilder.contentType(contentType);
}
addHeadersToRequest(headerParams, requestBuilder);
addHeadersToRequest(defaultHeaders, requestBuilder);
requestBuilder.body(selectBody(body, formParams, contentType));
return requestBuilder;
}
/**
* Add headers to the request that is being built
* @param headers The headers to add
* @param requestBuilder The current request
*/
protected void addHeadersToRequest(HttpHeaders headers, WebClient.RequestBodySpec requestBuilder) {
for (Entry<String, List<String>> entry : headers.entrySet()) {
List<String> values = entry.getValue();
for(String value : values) {
if (value != null) {
requestBuilder.header(entry.getKey(), value);
}
}
}
}
/**
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
* @param queryParams The query parameters
* @param headerParams The header parameters
*/
private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
if (auth == null) {
throw new RestClientException("Authentication undefined: " + authName);
}
auth.applyToParams(queryParams, headerParams);
}
}
private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class);
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
logRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
logResponse(response);
return response;
}
private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException {
log.info("URI: " + request.getURI());
log.info("HTTP Method: " + request.getMethod());
log.info("HTTP Headers: " + headersToString(request.getHeaders()));
log.info("Request Body: " + new String(body, StandardCharsets.UTF_8));
}
private void logResponse(ClientHttpResponse response) throws IOException {
log.info("HTTP Status Code: " + response.getRawStatusCode());
log.info("Status Text: " + response.getStatusText());
log.info("HTTP Headers: " + headersToString(response.getHeaders()));
log.info("Response Body: " + bodyToString(response.getBody()));
}
private String headersToString(HttpHeaders headers) {
StringBuilder builder = new StringBuilder();
for(Entry<String, List<String>> entry : headers.entrySet()) {
builder.append(entry.getKey()).append("=[");
for(String value : entry.getValue()) {
builder.append(value).append(",");
}
builder.setLength(builder.length() - 1); // Get rid of trailing comma
builder.append("],");
}
builder.setLength(builder.length() - 1); // Get rid of trailing comma
return builder.toString();
}
private String bodyToString(InputStream body) throws IOException {
StringBuilder builder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8));
String line = bufferedReader.readLine();
while (line != null) {
builder.append(line).append(System.lineSeparator());
line = bufferedReader.readLine();
}
bufferedReader.close();
return builder.toString();
}
}
}

View File

@ -0,0 +1,91 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
import java.util.Map;
import java.util.List;
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
private String responseBody = null;
public ApiException() {}
public ApiException(Throwable throwable) {
super(throwable);
}
public ApiException(String message) {
super(message);
}
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
super(message, throwable);
this.code = code;
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
this(message, (Throwable) null, code, responseHeaders, responseBody);
}
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
this(message, throwable, code, responseHeaders, null);
}
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
}
public ApiException(int code, String message) {
super(message);
this.code = code;
}
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
this(code, message);
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
/**
* Get the HTTP status code.
*
* @return HTTP status code
*/
public int getCode() {
return code;
}
/**
* Get the HTTP response headers.
*
* @return A map of list of string
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
/**
* Get the HTTP response body.
*
* @return Response body in the form of string
*/
public String getResponseBody() {
return responseBody;
}
}

View File

@ -0,0 +1,39 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();
/**
* Get the default API client, which would be used when creating API
* instances without providing an API client.
*
* @return Default API client
*/
public static ApiClient getDefaultApiClient() {
return defaultApiClient;
}
/**
* Set the default API client, which would be used when creating API
* instances without providing an API client.
*
* @param apiClient API client
*/
public static void setDefaultApiClient(ApiClient apiClient) {
defaultApiClient = apiClient;
}
}

View File

@ -0,0 +1,52 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
public class Pair {
private String name = "";
private String value = "";
public Pair (String name, String value) {
setName(name);
setValue(value);
}
private void setName(String name) {
if (!isValidString(name)) return;
this.name = name;
}
private void setValue(String value) {
if (!isValidString(value)) return;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
return true;
}
}

View File

@ -0,0 +1,32 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.FieldPosition;
import java.util.Date;
public class RFC3339DateFormat extends ISO8601DateFormat {
// Same as ISO8601DateFormat but serializing milliseconds.
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
String value = ISO8601Utils.format(date, true);
toAppendTo.append(value);
return toAppendTo;
}
}

View File

@ -0,0 +1,55 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
*
* @param array The array
* @param value The value to search
* @return true if the array contains the value
*/
public static boolean containsIgnoreCase(String[] array, String value) {
for (String str : array) {
if (value == null && str == null) return true;
if (value != null && value.equalsIgnoreCase(str)) return true;
}
return false;
}
/**
* Join an array of strings with the given separator.
* <p>
* Note: This might be replaced by utility method from commons-lang or guava someday
* if one of those libraries is added as dependency.
* </p>
*
* @param array The array of strings
* @param separator The separator
* @return the resulting string
*/
public static String join(String[] array, String separator) {
int len = array.length;
if (len == 0) return "";
StringBuilder out = new StringBuilder();
out.append(array[0]);
for (int i = 1; i < len; i++) {
out.append(separator).append(array[i]);
}
return out.toString();
}
}

View File

@ -0,0 +1,84 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class AnotherFakeApi {
private ApiClient apiClient;
public AnotherFakeApi() {
this(new ApiClient());
}
@Autowired
public AnotherFakeApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* To test special tags
* To test special tags
* <p><b>200</b> - successful operation
* @param client client model
* @return Client
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Client> testSpecialTags(Client client) throws RestClientException {
Object postBody = client;
// verify the required parameter 'client' is set
if (client == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'client' when calling testSpecialTags");
}
String path = UriComponentsBuilder.fromPath("/another-fake/dummy").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}

View File

@ -0,0 +1,466 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import java.math.BigDecimal;
import org.openapitools.client.model.Client;
import java.io.File;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class FakeApi {
private ApiClient apiClient;
public FakeApi() {
this(new ApiClient());
}
@Autowired
public FakeApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
*
* Test serialization of outer boolean types
* <p><b>200</b> - Output boolean
* @param body Input boolean as post body
* @return Boolean
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Boolean> fakeOuterBooleanSerialize(Boolean body) throws RestClientException {
Object postBody = body;
String path = UriComponentsBuilder.fromPath("/fake/outer/boolean").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"*/*"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Boolean> returnType = new ParameterizedTypeReference<Boolean>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
*
* Test serialization of object with outer number type
* <p><b>200</b> - Output composite
* @param outerComposite Input composite as post body
* @return OuterComposite
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<OuterComposite> fakeOuterCompositeSerialize(OuterComposite outerComposite) throws RestClientException {
Object postBody = outerComposite;
String path = UriComponentsBuilder.fromPath("/fake/outer/composite").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"*/*"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<OuterComposite> returnType = new ParameterizedTypeReference<OuterComposite>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
*
* Test serialization of outer number types
* <p><b>200</b> - Output number
* @param body Input number as post body
* @return BigDecimal
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<BigDecimal> fakeOuterNumberSerialize(BigDecimal body) throws RestClientException {
Object postBody = body;
String path = UriComponentsBuilder.fromPath("/fake/outer/number").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"*/*"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<BigDecimal> returnType = new ParameterizedTypeReference<BigDecimal>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
*
* Test serialization of outer string types
* <p><b>200</b> - Output string
* @param body Input string as post body
* @return String
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<String> fakeOuterStringSerialize(String body) throws RestClientException {
Object postBody = body;
String path = UriComponentsBuilder.fromPath("/fake/outer/string").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"*/*"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
*
*
* <p><b>200</b> - Success
* @param query The query parameter
* @param user The user parameter
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> testBodyWithQueryParams(String query, User user) throws RestClientException {
Object postBody = user;
// verify the required parameter 'query' is set
if (query == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'query' when calling testBodyWithQueryParams");
}
// verify the required parameter 'user' is set
if (user == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling testBodyWithQueryParams");
}
String path = UriComponentsBuilder.fromPath("/fake/body-with-query-params").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query", query));
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* To test \&quot;client\&quot; model
* To test \&quot;client\&quot; model
* <p><b>200</b> - successful operation
* @param client client model
* @return Client
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Client> testClientModel(Client client) throws RestClientException {
Object postBody = client;
// verify the required parameter 'client' is set
if (client == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'client' when calling testClientModel");
}
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* <p><b>400</b> - Invalid username supplied
* <p><b>404</b> - 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 RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> 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 RestClientException {
Object postBody = null;
// verify the required parameter 'number' is set
if (number == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'number' when calling testEndpointParameters");
}
// verify the required parameter '_double' is set
if (_double == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter '_double' when calling testEndpointParameters");
}
// verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
}
// verify the required parameter '_byte' is set
if (_byte == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter '_byte' when calling testEndpointParameters");
}
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
if (integer != null)
formParams.add("integer", integer);
if (int32 != null)
formParams.add("int32", int32);
if (int64 != null)
formParams.add("int64", int64);
if (number != null)
formParams.add("number", number);
if (_float != null)
formParams.add("float", _float);
if (_double != null)
formParams.add("double", _double);
if (string != null)
formParams.add("string", string);
if (patternWithoutDelimiter != null)
formParams.add("pattern_without_delimiter", patternWithoutDelimiter);
if (_byte != null)
formParams.add("byte", _byte);
if (binary != null)
formParams.add("binary", new FileSystemResource(binary));
if (date != null)
formParams.add("date", date);
if (dateTime != null)
formParams.add("dateTime", dateTime);
if (password != null)
formParams.add("password", password);
if (paramCallback != null)
formParams.add("callback", paramCallback);
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/x-www-form-urlencoded"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "http_basic_test" };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* To test enum parameters
* To test enum parameters
* <p><b>400</b> - Invalid request
* <p><b>404</b> - 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 RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws RestClientException {
Object postBody = null;
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), "enum_query_string_array", enumQueryStringArray));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_string", enumQueryString));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_integer", enumQueryInteger));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_double", enumQueryDouble));
if (enumHeaderStringArray != null)
headerParams.add("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray));
if (enumHeaderString != null)
headerParams.add("enum_header_string", apiClient.parameterToString(enumHeaderString));
if (enumFormStringArray != null)
formParams.add("enum_form_string_array", enumFormStringArray);
if (enumFormString != null)
formParams.add("enum_form_string", enumFormString);
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/x-www-form-urlencoded"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* test inline additionalProperties
*
* <p><b>200</b> - successful operation
* @param requestBody request body
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> testInlineAdditionalProperties(Map<String, String> requestBody) throws RestClientException {
Object postBody = requestBody;
// verify the required parameter 'requestBody' is set
if (requestBody == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties");
}
String path = UriComponentsBuilder.fromPath("/fake/inline-additionalProperties").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* test json serialization of form data
*
* <p><b>200</b> - successful operation
* @param param field1
* @param param2 field2
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> testJsonFormData(String param, String param2) throws RestClientException {
Object postBody = null;
// verify the required parameter 'param' is set
if (param == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'param' when calling testJsonFormData");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'param2' when calling testJsonFormData");
}
String path = UriComponentsBuilder.fromPath("/fake/jsonFormData").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
if (param != null)
formParams.add("param", param);
if (param2 != null)
formParams.add("param2", param2);
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/x-www-form-urlencoded"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}

View File

@ -0,0 +1,84 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class FakeClassnameTags123Api {
private ApiClient apiClient;
public FakeClassnameTags123Api() {
this(new ApiClient());
}
@Autowired
public FakeClassnameTags123Api(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* To test class name in snake case
* To test class name in snake case
* <p><b>200</b> - successful operation
* @param client client model
* @return Client
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Client> testClassname(Client client) throws RestClientException {
Object postBody = client;
// verify the required parameter 'client' is set
if (client == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'client' when calling testClassname");
}
String path = UriComponentsBuilder.fromPath("/fake_classname_test").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key_query" };
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}

View File

@ -0,0 +1,409 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class PetApi {
private ApiClient apiClient;
public PetApi() {
this(new ApiClient());
}
@Autowired
public PetApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Add a new pet to the store
*
* <p><b>405</b> - Invalid input
* @param pet Pet object that needs to be added to the store
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> addPet(Pet pet) throws RestClientException {
Object postBody = pet;
// verify the required parameter 'pet' is set
if (pet == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'pet' when calling addPet");
}
String path = UriComponentsBuilder.fromPath("/pet").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json", "application/xml"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Deletes a pet
*
* <p><b>400</b> - Invalid pet value
* @param petId Pet id to delete
* @param apiKey The apiKey parameter
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> deletePet(Long petId, String apiKey) throws RestClientException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling deletePet");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId);
String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
if (apiKey != null)
headerParams.add("api_key", apiClient.parameterToString(apiKey));
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid status value
* @param status Status values that need to be considered for filter
* @return List&lt;Pet&gt;
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Flux<Pet> findPetsByStatus(List<String> status) throws RestClientException {
Object postBody = null;
// verify the required parameter 'status' is set
if (status == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'status' when calling findPetsByStatus");
}
String path = UriComponentsBuilder.fromPath("/pet/findByStatus").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), "status", status));
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
return apiClient.invokeFluxAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid tag value
* @param tags Tags to filter by
* @return List&lt;Pet&gt;
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Flux<Pet> findPetsByTags(List<String> tags) throws RestClientException {
Object postBody = null;
// verify the required parameter 'tags' is set
if (tags == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'tags' when calling findPetsByTags");
}
String path = UriComponentsBuilder.fromPath("/pet/findByTags").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), "tags", tags));
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
return apiClient.invokeFluxAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Find pet by ID
* Returns a single pet
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid ID supplied
* <p><b>404</b> - Pet not found
* @param petId ID of pet to return
* @return Pet
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Pet> getPetById(Long petId) throws RestClientException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling getPetById");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId);
String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" };
ParameterizedTypeReference<Pet> returnType = new ParameterizedTypeReference<Pet>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Update an existing pet
*
* <p><b>400</b> - Invalid ID supplied
* <p><b>404</b> - Pet not found
* <p><b>405</b> - Validation exception
* @param pet Pet object that needs to be added to the store
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> updatePet(Pet pet) throws RestClientException {
Object postBody = pet;
// verify the required parameter 'pet' is set
if (pet == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'pet' when calling updatePet");
}
String path = UriComponentsBuilder.fromPath("/pet").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json", "application/xml"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Updates a pet in the store with form data
*
* <p><b>405</b> - 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 RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> updatePetWithForm(Long petId, String name, String status) throws RestClientException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling updatePetWithForm");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId);
String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
if (name != null)
formParams.add("name", name);
if (status != null)
formParams.add("status", status);
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/x-www-form-urlencoded"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* uploads an image
*
* <p><b>200</b> - 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 RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<ModelApiResponse> uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling uploadFile");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId);
String path = UriComponentsBuilder.fromPath("/pet/{petId}/uploadImage").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
if (additionalMetadata != null)
formParams.add("additionalMetadata", additionalMetadata);
if (file != null)
formParams.add("file", new FileSystemResource(file));
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"multipart/form-data"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* uploads an image (required)
*
* <p><b>200</b> - successful operation
* @param petId ID of pet to update
* @param file file to upload
* @param additionalMetadata Additional data to pass to server
* @return ModelApiResponse
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<ModelApiResponse> uploadFileWithRequiredFile(Long petId, File file, String additionalMetadata) throws RestClientException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
}
// verify the required parameter 'file' is set
if (file == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'file' when calling uploadFileWithRequiredFile");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId);
String path = UriComponentsBuilder.fromPath("/fake/{petId}/uploadImageWithRequiredFile").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
if (additionalMetadata != null)
formParams.add("additionalMetadata", additionalMetadata);
if (file != null)
formParams.add("file", new FileSystemResource(file));
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"multipart/form-data"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "petstore_auth" };
ParameterizedTypeReference<ModelApiResponse> returnType = new ParameterizedTypeReference<ModelApiResponse>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}

View File

@ -0,0 +1,185 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.Order;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class StoreApi {
private ApiClient apiClient;
public StoreApi() {
this(new ApiClient());
}
@Autowired
public StoreApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* <p><b>400</b> - Invalid ID supplied
* <p><b>404</b> - Order not found
* @param orderId ID of the order that needs to be deleted
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> deleteOrder(String orderId) throws RestClientException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'orderId' when calling deleteOrder");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("order_id", orderId);
String path = UriComponentsBuilder.fromPath("/store/order/{order_id}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* <p><b>200</b> - successful operation
* @return Map&lt;String, Integer&gt;
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Map<String, Integer>> getInventory() throws RestClientException {
Object postBody = null;
String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" };
ParameterizedTypeReference<Map<String, Integer>> returnType = new ParameterizedTypeReference<Map<String, Integer>>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid ID supplied
* <p><b>404</b> - Order not found
* @param orderId ID of pet that needs to be fetched
* @return Order
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Order> getOrderById(Long orderId) throws RestClientException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'orderId' when calling getOrderById");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("order_id", orderId);
String path = UriComponentsBuilder.fromPath("/store/order/{order_id}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Place an order for a pet
*
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid Order
* @param order order placed for purchasing the pet
* @return Order
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Order> placeOrder(Order order) throws RestClientException {
Object postBody = order;
// verify the required parameter 'order' is set
if (order == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'order' when calling placeOrder");
}
String path = UriComponentsBuilder.fromPath("/store/order").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Order> returnType = new ParameterizedTypeReference<Order>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}

View File

@ -0,0 +1,325 @@
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.model.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
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 reactor.core.publisher.Mono;
import reactor.core.publisher.Flux;
public class UserApi {
private ApiClient apiClient;
public UserApi() {
this(new ApiClient());
}
@Autowired
public UserApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create user
* This can only be done by the logged in user.
* <p><b>0</b> - successful operation
* @param user Created user object
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> createUser(User user) throws RestClientException {
Object postBody = user;
// verify the required parameter 'user' is set
if (user == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling createUser");
}
String path = UriComponentsBuilder.fromPath("/user").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Creates list of users with given input array
*
* <p><b>0</b> - successful operation
* @param user List of user object
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> createUsersWithArrayInput(List<User> user) throws RestClientException {
Object postBody = user;
// verify the required parameter 'user' is set
if (user == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
}
String path = UriComponentsBuilder.fromPath("/user/createWithArray").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Creates list of users with given input array
*
* <p><b>0</b> - successful operation
* @param user List of user object
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> createUsersWithListInput(List<User> user) throws RestClientException {
Object postBody = user;
// verify the required parameter 'user' is set
if (user == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling createUsersWithListInput");
}
String path = UriComponentsBuilder.fromPath("/user/createWithList").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Delete user
* This can only be done by the logged in user.
* <p><b>400</b> - Invalid username supplied
* <p><b>404</b> - User not found
* @param username The name that needs to be deleted
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> deleteUser(String username) throws RestClientException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling deleteUser");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username);
String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Get user by user name
*
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid username supplied
* <p><b>404</b> - User not found
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<User> getUserByName(String username) throws RestClientException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling getUserByName");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username);
String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<User> returnType = new ParameterizedTypeReference<User>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Logs user into the system
*
* <p><b>200</b> - successful operation
* <p><b>400</b> - Invalid username/password supplied
* @param username The user name for login
* @param password The password for login in clear text
* @return String
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<String> loginUser(String username, String password) throws RestClientException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling loginUser");
}
// verify the required parameter 'password' is set
if (password == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'password' when calling loginUser");
}
String path = UriComponentsBuilder.fromPath("/user/login").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "username", username));
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "password", password));
final String[] accepts = {
"application/xml", "application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Logs out current logged in user session
*
* <p><b>0</b> - successful operation
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> logoutUser() throws RestClientException {
Object postBody = null;
String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
/**
* Updated user
* This can only be done by the logged in user.
* <p><b>400</b> - Invalid user supplied
* <p><b>404</b> - User not found
* @param username name that need to be deleted
* @param user Updated user object
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public Mono<Void> updateUser(String username, User user) throws RestClientException {
Object postBody = user;
// verify the required parameter 'username' is set
if (username == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling updateUser");
}
// verify the required parameter 'user' is set
if (user == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling updateUser");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username);
String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString();
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
final String[] accepts = { };
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
}
}

View File

@ -0,0 +1,60 @@
package org.openapitools.client.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
public class ApiKeyAuth implements Authentication {
private final String location;
private final String paramName;
private String apiKey;
private String apiKeyPrefix;
public ApiKeyAuth(String location, String paramName) {
this.location = location;
this.paramName = paramName;
}
public String getLocation() {
return location;
}
public String getParamName() {
return paramName;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiKeyPrefix() {
return apiKeyPrefix;
}
public void setApiKeyPrefix(String apiKeyPrefix) {
this.apiKeyPrefix = apiKeyPrefix;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
if (apiKey == null) {
return;
}
String value;
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;
} else {
value = apiKey;
}
if (location.equals("query")) {
queryParams.add(paramName, value);
} else if (location.equals("header")) {
headerParams.add(paramName, value);
}
}
}

View File

@ -0,0 +1,13 @@
package org.openapitools.client.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
public interface Authentication {
/**
* Apply authentication settings to header and / or query parameters.
* @param queryParams The query parameters for the request
* @param headerParams The header parameters for the request
*/
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams);
}

View File

@ -0,0 +1,39 @@
package org.openapitools.client.auth;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.springframework.http.HttpHeaders;
import org.springframework.util.Base64Utils;
import org.springframework.util.MultiValueMap;
public class HttpBasicAuth implements Authentication {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
if (username == null && password == null) {
return;
}
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8)));
}
}

View File

@ -0,0 +1,24 @@
package org.openapitools.client.auth;
import org.springframework.http.HttpHeaders;
import org.springframework.util.MultiValueMap;
public class OAuth implements Authentication {
private String accessToken;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@Override
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams) {
if (accessToken != null) {
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
}
}
}

View File

@ -0,0 +1,5 @@
package org.openapitools.client.auth;
public enum OAuthFlow {
accessCode, implicit, password, application
}

View File

@ -0,0 +1,133 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* AdditionalPropertiesClass
*/
public class AdditionalPropertiesClass {
@JsonProperty("map_property")
private Map<String, String> mapProperty = null;
@JsonProperty("map_of_map_property")
private Map<String, Map<String, String>> mapOfMapProperty = null;
public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
this.mapProperty = mapProperty;
return this;
}
public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
if (this.mapProperty == null) {
this.mapProperty = new HashMap<>();
}
this.mapProperty.put(key, mapPropertyItem);
return this;
}
/**
* Get mapProperty
* @return mapProperty
**/
@ApiModelProperty(value = "")
public Map<String, String> getMapProperty() {
return mapProperty;
}
public void setMapProperty(Map<String, String> mapProperty) {
this.mapProperty = mapProperty;
}
public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
this.mapOfMapProperty = mapOfMapProperty;
return this;
}
public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
if (this.mapOfMapProperty == null) {
this.mapOfMapProperty = new HashMap<>();
}
this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this;
}
/**
* Get mapOfMapProperty
* @return mapOfMapProperty
**/
@ApiModelProperty(value = "")
public Map<String, Map<String, String>> getMapOfMapProperty() {
return mapOfMapProperty;
}
public void setMapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
this.mapOfMapProperty = mapOfMapProperty;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o;
return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) &&
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty);
}
@Override
public int hashCode() {
return Objects.hash(mapProperty, mapOfMapProperty);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AdditionalPropertiesClass {\n");
sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n");
sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,121 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true )
@JsonSubTypes({
@JsonSubTypes.Type(value = Dog.class, name = "Dog"),
@JsonSubTypes.Type(value = Cat.class, name = "Cat"),
})
public class Animal {
@JsonProperty("className")
private String className = null;
@JsonProperty("color")
private String color = "red";
public Animal className(String className) {
this.className = className;
return this;
}
/**
* Get className
* @return className
**/
@ApiModelProperty(required = true, value = "")
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public Animal color(String color) {
this.color = color;
return this;
}
/**
* Get color
* @return color
**/
@ApiModelProperty(value = "")
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Animal animal = (Animal) o;
return Objects.equals(this.className, animal.className) &&
Objects.equals(this.color, animal.color);
}
@Override
public int hashCode() {
return Objects.hash(className, color);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Animal {\n");
sb.append(" className: ").append(toIndentedString(className)).append("\n");
sb.append(" color: ").append(toIndentedString(color)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,66 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,102 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* ArrayOfArrayOfNumberOnly
*/
public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
private List<List<BigDecimal>> arrayArrayNumber = null;
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;
return this;
}
public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<>();
}
this.arrayArrayNumber.add(arrayArrayNumberItem);
return this;
}
/**
* Get arrayArrayNumber
* @return arrayArrayNumber
**/
@ApiModelProperty(value = "")
public List<List<BigDecimal>> getArrayArrayNumber() {
return arrayArrayNumber;
}
public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o;
return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber);
}
@Override
public int hashCode() {
return Objects.hash(arrayArrayNumber);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ArrayOfArrayOfNumberOnly {\n");
sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,102 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* ArrayOfNumberOnly
*/
public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
private List<BigDecimal> arrayNumber = null;
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber;
return this;
}
public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<>();
}
this.arrayNumber.add(arrayNumberItem);
return this;
}
/**
* Get arrayNumber
* @return arrayNumber
**/
@ApiModelProperty(value = "")
public List<BigDecimal> getArrayNumber() {
return arrayNumber;
}
public void setArrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o;
return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber);
}
@Override
public int hashCode() {
return Objects.hash(arrayNumber);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ArrayOfNumberOnly {\n");
sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,164 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ReadOnlyFirst;
/**
* ArrayTest
*/
public class ArrayTest {
@JsonProperty("array_of_string")
private List<String> arrayOfString = null;
@JsonProperty("array_array_of_integer")
private List<List<Long>> arrayArrayOfInteger = null;
@JsonProperty("array_array_of_model")
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
return this;
}
public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
if (this.arrayOfString == null) {
this.arrayOfString = new ArrayList<>();
}
this.arrayOfString.add(arrayOfStringItem);
return this;
}
/**
* Get arrayOfString
* @return arrayOfString
**/
@ApiModelProperty(value = "")
public List<String> getArrayOfString() {
return arrayOfString;
}
public void setArrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
}
public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
this.arrayArrayOfInteger = arrayArrayOfInteger;
return this;
}
public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
if (this.arrayArrayOfInteger == null) {
this.arrayArrayOfInteger = new ArrayList<>();
}
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this;
}
/**
* Get arrayArrayOfInteger
* @return arrayArrayOfInteger
**/
@ApiModelProperty(value = "")
public List<List<Long>> getArrayArrayOfInteger() {
return arrayArrayOfInteger;
}
public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
this.arrayArrayOfInteger = arrayArrayOfInteger;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<>();
}
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this;
}
/**
* Get arrayArrayOfModel
* @return arrayArrayOfModel
**/
@ApiModelProperty(value = "")
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ArrayTest arrayTest = (ArrayTest) o;
return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) &&
Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) &&
Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel);
}
@Override
public int hashCode() {
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ArrayTest {\n");
sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n");
sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n");
sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,206 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Capitalization
*/
public class Capitalization {
@JsonProperty("smallCamel")
private String smallCamel = null;
@JsonProperty("CapitalCamel")
private String capitalCamel = null;
@JsonProperty("small_Snake")
private String smallSnake = null;
@JsonProperty("Capital_Snake")
private String capitalSnake = null;
@JsonProperty("SCA_ETH_Flow_Points")
private String scAETHFlowPoints = null;
@JsonProperty("ATT_NAME")
private String ATT_NAME = null;
public Capitalization smallCamel(String smallCamel) {
this.smallCamel = smallCamel;
return this;
}
/**
* Get smallCamel
* @return smallCamel
**/
@ApiModelProperty(value = "")
public String getSmallCamel() {
return smallCamel;
}
public void setSmallCamel(String smallCamel) {
this.smallCamel = smallCamel;
}
public Capitalization capitalCamel(String capitalCamel) {
this.capitalCamel = capitalCamel;
return this;
}
/**
* Get capitalCamel
* @return capitalCamel
**/
@ApiModelProperty(value = "")
public String getCapitalCamel() {
return capitalCamel;
}
public void setCapitalCamel(String capitalCamel) {
this.capitalCamel = capitalCamel;
}
public Capitalization smallSnake(String smallSnake) {
this.smallSnake = smallSnake;
return this;
}
/**
* Get smallSnake
* @return smallSnake
**/
@ApiModelProperty(value = "")
public String getSmallSnake() {
return smallSnake;
}
public void setSmallSnake(String smallSnake) {
this.smallSnake = smallSnake;
}
public Capitalization capitalSnake(String capitalSnake) {
this.capitalSnake = capitalSnake;
return this;
}
/**
* Get capitalSnake
* @return capitalSnake
**/
@ApiModelProperty(value = "")
public String getCapitalSnake() {
return capitalSnake;
}
public void setCapitalSnake(String capitalSnake) {
this.capitalSnake = capitalSnake;
}
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
this.scAETHFlowPoints = scAETHFlowPoints;
return this;
}
/**
* Get scAETHFlowPoints
* @return scAETHFlowPoints
**/
@ApiModelProperty(value = "")
public String getScAETHFlowPoints() {
return scAETHFlowPoints;
}
public void setScAETHFlowPoints(String scAETHFlowPoints) {
this.scAETHFlowPoints = scAETHFlowPoints;
}
public Capitalization ATT_NAME(String ATT_NAME) {
this.ATT_NAME = ATT_NAME;
return this;
}
/**
* Name of the pet
* @return ATT_NAME
**/
@ApiModelProperty(value = "Name of the pet ")
public String getATTNAME() {
return ATT_NAME;
}
public void setATTNAME(String ATT_NAME) {
this.ATT_NAME = ATT_NAME;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Capitalization capitalization = (Capitalization) o;
return Objects.equals(this.smallCamel, capitalization.smallCamel) &&
Objects.equals(this.capitalCamel, capitalization.capitalCamel) &&
Objects.equals(this.smallSnake, capitalization.smallSnake) &&
Objects.equals(this.capitalSnake, capitalization.capitalSnake) &&
Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) &&
Objects.equals(this.ATT_NAME, capitalization.ATT_NAME);
}
@Override
public int hashCode() {
return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Capitalization {\n");
sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n");
sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n");
sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n");
sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n");
sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n");
sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,93 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Animal;
/**
* Cat
*/
public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed = null;
public Cat declawed(Boolean declawed) {
this.declawed = declawed;
return this;
}
/**
* Get declawed
* @return declawed
**/
@ApiModelProperty(value = "")
public Boolean isDeclawed() {
return declawed;
}
public void setDeclawed(Boolean declawed) {
this.declawed = declawed;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Cat cat = (Cat) o;
return Objects.equals(this.declawed, cat.declawed) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(declawed, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Cat {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,114 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Category
*/
public class Category {
@JsonProperty("id")
private Long id = null;
@JsonProperty("name")
private String name = null;
public Category id(Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
@ApiModelProperty(value = "")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Category name(String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
**/
@ApiModelProperty(value = "")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,92 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Model for testing model with \&quot;_class\&quot; property
*/
@ApiModel(description = "Model for testing model with \"_class\" property")
public class ClassModel {
@JsonProperty("_class")
private String propertyClass = null;
public ClassModel propertyClass(String propertyClass) {
this.propertyClass = propertyClass;
return this;
}
/**
* Get propertyClass
* @return propertyClass
**/
@ApiModelProperty(value = "")
public String getPropertyClass() {
return propertyClass;
}
public void setPropertyClass(String propertyClass) {
this.propertyClass = propertyClass;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ClassModel classModel = (ClassModel) o;
return Objects.equals(this.propertyClass, classModel.propertyClass);
}
@Override
public int hashCode() {
return Objects.hash(propertyClass);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ClassModel {\n");
sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,91 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Client
*/
public class Client {
@JsonProperty("client")
private String client = null;
public Client client(String client) {
this.client = client;
return this;
}
/**
* Get client
* @return client
**/
@ApiModelProperty(value = "")
public String getClient() {
return client;
}
public void setClient(String client) {
this.client = client;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Client client = (Client) o;
return Objects.equals(this.client, client.client);
}
@Override
public int hashCode() {
return Objects.hash(client);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Client {\n");
sb.append(" client: ").append(toIndentedString(client)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,93 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Animal;
/**
* Dog
*/
public class Dog extends Animal {
@JsonProperty("breed")
private String breed = null;
public Dog breed(String breed) {
this.breed = breed;
return this;
}
/**
* Get breed
* @return breed
**/
@ApiModelProperty(value = "")
public String getBreed() {
return breed;
}
public void setBreed(String breed) {
this.breed = breed;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Dog dog = (Dog) o;
return Objects.equals(this.breed, dog.breed) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(breed, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Dog {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" breed: ").append(toIndentedString(breed)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,194 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* EnumArrays
*/
public class EnumArrays {
/**
* Gets or Sets justSymbol
*/
public enum JustSymbolEnum {
GREATER_THAN_OR_EQUAL_TO(">="),
DOLLAR("$");
private String value;
JustSymbolEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static JustSymbolEnum fromValue(String text) {
for (JustSymbolEnum b : JustSymbolEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("just_symbol")
private JustSymbolEnum justSymbol = null;
/**
* Gets or Sets arrayEnum
*/
public enum ArrayEnumEnum {
FISH("fish"),
CRAB("crab");
private String value;
ArrayEnumEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ArrayEnumEnum fromValue(String text) {
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = null;
public EnumArrays justSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol;
return this;
}
/**
* Get justSymbol
* @return justSymbol
**/
@ApiModelProperty(value = "")
public JustSymbolEnum getJustSymbol() {
return justSymbol;
}
public void setJustSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol;
}
public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) {
this.arrayEnum = arrayEnum;
return this;
}
public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) {
if (this.arrayEnum == null) {
this.arrayEnum = new ArrayList<>();
}
this.arrayEnum.add(arrayEnumItem);
return this;
}
/**
* Get arrayEnum
* @return arrayEnum
**/
@ApiModelProperty(value = "")
public List<ArrayEnumEnum> getArrayEnum() {
return arrayEnum;
}
public void setArrayEnum(List<ArrayEnumEnum> arrayEnum) {
this.arrayEnum = arrayEnum;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EnumArrays enumArrays = (EnumArrays) o;
return Objects.equals(this.justSymbol, enumArrays.justSymbol) &&
Objects.equals(this.arrayEnum, enumArrays.arrayEnum);
}
@Override
public int hashCode() {
return Objects.hash(justSymbol, arrayEnum);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EnumArrays {\n");
sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n");
sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

Some files were not shown because too many files have changed in this diff Show More