forked from loafle/openapi-generator-original
Java 11 native HTTP client library (#3434)
* Initial commit of Java 11 native HTTP client port * Rebase to master and add JSR305 for @Nullable * Update samples with @Nullable annotations
This commit is contained in:
parent
8253c28d6e
commit
43590582c5
@ -7,6 +7,7 @@
|
|||||||
./bin/java-petstore-feign-10x.sh
|
./bin/java-petstore-feign-10x.sh
|
||||||
./bin/java-petstore-okhttp-gson.sh
|
./bin/java-petstore-okhttp-gson.sh
|
||||||
./bin/java-petstore-okhttp-gson-parcelable.sh
|
./bin/java-petstore-okhttp-gson-parcelable.sh
|
||||||
|
./bin/java-petstore-native.sh
|
||||||
./bin/java-petstore-retrofit.sh
|
./bin/java-petstore-retrofit.sh
|
||||||
./bin/java-petstore-retrofit2.sh
|
./bin/java-petstore-retrofit2.sh
|
||||||
./bin/java-petstore-retrofit2rx.sh
|
./bin/java-petstore-retrofit2rx.sh
|
||||||
|
4
bin/java-petstore-native.json
Normal file
4
bin/java-petstore-native.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"library": "native",
|
||||||
|
"artifactId": "petstore-native"
|
||||||
|
}
|
35
bin/java-petstore-native.sh
Executable file
35
bin/java-petstore-native.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/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} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/native -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-native.json -o samples/client/petstore/java/native --additional-properties hideGenerationTimestamp=true $@"
|
||||||
|
|
||||||
|
echo "Removing files and folders under samples/client/petstore/java/httpclient/src/main"
|
||||||
|
rm -rf samples/client/petstore/java/native/src/main
|
||||||
|
find samples/client/petstore/java/native -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -2,6 +2,7 @@ call .\bin\windows\java-petstore-jersey1.bat
|
|||||||
call .\bin\windows\java-petstore-jersey2.bat
|
call .\bin\windows\java-petstore-jersey2.bat
|
||||||
call .\bin\windows\java-petstore-feign.bat
|
call .\bin\windows\java-petstore-feign.bat
|
||||||
call .\bin\windows\java-petstore-feign-10x.bat
|
call .\bin\windows\java-petstore-feign-10x.bat
|
||||||
|
call .\bin\windows\java-petstore-native.bat
|
||||||
call .\bin\windows\java-petstore-okhttp-gson.bat
|
call .\bin\windows\java-petstore-okhttp-gson.bat
|
||||||
call .\bin\windows\java-petstore-okhttp-gson-parcelable.bat
|
call .\bin\windows\java-petstore-okhttp-gson-parcelable.bat
|
||||||
call .\bin\windows\java-petstore-retrofit.bat
|
call .\bin\windows\java-petstore-retrofit.bat
|
||||||
|
10
bin/windows/java-petstore-native.bat
Normal file
10
bin/windows/java-petstore-native.bat
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
|
||||||
|
|
||||||
|
If Not Exist %executable% (
|
||||||
|
mvn clean package
|
||||||
|
)
|
||||||
|
|
||||||
|
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||||
|
set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\native -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-native.json -o samples\client\petstore\java\native --additional-properties hideGenerationTimestamp=true
|
||||||
|
|
||||||
|
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -55,4 +55,4 @@ sidebar_label: java
|
|||||||
|feignVersion|Version of OpenFeign: '10.x', '9.x' (default)| |false|
|
|feignVersion|Version of OpenFeign: '10.x', '9.x' (default)| |false|
|
||||||
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
|
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
|
||||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
||||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.8.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.8.x. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.8.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x. Only for Java8</dd><dl>|okhttp-gson|
|
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.8.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.8.x. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.8.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x. Only for Java8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dl>|okhttp-gson|
|
||||||
|
@ -67,6 +67,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
public static final String GOOGLE_API_CLIENT = "google-api-client";
|
public static final String GOOGLE_API_CLIENT = "google-api-client";
|
||||||
public static final String JERSEY1 = "jersey1";
|
public static final String JERSEY1 = "jersey1";
|
||||||
public static final String JERSEY2 = "jersey2";
|
public static final String JERSEY2 = "jersey2";
|
||||||
|
public static final String NATIVE = "native";
|
||||||
public static final String OKHTTP_GSON = "okhttp-gson";
|
public static final String OKHTTP_GSON = "okhttp-gson";
|
||||||
public static final String RESTEASY = "resteasy";
|
public static final String RESTEASY = "resteasy";
|
||||||
public static final String RESTTEMPLATE = "resttemplate";
|
public static final String RESTTEMPLATE = "resttemplate";
|
||||||
@ -139,6 +140,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
supportedLibraries.put(VERTX, "HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x");
|
supportedLibraries.put(VERTX, "HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x");
|
||||||
supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x");
|
supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x");
|
||||||
supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x. Only for Java8");
|
supportedLibraries.put(REST_ASSURED, "HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x. Only for Java8");
|
||||||
|
supportedLibraries.put(NATIVE, "HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+");
|
||||||
|
|
||||||
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
|
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
|
||||||
libraryOption.setEnum(supportedLibraries);
|
libraryOption.setEnum(supportedLibraries);
|
||||||
@ -166,7 +168,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
if (WEBCLIENT.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) {
|
if ((WEBCLIENT.equals(getLibrary()) && "threetenbp".equals(dateLibrary)) || NATIVE.equals(getLibrary())) {
|
||||||
dateLibrary = "java8";
|
dateLibrary = "java8";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,12 +256,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
writeOptional(outputFolder, new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
||||||
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
|
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
|
||||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java"));
|
supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java"));
|
||||||
if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) {
|
if (!(RESTTEMPLATE.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()))) {
|
||||||
supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java"));
|
supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer)
|
// google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer)
|
||||||
if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) {
|
if (!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()))) {
|
||||||
supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java"));
|
supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java"));
|
||||||
supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java"));
|
supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.mustache", authFolder, "HttpBearerAuth.java"));
|
||||||
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java"));
|
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java"));
|
||||||
@ -293,7 +295,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java"));
|
supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()))) {
|
if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || usesAnyRetrofitLibrary() || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || NATIVE.equals(getLibrary()))) {
|
||||||
supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java"));
|
supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +327,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||||
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
|
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
|
||||||
additionalProperties.put("jackson", "true");
|
additionalProperties.put("jackson", "true");
|
||||||
|
} else if (NATIVE.equals(getLibrary())) {
|
||||||
|
setJava8Mode(true);
|
||||||
|
additionalProperties.put("java8", "true");
|
||||||
|
additionalProperties.put("jackson", "true");
|
||||||
} else if (RESTEASY.equals(getLibrary())) {
|
} else if (RESTEASY.equals(getLibrary())) {
|
||||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||||
additionalProperties.put("jackson", "true");
|
additionalProperties.put("jackson", "true");
|
||||||
@ -412,7 +418,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
additionalProperties.remove("gson");
|
additionalProperties.remove("gson");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey("jackson")) {
|
if (additionalProperties.containsKey("jackson") && !NATIVE.equals(getLibrary())) {
|
||||||
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", invokerFolder, "RFC3339DateFormat.java"));
|
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", invokerFolder, "RFC3339DateFormat.java"));
|
||||||
if ("threetenbp".equals(dateLibrary) && !usePlayWS) {
|
if ("threetenbp".equals(dateLibrary) && !usePlayWS) {
|
||||||
supportingFiles.add(new SupportingFile("CustomInstantDeserializer.mustache", invokerFolder, "CustomInstantDeserializer.java"));
|
supportingFiles.add(new SupportingFile("CustomInstantDeserializer.mustache", invokerFolder, "CustomInstantDeserializer.java"));
|
||||||
@ -500,7 +506,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
}
|
}
|
||||||
|
|
||||||
// google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer)
|
// google-api-client doesn't use the OpenAPI auth, because it uses Google Credential directly (HttpRequestInitializer)
|
||||||
if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS)) && ProcessUtils.hasOAuthMethods(objs)) {
|
if ((!(GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || usePlayWS || NATIVE.equals(getLibrary()))) && ProcessUtils.hasOAuthMethods(objs)) {
|
||||||
supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java"));
|
supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java"));
|
||||||
supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java"));
|
supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java"));
|
||||||
}
|
}
|
||||||
|
306
modules/openapi-generator/src/main/resources/Java/libraries/native/ApiClient.mustache
vendored
Normal file
306
modules/openapi-generator/src/main/resources/Java/libraries/native/ApiClient.mustache
vendored
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
{{>licenseInfo}}
|
||||||
|
package {{invokerPackage}};
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration and utility class for API clients.
|
||||||
|
*
|
||||||
|
* <p>This class can be constructed and modified, then used to instantiate the
|
||||||
|
* various API classes. The API classes use the settings in this class to
|
||||||
|
* configure themselves, but otherwise do not store a link to this class.</p>
|
||||||
|
*
|
||||||
|
* <p>This class is mutable and not synchronized, so it is not thread-safe.
|
||||||
|
* The API classes generated from this are immutable and thread-safe.</p>
|
||||||
|
*
|
||||||
|
* <p>The setter methods of this class return the current object to facilitate
|
||||||
|
* a fluent style of configuration.</p>
|
||||||
|
*/
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
public class ApiClient {
|
||||||
|
|
||||||
|
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||||
|
|
||||||
|
private HttpClient.Builder builder;
|
||||||
|
private ObjectMapper mapper;
|
||||||
|
private String scheme;
|
||||||
|
private String host;
|
||||||
|
private int port;
|
||||||
|
private String basePath;
|
||||||
|
private Consumer<HttpRequest.Builder> interceptor;
|
||||||
|
private Duration readTimeout;
|
||||||
|
|
||||||
|
private static String valueToString(Object value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL encode a string in the UTF-8 encoding.
|
||||||
|
*
|
||||||
|
* @param s String to encode.
|
||||||
|
* @return URL-encoded representation of the input string.
|
||||||
|
*/
|
||||||
|
public static String urlEncode(String s) {
|
||||||
|
return URLEncoder.encode(s, UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a URL query name/value parameter to a list of encoded {@link Pair}
|
||||||
|
* objects.
|
||||||
|
*
|
||||||
|
* <p>The value can be null, in which case an empty list is returned.</p>
|
||||||
|
*
|
||||||
|
* @param name The query name parameter.
|
||||||
|
* @param value The query value, which may not be a collection but may be
|
||||||
|
* null.
|
||||||
|
* @return A singleton list of the {@link Pair} objects representing the input
|
||||||
|
* parameters, which is encoded for use in a URL. If the value is null, an
|
||||||
|
* empty list is returned.
|
||||||
|
*/
|
||||||
|
public static List<Pair> parameterToPairs(String name, Object value) {
|
||||||
|
if (name == null || name.isEmpty() || value == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return Collections.singletonList(new Pair(urlEncode(name), urlEncode(value.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a URL query name/collection parameter to a list of encoded
|
||||||
|
* {@link Pair} objects.
|
||||||
|
*
|
||||||
|
* @param collectionFormat The swagger collectionFormat string (csv, tsv, etc).
|
||||||
|
* @param name The query name parameter.
|
||||||
|
* @param values A collection of values for the given query name, which may be
|
||||||
|
* null.
|
||||||
|
* @return A list of {@link Pair} objects representing the input parameters,
|
||||||
|
* which is encoded for use in a URL. If the values collection is null, an
|
||||||
|
* empty list is returned.
|
||||||
|
*/
|
||||||
|
public static List<Pair> parameterToPairs(
|
||||||
|
String collectionFormat, String name, Collection<?> values) {
|
||||||
|
if (name == null || name.isEmpty() || values == null || values.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the collection format (default: csv)
|
||||||
|
String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat;
|
||||||
|
|
||||||
|
// create the params based on the collection format
|
||||||
|
if ("multi".equals(format)) {
|
||||||
|
return values.stream()
|
||||||
|
.map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value))))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
String delimiter;
|
||||||
|
switch(format) {
|
||||||
|
case "csv":
|
||||||
|
delimiter = urlEncode(",");
|
||||||
|
break;
|
||||||
|
case "ssv":
|
||||||
|
delimiter = urlEncode(" ");
|
||||||
|
break;
|
||||||
|
case "tsv":
|
||||||
|
delimiter = urlEncode("\t");
|
||||||
|
break;
|
||||||
|
case "pipes":
|
||||||
|
delimiter = urlEncode("|");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Illegal collection format: " + collectionFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringJoiner joiner = new StringJoiner(delimiter);
|
||||||
|
for (Object value : values) {
|
||||||
|
joiner.add(urlEncode(valueToString(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Collections.singletonList(new Pair(urlEncode(name), joiner.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor.
|
||||||
|
*/
|
||||||
|
public ApiClient() {
|
||||||
|
builder = HttpClient.newBuilder();
|
||||||
|
mapper = new ObjectMapper();
|
||||||
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
||||||
|
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.registerModule(new JavaTimeModule());
|
||||||
|
URI baseURI = URI.create("{{{basePath}}}");
|
||||||
|
scheme = baseURI.getScheme();
|
||||||
|
host = baseURI.getHost();
|
||||||
|
port = baseURI.getPort();
|
||||||
|
basePath = baseURI.getRawPath();
|
||||||
|
interceptor = null;
|
||||||
|
readTimeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom {@link HttpClient.Builder} object to use when creating the
|
||||||
|
* {@link HttpClient} that is used by the API client.
|
||||||
|
*
|
||||||
|
* @param builder Custom client builder.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setHttpClientBuilder(HttpClient.Builder builder) {
|
||||||
|
this.builder = builder;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an {@link HttpClient} based on the current {@link HttpClient.Builder}.
|
||||||
|
*
|
||||||
|
* <p>The returned object is immutable and thread-safe.</p>
|
||||||
|
*
|
||||||
|
* @return The HTTP client.
|
||||||
|
*/
|
||||||
|
public HttpClient getHttpClient() {
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom {@link ObjectMapper} to serialize and deserialize the request
|
||||||
|
* and response bodies.
|
||||||
|
*
|
||||||
|
* @param mapper Custom object mapper.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setObjectMapper(ObjectMapper mapper) {
|
||||||
|
this.mapper = mapper;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a copy of the current {@link ObjectMapper}.
|
||||||
|
*
|
||||||
|
* @return A copy of the current object mapper.
|
||||||
|
*/
|
||||||
|
public ObjectMapper getObjectMapper() {
|
||||||
|
return mapper.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom host name for the target service.
|
||||||
|
*
|
||||||
|
* @param host The host name of the target service.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom port number for the target service.
|
||||||
|
*
|
||||||
|
* @param port The port of the target service. Set this to -1 to reset the
|
||||||
|
* value to the default for the scheme.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setPort(int port) {
|
||||||
|
this.port = port;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom base path for the target service, for example '/v2'.
|
||||||
|
*
|
||||||
|
* @param basePath The base path against which the rest of the path is
|
||||||
|
* resolved.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setBasePath(String basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the base URI to resolve the endpoint paths against.
|
||||||
|
*
|
||||||
|
* @return The complete base URI that the rest of the API parameters are
|
||||||
|
* resolved against.
|
||||||
|
*/
|
||||||
|
public String getBaseUri() {
|
||||||
|
return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom request interceptor.
|
||||||
|
*
|
||||||
|
* <p>A request interceptor is a mechanism for altering each request before it
|
||||||
|
* is sent. After the request has been fully configured but not yet built, the
|
||||||
|
* request builder is passed into this function for further modification,
|
||||||
|
* after which it is sent out.</p>
|
||||||
|
*
|
||||||
|
* <p>This is useful for altering the requests in a custom manner, such as
|
||||||
|
* adding headers. It could also be used for logging and monitoring.</p>
|
||||||
|
*
|
||||||
|
* @param interceptor A function invoked before creating each request. A value
|
||||||
|
* of null resets the interceptor to a no-op.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setRequestInterceptor(Consumer<HttpRequest.Builder> interceptor) {
|
||||||
|
this.interceptor = interceptor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom interceptor.
|
||||||
|
*
|
||||||
|
* @return The custom interceptor that was set, or null if there isn't any.
|
||||||
|
*/
|
||||||
|
public Consumer<HttpRequest.Builder> getRequestInterceptor() {
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the read timeout for the http client.
|
||||||
|
*
|
||||||
|
* <p>This is the value used by default for each request, though it can be
|
||||||
|
* overridden on a per-request basis with a request interceptor.</p>
|
||||||
|
*
|
||||||
|
* @param readTimeout The read timeout used by default by the http client.
|
||||||
|
* Setting this value to null resets the timeout to an
|
||||||
|
* effectively infinite value.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setReadTimeout(Duration readTimeout) {
|
||||||
|
this.readTimeout = readTimeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the read timeout that was set.
|
||||||
|
*
|
||||||
|
* @return The read timeout, or null if no timeout was set. Null represents
|
||||||
|
* an infinite wait time.
|
||||||
|
*/
|
||||||
|
public Duration getReadTimeout() {
|
||||||
|
return readTimeout;
|
||||||
|
}
|
||||||
|
}
|
161
modules/openapi-generator/src/main/resources/Java/libraries/native/README.mustache
vendored
Normal file
161
modules/openapi-generator/src/main/resources/Java/libraries/native/README.mustache
vendored
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
# {{artifactId}}
|
||||||
|
|
||||||
|
{{appName}}
|
||||||
|
|
||||||
|
- API version: {{appVersion}}
|
||||||
|
{{^hideGenerationTimestamp}}
|
||||||
|
|
||||||
|
- Build date: {{generatedDate}}
|
||||||
|
{{/hideGenerationTimestamp}}
|
||||||
|
|
||||||
|
{{#appDescription}}{{{appDescription}}}{{/appDescription}}
|
||||||
|
|
||||||
|
{{#infoUrl}}
|
||||||
|
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||||
|
{{/infoUrl}}
|
||||||
|
|
||||||
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Building the API client library requires:
|
||||||
|
|
||||||
|
1. Java 11+
|
||||||
|
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>{{{groupId}}}</groupId>
|
||||||
|
<artifactId>{{{artifactId}}}</artifactId>
|
||||||
|
<version>{{{artifactVersion}}}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gradle users
|
||||||
|
|
||||||
|
Add this dependency to your project's build file:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Others
|
||||||
|
|
||||||
|
At first generate the JAR by executing:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean package
|
||||||
|
```
|
||||||
|
|
||||||
|
Then manually install the following JARs:
|
||||||
|
|
||||||
|
- `target/{{{artifactId}}}-{{{artifactVersion}}}.jar`
|
||||||
|
- `target/lib/*.jar`
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||||
|
|
||||||
|
```java
|
||||||
|
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||||
|
import {{{invokerPackage}}}.*;
|
||||||
|
import {{{modelPackage}}}.*;
|
||||||
|
import {{{package}}}.{{{classname}}};
|
||||||
|
|
||||||
|
public class {{{classname}}}Example {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
// Configure clients using the `defaultClient` object, such as
|
||||||
|
// overriding the host and port, timeout, etc.
|
||||||
|
{{{classname}}} apiInstance = new {{{classname}}}(defaultClient);
|
||||||
|
{{#allParams}}
|
||||||
|
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||||
|
{{/allParams}}
|
||||||
|
try {
|
||||||
|
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||||
|
System.out.println(result);{{/returnType}}
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *{{basePath}}*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||||
|
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||||
|
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
|
||||||
|
{{/model}}{{/models}}
|
||||||
|
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
{{^authMethods}}All endpoints do not require authorization.
|
||||||
|
{{/authMethods}}Authentication schemes defined for the API:
|
||||||
|
{{#authMethods}}### {{name}}
|
||||||
|
|
||||||
|
{{#isApiKey}}
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: {{keyParamName}}
|
||||||
|
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||||
|
{{/isApiKey}}
|
||||||
|
{{#isBasic}}
|
||||||
|
|
||||||
|
- **Type**: HTTP basic authentication
|
||||||
|
{{/isBasic}}
|
||||||
|
{{#isOAuth}}
|
||||||
|
|
||||||
|
- **Type**: OAuth
|
||||||
|
- **Flow**: {{flow}}
|
||||||
|
- **Authorization URL**: {{authorizationUrl}}
|
||||||
|
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||||
|
{{#scopes}} - {{scope}}: {{description}}
|
||||||
|
{{/scopes}}
|
||||||
|
{{/isOAuth}}
|
||||||
|
|
||||||
|
{{/authMethods}}
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||||
|
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
157
modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache
vendored
Normal file
157
modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache
vendored
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
{{>licenseInfo}}
|
||||||
|
package {{package}};
|
||||||
|
|
||||||
|
import {{invokerPackage}}.ApiClient;
|
||||||
|
import {{invokerPackage}}.ApiException;
|
||||||
|
import {{invokerPackage}}.Pair;
|
||||||
|
|
||||||
|
{{#imports}}
|
||||||
|
import {{import}};
|
||||||
|
{{/imports}}
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
{{^fullJavaUtil}}
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
{{/fullJavaUtil}}
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
{{#operations}}
|
||||||
|
public class {{classname}} {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public {{classname}}() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public {{classname}}(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#operation}}
|
||||||
|
/**
|
||||||
|
* {{summary}}
|
||||||
|
* {{notes}}
|
||||||
|
{{#allParams}}
|
||||||
|
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
|
{{#returnType}}
|
||||||
|
* @return {{returnType}}
|
||||||
|
{{/returnType}}
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
{{#isDeprecated}}
|
||||||
|
* @deprecated
|
||||||
|
{{/isDeprecated}}
|
||||||
|
{{#externalDocs}}
|
||||||
|
* {{description}}
|
||||||
|
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||||
|
{{/externalDocs}}
|
||||||
|
*/
|
||||||
|
{{#isDeprecated}}
|
||||||
|
@Deprecated
|
||||||
|
{{/isDeprecated}}
|
||||||
|
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException {
|
||||||
|
{{#allParams}}
|
||||||
|
{{#required}}
|
||||||
|
// verify the required parameter '{{paramName}}' is set
|
||||||
|
if ({{paramName}} == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}");
|
||||||
|
}
|
||||||
|
{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
{{! Switch delimiters for baseName so we can write constants like "{query}" }}
|
||||||
|
String localVarPath = "{{{path}}}"{{#pathParams}}
|
||||||
|
.replace({{=<% %>=}}"{<%baseName%>}"<%={{ }}=%>, ApiClient.urlEncode({{{paramName}}}.toString())){{/pathParams}};
|
||||||
|
|
||||||
|
{{#hasQueryParams}}
|
||||||
|
{{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<>();
|
||||||
|
{{#queryParams}}
|
||||||
|
{{#collectionFormat}}
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("{{{collectionFormat}}}", "{{baseName}}", {{paramName}}));
|
||||||
|
{{/collectionFormat}}
|
||||||
|
{{^collectionFormat}}
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("{{baseName}}", {{paramName}}));
|
||||||
|
{{/collectionFormat}}
|
||||||
|
{{/queryParams}}
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
{{javaUtilPrefix}}StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
{{/hasQueryParams}}
|
||||||
|
{{^hasQueryParams}}
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
{{/hasQueryParams}}
|
||||||
|
|
||||||
|
{{#headerParams}}
|
||||||
|
if ({{paramName}} != null) {
|
||||||
|
localVarRequestBuilder.header("{{baseName}}", {{paramName}}.toString());
|
||||||
|
}
|
||||||
|
{{/headerParams}}
|
||||||
|
{{#bodyParam}}
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
{{/bodyParam}}
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
{{#bodyParam}}
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes({{paramName}});
|
||||||
|
localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
{{/bodyParam}}
|
||||||
|
{{^bodyParam}}
|
||||||
|
localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.noBody());
|
||||||
|
{{/bodyParam}}
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"{{operationId}} call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#returnType}}
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {});
|
||||||
|
{{/returnType}}
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
|
{{/operations}}
|
79
modules/openapi-generator/src/main/resources/Java/libraries/native/apiException.mustache
vendored
Normal file
79
modules/openapi-generator/src/main/resources/Java/libraries/native/apiException.mustache
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
{{>licenseInfo}}
|
||||||
|
|
||||||
|
package {{invokerPackage}};
|
||||||
|
|
||||||
|
import java.net.http.HttpHeaders;
|
||||||
|
|
||||||
|
{{>generatedAnnotation}}
|
||||||
|
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||||
|
private int code = 0;
|
||||||
|
private HttpHeaders 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, HttpHeaders responseHeaders, String responseBody) {
|
||||||
|
super(message, throwable);
|
||||||
|
this.code = code;
|
||||||
|
this.responseHeaders = responseHeaders;
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) {
|
||||||
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) {
|
||||||
|
this(message, throwable, code, responseHeaders, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, HttpHeaders 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, HttpHeaders 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 Headers as an HttpHeaders object
|
||||||
|
*/
|
||||||
|
public HttpHeaders getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP response body.
|
||||||
|
*
|
||||||
|
* @return Response body in the form of string
|
||||||
|
*/
|
||||||
|
public String getResponseBody() {
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
|
}
|
66
modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache
vendored
Normal file
66
modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
group = '{{groupId}}'
|
||||||
|
version = '{{artifactVersion}}'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = '{{artifactId}}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.22"
|
||||||
|
jackson_version = "2.9.9"
|
||||||
|
junit_version = "4.12"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||||
|
compile "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
|
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.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
|
testCompile "junit:junit:$junit_version"
|
||||||
|
}
|
Binary file not shown.
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
100
modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.bat.mustache
vendored
Normal file
100
modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.bat.mustache
vendored
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@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="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
: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=%*
|
||||||
|
|
||||||
|
: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
|
188
modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.mustache
vendored
Executable file
188
modules/openapi-generator/src/main/resources/Java/libraries/native/gradlew.mustache
vendored
Executable file
@ -0,0 +1,188 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# 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
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
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" -a "$nonstop" = "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
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
215
modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache
vendored
Normal file
215
modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache
vendored
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
<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>
|
||||||
|
{{#parentOverridden}}
|
||||||
|
<parent>
|
||||||
|
<groupId>{{{parentGroupId}}}</groupId>
|
||||||
|
<artifactId>{{{parentArtifactId}}}</artifactId>
|
||||||
|
<version>{{{parentVersion}}}</version>
|
||||||
|
</parent>
|
||||||
|
{{/parentOverridden}}
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
|
<version>3.0.0-M1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>enforce-maven</id>
|
||||||
|
<goals>
|
||||||
|
<goal>enforce</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<requireMavenVersion>
|
||||||
|
<version>3</version>
|
||||||
|
</requireMavenVersion>
|
||||||
|
<requireJavaVersion>
|
||||||
|
<version>11</version>
|
||||||
|
</requireJavaVersion>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.0.0-M3</version>
|
||||||
|
<configuration>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<loggerPath>conf/log4j.properties</loggerPath>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<threadCount>10</threadCount>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- attach test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.1.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON processing: jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- @Nullable annotation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>3.0.2</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.22</swagger-annotations-version>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<jackson-version>2.9.9</jackson-version>
|
||||||
|
<junit-version>4.12</junit-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
16
modules/openapi-generator/src/main/resources/Java/libraries/native/travis.mustache
vendored
Normal file
16
modules/openapi-generator/src/main/resources/Java/libraries/native/travis.mustache
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Generated by: https://openapi-generator.tech
|
||||||
|
#
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- oraclejdk11
|
||||||
|
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
|
21
samples/client/petstore/java/native/.gitignore
vendored
Normal file
21
samples/client/petstore/java/native/.gitignore
vendored
Normal 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
|
@ -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
|
@ -0,0 +1 @@
|
|||||||
|
4.1.0-SNAPSHOT
|
16
samples/client/petstore/java/native/.travis.yml
Normal file
16
samples/client/petstore/java/native/.travis.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Generated by: https://openapi-generator.tech
|
||||||
|
#
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- oraclejdk11
|
||||||
|
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
|
235
samples/client/petstore/java/native/README.md
Normal file
235
samples/client/petstore/java/native/README.md
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
# petstore-native
|
||||||
|
|
||||||
|
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 11+
|
||||||
|
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-native</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-native:1.0.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Others
|
||||||
|
|
||||||
|
At first generate the JAR by executing:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean package
|
||||||
|
```
|
||||||
|
|
||||||
|
Then manually install the following JARs:
|
||||||
|
|
||||||
|
- `target/petstore-native-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.model.*;
|
||||||
|
import org.openapitools.client.api.AnotherFakeApi;
|
||||||
|
|
||||||
|
public class AnotherFakeApiExample {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
// Configure clients using the `defaultClient` object, such as
|
||||||
|
// overriding the host and port, timeout, etc.
|
||||||
|
AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
|
||||||
|
Client body = new Client(); // Client | client model
|
||||||
|
try {
|
||||||
|
Client result = apiInstance.call123testSpecialTags(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
|
*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem
|
||||||
|
*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* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
|
||||||
|
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
|
||||||
|
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" 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* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
|
||||||
|
*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
|
||||||
|
|
||||||
|
- [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md)
|
||||||
|
- [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md)
|
||||||
|
- [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md)
|
||||||
|
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||||
|
- [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md)
|
||||||
|
- [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md)
|
||||||
|
- [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
|
||||||
|
- [AdditionalPropertiesString](docs/AdditionalPropertiesString.md)
|
||||||
|
- [Animal](docs/Animal.md)
|
||||||
|
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
|
- [Capitalization](docs/Capitalization.md)
|
||||||
|
- [Cat](docs/Cat.md)
|
||||||
|
- [CatAllOf](docs/CatAllOf.md)
|
||||||
|
- [Category](docs/Category.md)
|
||||||
|
- [ClassModel](docs/ClassModel.md)
|
||||||
|
- [Client](docs/Client.md)
|
||||||
|
- [Dog](docs/Dog.md)
|
||||||
|
- [DogAllOf](docs/DogAllOf.md)
|
||||||
|
- [EnumArrays](docs/EnumArrays.md)
|
||||||
|
- [EnumClass](docs/EnumClass.md)
|
||||||
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [FileSchemaTestClass](docs/FileSchemaTestClass.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)
|
||||||
|
- [Tag](docs/Tag.md)
|
||||||
|
- [TypeHolderDefault](docs/TypeHolderDefault.md)
|
||||||
|
- [TypeHolderExample](docs/TypeHolderExample.md)
|
||||||
|
- [User](docs/User.md)
|
||||||
|
- [XmlItem](docs/XmlItem.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.
|
||||||
|
However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
66
samples/client/petstore/java/native/build.gradle
Normal file
66
samples/client/petstore/java/native/build.gradle
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
group = 'org.openapitools'
|
||||||
|
version = '1.0.0'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
|
||||||
|
install {
|
||||||
|
repositories.mavenInstaller {
|
||||||
|
pom.artifactId = 'petstore-native'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.22"
|
||||||
|
jackson_version = "2.9.9"
|
||||||
|
junit_version = "4.12"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||||
|
compile "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
|
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.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
|
testCompile "junit:junit:$junit_version"
|
||||||
|
}
|
0
samples/client/petstore/java/native/build.sbt
Normal file
0
samples/client/petstore/java/native/build.sbt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesAnyType
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesArray
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesBoolean
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**mapString** | **Map<String, String>** | | [optional]
|
||||||
|
**mapNumber** | [**Map<String, BigDecimal>**](BigDecimal.md) | | [optional]
|
||||||
|
**mapInteger** | **Map<String, Integer>** | | [optional]
|
||||||
|
**mapBoolean** | **Map<String, Boolean>** | | [optional]
|
||||||
|
**mapArrayInteger** | [**Map<String, List<Integer>>**](List.md) | | [optional]
|
||||||
|
**mapArrayAnytype** | [**Map<String, List<Object>>**](List.md) | | [optional]
|
||||||
|
**mapMapString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
|
||||||
|
**mapMapAnytype** | [**Map<String, Map<String, Object>>**](Map.md) | | [optional]
|
||||||
|
**anytype1** | [**Object**](.md) | | [optional]
|
||||||
|
**anytype2** | [**Object**](.md) | | [optional]
|
||||||
|
**anytype3** | [**Object**](.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesInteger
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesNumber
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesObject
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# AdditionalPropertiesString
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
13
samples/client/petstore/java/native/docs/Animal.md
Normal file
13
samples/client/petstore/java/native/docs/Animal.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Animal
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**className** | **String** | |
|
||||||
|
**color** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
74
samples/client/petstore/java/native/docs/AnotherFakeApi.md
Normal file
74
samples/client/petstore/java/native/docs/AnotherFakeApi.md
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# AnotherFakeApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## call123testSpecialTags
|
||||||
|
|
||||||
|
> Client call123testSpecialTags(body)
|
||||||
|
|
||||||
|
To test special tags
|
||||||
|
|
||||||
|
To test special tags and operation ID starting with number
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.AnotherFakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
|
||||||
|
Client body = new Client(); // Client | client model
|
||||||
|
try {
|
||||||
|
Client result = apiInstance.call123testSpecialTags(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**Client**](Client.md)| client model |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Client**](Client.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ArrayOfArrayOfNumberOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ArrayOfNumberOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
14
samples/client/petstore/java/native/docs/ArrayTest.md
Normal file
14
samples/client/petstore/java/native/docs/ArrayTest.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ArrayTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**arrayOfString** | **List<String>** | | [optional]
|
||||||
|
**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional]
|
||||||
|
**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
17
samples/client/petstore/java/native/docs/Capitalization.md
Normal file
17
samples/client/petstore/java/native/docs/Capitalization.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 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]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/Cat.md
Normal file
12
samples/client/petstore/java/native/docs/Cat.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Cat
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**declawed** | **Boolean** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/CatAllOf.md
Normal file
12
samples/client/petstore/java/native/docs/CatAllOf.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# CatAllOf
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**declawed** | **Boolean** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
13
samples/client/petstore/java/native/docs/Category.md
Normal file
13
samples/client/petstore/java/native/docs/Category.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Category
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **Long** | | [optional]
|
||||||
|
**name** | **String** | |
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/ClassModel.md
Normal file
12
samples/client/petstore/java/native/docs/ClassModel.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ClassModel
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**propertyClass** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/Client.md
Normal file
12
samples/client/petstore/java/native/docs/Client.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Client
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**client** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/Dog.md
Normal file
12
samples/client/petstore/java/native/docs/Dog.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Dog
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**breed** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/DogAllOf.md
Normal file
12
samples/client/petstore/java/native/docs/DogAllOf.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# DogAllOf
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**breed** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
31
samples/client/petstore/java/native/docs/EnumArrays.md
Normal file
31
samples/client/petstore/java/native/docs/EnumArrays.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# EnumArrays
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional]
|
||||||
|
**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: JustSymbolEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
GREATER_THAN_OR_EQUAL_TO | ">="
|
||||||
|
DOLLAR | "$"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: List<ArrayEnumEnum>
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
FISH | "fish"
|
||||||
|
CRAB | "crab"
|
||||||
|
|
||||||
|
|
||||||
|
|
15
samples/client/petstore/java/native/docs/EnumClass.md
Normal file
15
samples/client/petstore/java/native/docs/EnumClass.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# EnumClass
|
||||||
|
|
||||||
|
## Enum
|
||||||
|
|
||||||
|
|
||||||
|
* `_ABC` (value: `"_abc"`)
|
||||||
|
|
||||||
|
* `_EFG` (value: `"-efg"`)
|
||||||
|
|
||||||
|
* `_XYZ_` (value: `"(xyz)"`)
|
||||||
|
|
||||||
|
|
||||||
|
|
54
samples/client/petstore/java/native/docs/EnumTest.md
Normal file
54
samples/client/petstore/java/native/docs/EnumTest.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 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]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: EnumStringEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
UPPER | "UPPER"
|
||||||
|
LOWER | "lower"
|
||||||
|
EMPTY | ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: EnumStringRequiredEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
UPPER | "UPPER"
|
||||||
|
LOWER | "lower"
|
||||||
|
EMPTY | ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: EnumIntegerEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
NUMBER_1 | 1
|
||||||
|
NUMBER_MINUS_1 | -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: EnumNumberEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
NUMBER_1_DOT_1 | 1.1
|
||||||
|
NUMBER_MINUS_1_DOT_2 | -1.2
|
||||||
|
|
||||||
|
|
||||||
|
|
914
samples/client/petstore/java/native/docs/FakeApi.md
Normal file
914
samples/client/petstore/java/native/docs/FakeApi.md
Normal file
@ -0,0 +1,914 @@
|
|||||||
|
# FakeApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem
|
||||||
|
[**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 |
|
||||||
|
[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
|
||||||
|
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
|
||||||
|
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||||
|
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||||
|
[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
|
||||||
|
[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||||
|
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## createXmlItem
|
||||||
|
|
||||||
|
> createXmlItem(xmlItem)
|
||||||
|
|
||||||
|
creates an XmlItem
|
||||||
|
|
||||||
|
this route creates an XmlItem
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body
|
||||||
|
try {
|
||||||
|
apiInstance.createXmlItem(xmlItem);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#createXmlItem");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## fakeOuterBooleanSerialize
|
||||||
|
|
||||||
|
> Boolean fakeOuterBooleanSerialize(body)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of outer boolean types
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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**: */*
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Output boolean | - |
|
||||||
|
|
||||||
|
|
||||||
|
## fakeOuterCompositeSerialize
|
||||||
|
|
||||||
|
> OuterComposite fakeOuterCompositeSerialize(body)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of object with outer number type
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body
|
||||||
|
try {
|
||||||
|
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**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**: */*
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Output composite | - |
|
||||||
|
|
||||||
|
|
||||||
|
## fakeOuterNumberSerialize
|
||||||
|
|
||||||
|
> BigDecimal fakeOuterNumberSerialize(body)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of outer number types
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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**: */*
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Output number | - |
|
||||||
|
|
||||||
|
|
||||||
|
## fakeOuterStringSerialize
|
||||||
|
|
||||||
|
> String fakeOuterStringSerialize(body)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Test serialization of outer string types
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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**: */*
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Output string | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testBodyWithFileSchema
|
||||||
|
|
||||||
|
> testBodyWithFileSchema(body)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
For this test, the body for this request much reference a schema named `File`.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass |
|
||||||
|
try {
|
||||||
|
apiInstance.testBodyWithFileSchema(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#testBodyWithFileSchema");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Success | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testBodyWithQueryParams
|
||||||
|
|
||||||
|
> testBodyWithQueryParams(query, body)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
String query = "query_example"; // String |
|
||||||
|
User body = new User(); // User |
|
||||||
|
try {
|
||||||
|
apiInstance.testBodyWithQueryParams(query, body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#testBodyWithQueryParams");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**query** | **String**| |
|
||||||
|
**body** | [**User**](User.md)| |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Success | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testClientModel
|
||||||
|
|
||||||
|
> Client testClientModel(body)
|
||||||
|
|
||||||
|
To test \"client\" model
|
||||||
|
|
||||||
|
To test \"client\" model
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
Client body = new Client(); // Client | client model
|
||||||
|
try {
|
||||||
|
Client result = apiInstance.testClientModel(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#testClientModel");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**Client**](Client.md)| client model |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**Client**](Client.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## 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.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||||
|
Double _double = 3.4D; // Double | None
|
||||||
|
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||||
|
byte[] _byte = null; // byte[] | None
|
||||||
|
Integer integer = 56; // Integer | None
|
||||||
|
Integer int32 = 56; // Integer | None
|
||||||
|
Long int64 = 56L; // Long | None
|
||||||
|
Float _float = 3.4F; // Float | None
|
||||||
|
String string = "string_example"; // String | None
|
||||||
|
File binary = new File("/path/to/file"); // File | None
|
||||||
|
LocalDate date = new LocalDate(); // LocalDate | None
|
||||||
|
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||||
|
String password = "password_example"; // String | None
|
||||||
|
String paramCallback = "paramCallback_example"; // 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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**number** | **BigDecimal**| None |
|
||||||
|
**_double** | **Double**| None |
|
||||||
|
**patternWithoutDelimiter** | **String**| None |
|
||||||
|
**_byte** | **byte[]**| None |
|
||||||
|
**integer** | **Integer**| None | [optional]
|
||||||
|
**int32** | **Integer**| None | [optional]
|
||||||
|
**int64** | **Long**| None | [optional]
|
||||||
|
**_float** | **Float**| None | [optional]
|
||||||
|
**string** | **String**| None | [optional]
|
||||||
|
**binary** | **File**| None | [optional]
|
||||||
|
**date** | **LocalDate**| None | [optional]
|
||||||
|
**dateTime** | **OffsetDateTime**| None | [optional]
|
||||||
|
**password** | **String**| None | [optional]
|
||||||
|
**paramCallback** | **String**| None | [optional]
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **400** | Invalid username supplied | - |
|
||||||
|
| **404** | User not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## 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.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
List<String> enumHeaderStringArray = Arrays.asList("$"); // List<String> | Header parameter enum test (string array)
|
||||||
|
String enumHeaderString = "-efg"; // String | Header parameter enum test (string)
|
||||||
|
List<String> enumQueryStringArray = Arrays.asList("$"); // 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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**enumHeaderStringArray** | [**List<String>**](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<String>**](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<String>**](String.md)| Form parameter enum test (string array) | [optional] [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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **400** | Invalid request | - |
|
||||||
|
| **404** | Not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testGroupParameters
|
||||||
|
|
||||||
|
> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group)
|
||||||
|
|
||||||
|
Fake endpoint to test group parameters (optional)
|
||||||
|
|
||||||
|
Fake endpoint to test group parameters (optional)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
Integer requiredStringGroup = 56; // Integer | Required String in group parameters
|
||||||
|
Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters
|
||||||
|
Long requiredInt64Group = 56L; // Long | Required Integer in group parameters
|
||||||
|
Integer stringGroup = 56; // Integer | String in group parameters
|
||||||
|
Boolean booleanGroup = true; // Boolean | Boolean in group parameters
|
||||||
|
Long int64Group = 56L; // Long | Integer in group parameters
|
||||||
|
try {
|
||||||
|
apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#testGroupParameters");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**requiredStringGroup** | **Integer**| Required String in group parameters |
|
||||||
|
**requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters |
|
||||||
|
**requiredInt64Group** | **Long**| Required Integer in group parameters |
|
||||||
|
**stringGroup** | **Integer**| String in group parameters | [optional]
|
||||||
|
**booleanGroup** | **Boolean**| Boolean in group parameters | [optional]
|
||||||
|
**int64Group** | **Long**| Integer in group parameters | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **400** | Someting wrong | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testInlineAdditionalProperties
|
||||||
|
|
||||||
|
> testInlineAdditionalProperties(param)
|
||||||
|
|
||||||
|
test inline additionalProperties
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
Map<String, String> param = new HashMap(); // Map<String, String> | request body
|
||||||
|
try {
|
||||||
|
apiInstance.testInlineAdditionalProperties(param);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**param** | [**Map<String, String>**](String.md)| request body |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testJsonFormData
|
||||||
|
|
||||||
|
> testJsonFormData(param, param2)
|
||||||
|
|
||||||
|
test json serialization of 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.models.*;
|
||||||
|
import org.openapitools.client.api.FakeApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||||
|
String param = "param_example"; // String | field1
|
||||||
|
String param2 = "param2_example"; // String | field2
|
||||||
|
try {
|
||||||
|
apiInstance.testJsonFormData(param, param2);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeApi#testJsonFormData");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**param** | **String**| field1 |
|
||||||
|
**param2** | **String**| field2 |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
null (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/x-www-form-urlencoded
|
||||||
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
@ -0,0 +1,81 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## testClassname
|
||||||
|
|
||||||
|
> Client testClassname(body)
|
||||||
|
|
||||||
|
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.models.*;
|
||||||
|
import org.openapitools.client.api.FakeClassnameTags123Api;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
Client body = new Client(); // Client | client model
|
||||||
|
try {
|
||||||
|
Client result = apiInstance.testClassname(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling FakeClassnameTags123Api#testClassname");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# FileSchemaTestClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**file** | [**java.io.File**](java.io.File.md) | | [optional]
|
||||||
|
**files** | [**List<java.io.File>**](java.io.File.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
24
samples/client/petstore/java/native/docs/FormatTest.md
Normal file
24
samples/client/petstore/java/native/docs/FormatTest.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 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** | |
|
||||||
|
|
||||||
|
|
||||||
|
|
13
samples/client/petstore/java/native/docs/HasOnlyReadOnly.md
Normal file
13
samples/client/petstore/java/native/docs/HasOnlyReadOnly.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# HasOnlyReadOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**bar** | **String** | | [optional]
|
||||||
|
**foo** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
24
samples/client/petstore/java/native/docs/MapTest.md
Normal file
24
samples/client/petstore/java/native/docs/MapTest.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# MapTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
|
||||||
|
**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional]
|
||||||
|
**directMap** | **Map<String, Boolean>** | | [optional]
|
||||||
|
**indirectMap** | **Map<String, Boolean>** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: Map<String, InnerEnum>
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
UPPER | "UPPER"
|
||||||
|
LOWER | "lower"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# MixedPropertiesAndAdditionalPropertiesClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**uuid** | [**UUID**](UUID.md) | | [optional]
|
||||||
|
**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional]
|
||||||
|
**map** | [**Map<String, Animal>**](Animal.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
13
samples/client/petstore/java/native/docs/Model200Response.md
Normal file
13
samples/client/petstore/java/native/docs/Model200Response.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Model200Response
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **Integer** | | [optional]
|
||||||
|
**propertyClass** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
14
samples/client/petstore/java/native/docs/ModelApiResponse.md
Normal file
14
samples/client/petstore/java/native/docs/ModelApiResponse.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ModelApiResponse
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**code** | **Integer** | | [optional]
|
||||||
|
**type** | **String** | | [optional]
|
||||||
|
**message** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/ModelReturn.md
Normal file
12
samples/client/petstore/java/native/docs/ModelReturn.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ModelReturn
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**_return** | **Integer** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
15
samples/client/petstore/java/native/docs/Name.md
Normal file
15
samples/client/petstore/java/native/docs/Name.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Name
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**name** | **Integer** | |
|
||||||
|
**snakeCase** | **Integer** | | [optional]
|
||||||
|
**property** | **String** | | [optional]
|
||||||
|
**_123number** | **Integer** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/NumberOnly.md
Normal file
12
samples/client/petstore/java/native/docs/NumberOnly.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# NumberOnly
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
27
samples/client/petstore/java/native/docs/Order.md
Normal file
27
samples/client/petstore/java/native/docs/Order.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 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]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: StatusEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
PLACED | "placed"
|
||||||
|
APPROVED | "approved"
|
||||||
|
DELIVERED | "delivered"
|
||||||
|
|
||||||
|
|
||||||
|
|
14
samples/client/petstore/java/native/docs/OuterComposite.md
Normal file
14
samples/client/petstore/java/native/docs/OuterComposite.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# OuterComposite
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
**myString** | **String** | | [optional]
|
||||||
|
**myBoolean** | **Boolean** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
15
samples/client/petstore/java/native/docs/OuterEnum.md
Normal file
15
samples/client/petstore/java/native/docs/OuterEnum.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# OuterEnum
|
||||||
|
|
||||||
|
## Enum
|
||||||
|
|
||||||
|
|
||||||
|
* `PLACED` (value: `"placed"`)
|
||||||
|
|
||||||
|
* `APPROVED` (value: `"approved"`)
|
||||||
|
|
||||||
|
* `DELIVERED` (value: `"delivered"`)
|
||||||
|
|
||||||
|
|
||||||
|
|
27
samples/client/petstore/java/native/docs/Pet.md
Normal file
27
samples/client/petstore/java/native/docs/Pet.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Pet
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **Long** | | [optional]
|
||||||
|
**category** | [**Category**](Category.md) | | [optional]
|
||||||
|
**name** | **String** | |
|
||||||
|
**photoUrls** | **List<String>** | |
|
||||||
|
**tags** | [**List<Tag>**](Tag.md) | | [optional]
|
||||||
|
**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: StatusEnum
|
||||||
|
|
||||||
|
Name | Value
|
||||||
|
---- | -----
|
||||||
|
AVAILABLE | "available"
|
||||||
|
PENDING | "pending"
|
||||||
|
SOLD | "sold"
|
||||||
|
|
||||||
|
|
||||||
|
|
656
samples/client/petstore/java/native/docs/PetApi.md
Normal file
656
samples/client/petstore/java/native/docs/PetApi.md
Normal file
@ -0,0 +1,656 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## addPet
|
||||||
|
|
||||||
|
> addPet(body)
|
||||||
|
|
||||||
|
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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||||
|
try {
|
||||||
|
apiInstance.addPet(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PetApi#addPet");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **405** | Invalid input | - |
|
||||||
|
|
||||||
|
|
||||||
|
## 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid pet value | - |
|
||||||
|
|
||||||
|
|
||||||
|
## findPetsByStatus
|
||||||
|
|
||||||
|
> List<Pet> 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
List<String> status = Arrays.asList("available"); // 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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**List<Pet>**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid status value | - |
|
||||||
|
|
||||||
|
|
||||||
|
## findPetsByTags
|
||||||
|
|
||||||
|
> List<Pet> 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
List<String> tags = Arrays.asList(); // 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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**tags** | [**List<String>**](String.md)| Tags to filter by |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**List<Pet>**](Pet.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid tag value | - |
|
||||||
|
|
||||||
|
|
||||||
|
## 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid ID supplied | - |
|
||||||
|
| **404** | Pet not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## updatePet
|
||||||
|
|
||||||
|
> updatePet(body)
|
||||||
|
|
||||||
|
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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||||
|
try {
|
||||||
|
apiInstance.updatePet(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PetApi#updatePet");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid ID supplied | - |
|
||||||
|
| **404** | Pet not found | - |
|
||||||
|
| **405** | Validation exception | - |
|
||||||
|
|
||||||
|
|
||||||
|
## 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
Long petId = 56L; // Long | ID of pet that needs to be updated
|
||||||
|
String name = "name_example"; // String | Updated name of the pet
|
||||||
|
String status = "status_example"; // String | Updated status of the pet
|
||||||
|
try {
|
||||||
|
apiInstance.updatePetWithForm(petId, name, status);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PetApi#updatePetWithForm");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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]
|
||||||
|
**status** | **String**| Updated status of the pet | [optional]
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **405** | Invalid input | - |
|
||||||
|
|
||||||
|
|
||||||
|
## 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
Long petId = 56L; // Long | ID of pet to update
|
||||||
|
String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server
|
||||||
|
File file = new File("/path/to/file"); // 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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**petId** | **Long**| ID of pet to update |
|
||||||
|
**additionalMetadata** | **String**| Additional data to pass to server | [optional]
|
||||||
|
**file** | **File**| file to upload | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ModelApiResponse**](ModelApiResponse.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## uploadFileWithRequiredFile
|
||||||
|
|
||||||
|
> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, 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.models.*;
|
||||||
|
import org.openapitools.client.api.PetApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
Long petId = 56L; // Long | ID of pet to update
|
||||||
|
File requiredFile = new File("/path/to/file"); // File | file to upload
|
||||||
|
String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server
|
||||||
|
try {
|
||||||
|
ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**petId** | **Long**| ID of pet to update |
|
||||||
|
**requiredFile** | **File**| file to upload |
|
||||||
|
**additionalMetadata** | **String**| Additional data to pass to server | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ModelApiResponse**](ModelApiResponse.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[petstore_auth](../README.md#petstore_auth)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: multipart/form-data
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
13
samples/client/petstore/java/native/docs/ReadOnlyFirst.md
Normal file
13
samples/client/petstore/java/native/docs/ReadOnlyFirst.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# ReadOnlyFirst
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**bar** | **String** | | [optional]
|
||||||
|
**baz** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
12
samples/client/petstore/java/native/docs/SpecialModelName.md
Normal file
12
samples/client/petstore/java/native/docs/SpecialModelName.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# SpecialModelName
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**$specialPropertyName** | **Long** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
276
samples/client/petstore/java/native/docs/StoreApi.md
Normal file
276
samples/client/petstore/java/native/docs/StoreApi.md
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## deleteOrder
|
||||||
|
|
||||||
|
> deleteOrder(orderId)
|
||||||
|
|
||||||
|
Delete purchase order by ID
|
||||||
|
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.StoreApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
StoreApi apiInstance = new StoreApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **400** | Invalid ID supplied | - |
|
||||||
|
| **404** | Order not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## getInventory
|
||||||
|
|
||||||
|
> Map<String, Integer> 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.models.*;
|
||||||
|
import org.openapitools.client.api.StoreApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
// 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(defaultClient);
|
||||||
|
try {
|
||||||
|
Map<String, Integer> result = apiInstance.getInventory();
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling StoreApi#getInventory");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**Map<String, Integer>**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[api_key](../README.md#api_key)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## getOrderById
|
||||||
|
|
||||||
|
> Order getOrderById(orderId)
|
||||||
|
|
||||||
|
Find purchase order by ID
|
||||||
|
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.StoreApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
StoreApi apiInstance = new StoreApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid ID supplied | - |
|
||||||
|
| **404** | Order not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## placeOrder
|
||||||
|
|
||||||
|
> Order placeOrder(body)
|
||||||
|
|
||||||
|
Place an order for 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.models.*;
|
||||||
|
import org.openapitools.client.api.StoreApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
StoreApi apiInstance = new StoreApi(defaultClient);
|
||||||
|
Order body = new Order(); // Order | order placed for purchasing the pet
|
||||||
|
try {
|
||||||
|
Order result = apiInstance.placeOrder(body);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling StoreApi#placeOrder");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid Order | - |
|
||||||
|
|
13
samples/client/petstore/java/native/docs/Tag.md
Normal file
13
samples/client/petstore/java/native/docs/Tag.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Tag
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **Long** | | [optional]
|
||||||
|
**name** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# TypeHolderDefault
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**stringItem** | **String** | |
|
||||||
|
**numberItem** | [**BigDecimal**](BigDecimal.md) | |
|
||||||
|
**integerItem** | **Integer** | |
|
||||||
|
**boolItem** | **Boolean** | |
|
||||||
|
**arrayItem** | **List<Integer>** | |
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# TypeHolderExample
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**stringItem** | **String** | |
|
||||||
|
**numberItem** | [**BigDecimal**](BigDecimal.md) | |
|
||||||
|
**integerItem** | **Integer** | |
|
||||||
|
**boolItem** | **Boolean** | |
|
||||||
|
**arrayItem** | **List<Integer>** | |
|
||||||
|
|
||||||
|
|
||||||
|
|
19
samples/client/petstore/java/native/docs/User.md
Normal file
19
samples/client/petstore/java/native/docs/User.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 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]
|
||||||
|
|
||||||
|
|
||||||
|
|
525
samples/client/petstore/java/native/docs/UserApi.md
Normal file
525
samples/client/petstore/java/native/docs/UserApi.md
Normal file
@ -0,0 +1,525 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## createUser
|
||||||
|
|
||||||
|
> createUser(body)
|
||||||
|
|
||||||
|
Create user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
User body = new User(); // User | Created user object
|
||||||
|
try {
|
||||||
|
apiInstance.createUser(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#createUser");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## createUsersWithArrayInput
|
||||||
|
|
||||||
|
> createUsersWithArrayInput(body)
|
||||||
|
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
List<User> body = Arrays.asList(null); // List<User> | List of user object
|
||||||
|
try {
|
||||||
|
apiInstance.createUsersWithArrayInput(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#createUsersWithArrayInput");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**List<User>**](User.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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## createUsersWithListInput
|
||||||
|
|
||||||
|
> createUsersWithListInput(body)
|
||||||
|
|
||||||
|
Creates list of users with given input array
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
List<User> body = Arrays.asList(null); // List<User> | List of user object
|
||||||
|
try {
|
||||||
|
apiInstance.createUsersWithListInput(body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#createUsersWithListInput");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**body** | [**List<User>**](User.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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## deleteUser
|
||||||
|
|
||||||
|
> deleteUser(username)
|
||||||
|
|
||||||
|
Delete user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **400** | Invalid username supplied | - |
|
||||||
|
| **404** | User not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## getUserByName
|
||||||
|
|
||||||
|
> User getUserByName(username)
|
||||||
|
|
||||||
|
Get user by user name
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | - |
|
||||||
|
| **400** | Invalid username supplied | - |
|
||||||
|
| **404** | User not found | - |
|
||||||
|
|
||||||
|
|
||||||
|
## loginUser
|
||||||
|
|
||||||
|
> String loginUser(username, password)
|
||||||
|
|
||||||
|
Logs user into the system
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
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");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> |
|
||||||
|
| **400** | Invalid username/password supplied | - |
|
||||||
|
|
||||||
|
|
||||||
|
## logoutUser
|
||||||
|
|
||||||
|
> logoutUser()
|
||||||
|
|
||||||
|
Logs out current logged in user session
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
try {
|
||||||
|
apiInstance.logoutUser();
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#logoutUser");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **0** | successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## updateUser
|
||||||
|
|
||||||
|
> updateUser(username, body)
|
||||||
|
|
||||||
|
Updated user
|
||||||
|
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.UserApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||||
|
|
||||||
|
UserApi apiInstance = new UserApi(defaultClient);
|
||||||
|
String username = "username_example"; // String | name that need to be deleted
|
||||||
|
User body = new User(); // User | Updated user object
|
||||||
|
try {
|
||||||
|
apiInstance.updateUser(username, body);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling UserApi#updateUser");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**username** | **String**| name that need to be deleted |
|
||||||
|
**body** | [**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
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **400** | Invalid user supplied | - |
|
||||||
|
| **404** | User not found | - |
|
||||||
|
|
40
samples/client/petstore/java/native/docs/XmlItem.md
Normal file
40
samples/client/petstore/java/native/docs/XmlItem.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# XmlItem
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**attributeString** | **String** | | [optional]
|
||||||
|
**attributeNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
**attributeInteger** | **Integer** | | [optional]
|
||||||
|
**attributeBoolean** | **Boolean** | | [optional]
|
||||||
|
**wrappedArray** | **List<Integer>** | | [optional]
|
||||||
|
**nameString** | **String** | | [optional]
|
||||||
|
**nameNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
**nameInteger** | **Integer** | | [optional]
|
||||||
|
**nameBoolean** | **Boolean** | | [optional]
|
||||||
|
**nameArray** | **List<Integer>** | | [optional]
|
||||||
|
**nameWrappedArray** | **List<Integer>** | | [optional]
|
||||||
|
**prefixString** | **String** | | [optional]
|
||||||
|
**prefixNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
**prefixInteger** | **Integer** | | [optional]
|
||||||
|
**prefixBoolean** | **Boolean** | | [optional]
|
||||||
|
**prefixArray** | **List<Integer>** | | [optional]
|
||||||
|
**prefixWrappedArray** | **List<Integer>** | | [optional]
|
||||||
|
**namespaceString** | **String** | | [optional]
|
||||||
|
**namespaceNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
**namespaceInteger** | **Integer** | | [optional]
|
||||||
|
**namespaceBoolean** | **Boolean** | | [optional]
|
||||||
|
**namespaceArray** | **List<Integer>** | | [optional]
|
||||||
|
**namespaceWrappedArray** | **List<Integer>** | | [optional]
|
||||||
|
**prefixNsString** | **String** | | [optional]
|
||||||
|
**prefixNsNumber** | [**BigDecimal**](BigDecimal.md) | | [optional]
|
||||||
|
**prefixNsInteger** | **Integer** | | [optional]
|
||||||
|
**prefixNsBoolean** | **Boolean** | | [optional]
|
||||||
|
**prefixNsArray** | **List<Integer>** | | [optional]
|
||||||
|
**prefixNsWrappedArray** | **List<Integer>** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
52
samples/client/petstore/java/native/git_push.sh
Normal file
52
samples/client/petstore/java/native/git_push.sh
Normal 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'
|
||||||
|
|
BIN
samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
samples/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
188
samples/client/petstore/java/native/gradlew
vendored
Normal file
188
samples/client/petstore/java/native/gradlew
vendored
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# 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
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
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" -a "$nonstop" = "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
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
100
samples/client/petstore/java/native/gradlew.bat
vendored
Normal file
100
samples/client/petstore/java/native/gradlew.bat
vendored
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@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="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
: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=%*
|
||||||
|
|
||||||
|
: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
|
208
samples/client/petstore/java/native/pom.xml
Normal file
208
samples/client/petstore/java/native/pom.xml
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
<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-native</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>petstore-native</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-Generator Contributors</name>
|
||||||
|
<email>team@openapitools.org</email>
|
||||||
|
<organization>OpenAPITools.org</organization>
|
||||||
|
<organizationUrl>http://openapitools.org</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
|
<version>3.0.0-M1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>enforce-maven</id>
|
||||||
|
<goals>
|
||||||
|
<goal>enforce</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<requireMavenVersion>
|
||||||
|
<version>3</version>
|
||||||
|
</requireMavenVersion>
|
||||||
|
<requireJavaVersion>
|
||||||
|
<version>11</version>
|
||||||
|
</requireJavaVersion>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.0.0-M3</version>
|
||||||
|
<configuration>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<loggerPath>conf/log4j.properties</loggerPath>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<threadCount>10</threadCount>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- attach test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.1.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<version>${swagger-annotations-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON processing: jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- @Nullable annotation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>3.0.2</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.22</swagger-annotations-version>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<jackson-version>2.9.9</jackson-version>
|
||||||
|
<junit-version>4.12</junit-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
1
samples/client/petstore/java/native/settings.gradle
Normal file
1
samples/client/petstore/java/native/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "petstore-native"
|
@ -0,0 +1,3 @@
|
|||||||
|
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application />
|
||||||
|
</manifest>
|
@ -0,0 +1,317 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration and utility class for API clients.
|
||||||
|
*
|
||||||
|
* <p>This class can be constructed and modified, then used to instantiate the
|
||||||
|
* various API classes. The API classes use the settings in this class to
|
||||||
|
* configure themselves, but otherwise do not store a link to this class.</p>
|
||||||
|
*
|
||||||
|
* <p>This class is mutable and not synchronized, so it is not thread-safe.
|
||||||
|
* The API classes generated from this are immutable and thread-safe.</p>
|
||||||
|
*
|
||||||
|
* <p>The setter methods of this class return the current object to facilitate
|
||||||
|
* a fluent style of configuration.</p>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ApiClient {
|
||||||
|
|
||||||
|
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||||
|
|
||||||
|
private HttpClient.Builder builder;
|
||||||
|
private ObjectMapper mapper;
|
||||||
|
private String scheme;
|
||||||
|
private String host;
|
||||||
|
private int port;
|
||||||
|
private String basePath;
|
||||||
|
private Consumer<HttpRequest.Builder> interceptor;
|
||||||
|
private Duration readTimeout;
|
||||||
|
|
||||||
|
private static String valueToString(Object value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL encode a string in the UTF-8 encoding.
|
||||||
|
*
|
||||||
|
* @param s String to encode.
|
||||||
|
* @return URL-encoded representation of the input string.
|
||||||
|
*/
|
||||||
|
public static String urlEncode(String s) {
|
||||||
|
return URLEncoder.encode(s, UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a URL query name/value parameter to a list of encoded {@link Pair}
|
||||||
|
* objects.
|
||||||
|
*
|
||||||
|
* <p>The value can be null, in which case an empty list is returned.</p>
|
||||||
|
*
|
||||||
|
* @param name The query name parameter.
|
||||||
|
* @param value The query value, which may not be a collection but may be
|
||||||
|
* null.
|
||||||
|
* @return A singleton list of the {@link Pair} objects representing the input
|
||||||
|
* parameters, which is encoded for use in a URL. If the value is null, an
|
||||||
|
* empty list is returned.
|
||||||
|
*/
|
||||||
|
public static List<Pair> parameterToPairs(String name, Object value) {
|
||||||
|
if (name == null || name.isEmpty() || value == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return Collections.singletonList(new Pair(urlEncode(name), urlEncode(value.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a URL query name/collection parameter to a list of encoded
|
||||||
|
* {@link Pair} objects.
|
||||||
|
*
|
||||||
|
* @param collectionFormat The swagger collectionFormat string (csv, tsv, etc).
|
||||||
|
* @param name The query name parameter.
|
||||||
|
* @param values A collection of values for the given query name, which may be
|
||||||
|
* null.
|
||||||
|
* @return A list of {@link Pair} objects representing the input parameters,
|
||||||
|
* which is encoded for use in a URL. If the values collection is null, an
|
||||||
|
* empty list is returned.
|
||||||
|
*/
|
||||||
|
public static List<Pair> parameterToPairs(
|
||||||
|
String collectionFormat, String name, Collection<?> values) {
|
||||||
|
if (name == null || name.isEmpty() || values == null || values.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the collection format (default: csv)
|
||||||
|
String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat;
|
||||||
|
|
||||||
|
// create the params based on the collection format
|
||||||
|
if ("multi".equals(format)) {
|
||||||
|
return values.stream()
|
||||||
|
.map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value))))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
String delimiter;
|
||||||
|
switch(format) {
|
||||||
|
case "csv":
|
||||||
|
delimiter = urlEncode(",");
|
||||||
|
break;
|
||||||
|
case "ssv":
|
||||||
|
delimiter = urlEncode(" ");
|
||||||
|
break;
|
||||||
|
case "tsv":
|
||||||
|
delimiter = urlEncode("\t");
|
||||||
|
break;
|
||||||
|
case "pipes":
|
||||||
|
delimiter = urlEncode("|");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Illegal collection format: " + collectionFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringJoiner joiner = new StringJoiner(delimiter);
|
||||||
|
for (Object value : values) {
|
||||||
|
joiner.add(urlEncode(valueToString(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Collections.singletonList(new Pair(urlEncode(name), joiner.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor.
|
||||||
|
*/
|
||||||
|
public ApiClient() {
|
||||||
|
builder = HttpClient.newBuilder();
|
||||||
|
mapper = new ObjectMapper();
|
||||||
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
||||||
|
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.registerModule(new JavaTimeModule());
|
||||||
|
URI baseURI = URI.create("http://petstore.swagger.io:80/v2");
|
||||||
|
scheme = baseURI.getScheme();
|
||||||
|
host = baseURI.getHost();
|
||||||
|
port = baseURI.getPort();
|
||||||
|
basePath = baseURI.getRawPath();
|
||||||
|
interceptor = null;
|
||||||
|
readTimeout = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom {@link HttpClient.Builder} object to use when creating the
|
||||||
|
* {@link HttpClient} that is used by the API client.
|
||||||
|
*
|
||||||
|
* @param builder Custom client builder.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setHttpClientBuilder(HttpClient.Builder builder) {
|
||||||
|
this.builder = builder;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an {@link HttpClient} based on the current {@link HttpClient.Builder}.
|
||||||
|
*
|
||||||
|
* <p>The returned object is immutable and thread-safe.</p>
|
||||||
|
*
|
||||||
|
* @return The HTTP client.
|
||||||
|
*/
|
||||||
|
public HttpClient getHttpClient() {
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom {@link ObjectMapper} to serialize and deserialize the request
|
||||||
|
* and response bodies.
|
||||||
|
*
|
||||||
|
* @param mapper Custom object mapper.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setObjectMapper(ObjectMapper mapper) {
|
||||||
|
this.mapper = mapper;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a copy of the current {@link ObjectMapper}.
|
||||||
|
*
|
||||||
|
* @return A copy of the current object mapper.
|
||||||
|
*/
|
||||||
|
public ObjectMapper getObjectMapper() {
|
||||||
|
return mapper.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom host name for the target service.
|
||||||
|
*
|
||||||
|
* @param host The host name of the target service.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom port number for the target service.
|
||||||
|
*
|
||||||
|
* @param port The port of the target service. Set this to -1 to reset the
|
||||||
|
* value to the default for the scheme.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setPort(int port) {
|
||||||
|
this.port = port;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom base path for the target service, for example '/v2'.
|
||||||
|
*
|
||||||
|
* @param basePath The base path against which the rest of the path is
|
||||||
|
* resolved.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setBasePath(String basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the base URI to resolve the endpoint paths against.
|
||||||
|
*
|
||||||
|
* @return The complete base URI that the rest of the API parameters are
|
||||||
|
* resolved against.
|
||||||
|
*/
|
||||||
|
public String getBaseUri() {
|
||||||
|
return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom request interceptor.
|
||||||
|
*
|
||||||
|
* <p>A request interceptor is a mechanism for altering each request before it
|
||||||
|
* is sent. After the request has been fully configured but not yet built, the
|
||||||
|
* request builder is passed into this function for further modification,
|
||||||
|
* after which it is sent out.</p>
|
||||||
|
*
|
||||||
|
* <p>This is useful for altering the requests in a custom manner, such as
|
||||||
|
* adding headers. It could also be used for logging and monitoring.</p>
|
||||||
|
*
|
||||||
|
* @param interceptor A function invoked before creating each request. A value
|
||||||
|
* of null resets the interceptor to a no-op.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setRequestInterceptor(Consumer<HttpRequest.Builder> interceptor) {
|
||||||
|
this.interceptor = interceptor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the custom interceptor.
|
||||||
|
*
|
||||||
|
* @return The custom interceptor that was set, or null if there isn't any.
|
||||||
|
*/
|
||||||
|
public Consumer<HttpRequest.Builder> getRequestInterceptor() {
|
||||||
|
return interceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the read timeout for the http client.
|
||||||
|
*
|
||||||
|
* <p>This is the value used by default for each request, though it can be
|
||||||
|
* overridden on a per-request basis with a request interceptor.</p>
|
||||||
|
*
|
||||||
|
* @param readTimeout The read timeout used by default by the http client.
|
||||||
|
* Setting this value to null resets the timeout to an
|
||||||
|
* effectively infinite value.
|
||||||
|
* @return This object.
|
||||||
|
*/
|
||||||
|
public ApiClient setReadTimeout(Duration readTimeout) {
|
||||||
|
this.readTimeout = readTimeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the read timeout that was set.
|
||||||
|
*
|
||||||
|
* @return The read timeout, or null if no timeout was set. Null represents
|
||||||
|
* an infinite wait time.
|
||||||
|
*/
|
||||||
|
public Duration getReadTimeout() {
|
||||||
|
return readTimeout;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.net.http.HttpHeaders;
|
||||||
|
|
||||||
|
|
||||||
|
public class ApiException extends Exception {
|
||||||
|
private int code = 0;
|
||||||
|
private HttpHeaders 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, HttpHeaders responseHeaders, String responseBody) {
|
||||||
|
super(message, throwable);
|
||||||
|
this.code = code;
|
||||||
|
this.responseHeaders = responseHeaders;
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) {
|
||||||
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) {
|
||||||
|
this(message, throwable, code, responseHeaders, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, HttpHeaders 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, HttpHeaders 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 Headers as an HttpHeaders object
|
||||||
|
*/
|
||||||
|
public HttpHeaders getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP response body.
|
||||||
|
*
|
||||||
|
* @return Response body in the form of string
|
||||||
|
*/
|
||||||
|
public String getResponseBody() {
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
|
}
|
@ -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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class AnotherFakeApi {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public AnotherFakeApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnotherFakeApi(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test special tags
|
||||||
|
* To test special tags and operation ID starting with number
|
||||||
|
* @param body client model (required)
|
||||||
|
* @return Client
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Client call123testSpecialTags(Client body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/another-fake/dummy";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"call123testSpecialTags call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,733 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.openapitools.client.model.Client;
|
||||||
|
import java.io.File;
|
||||||
|
import org.openapitools.client.model.FileSchemaTestClass;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import org.openapitools.client.model.OuterComposite;
|
||||||
|
import org.openapitools.client.model.User;
|
||||||
|
import org.openapitools.client.model.XmlItem;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class FakeApi {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public FakeApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public FakeApi(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates an XmlItem
|
||||||
|
* this route creates an XmlItem
|
||||||
|
* @param xmlItem XmlItem Body (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void createXmlItem(XmlItem xmlItem) throws ApiException {
|
||||||
|
// verify the required parameter 'xmlItem' is set
|
||||||
|
if (xmlItem == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/create_xml_item";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(xmlItem);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"createXmlItem call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of outer boolean types
|
||||||
|
* @param body Input boolean as post body (optional)
|
||||||
|
* @return Boolean
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/outer/boolean";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"fakeOuterBooleanSerialize call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Boolean>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of object with outer number type
|
||||||
|
* @param body Input composite as post body (optional)
|
||||||
|
* @return OuterComposite
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/outer/composite";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"fakeOuterCompositeSerialize call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<OuterComposite>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of outer number types
|
||||||
|
* @param body Input number as post body (optional)
|
||||||
|
* @return BigDecimal
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/outer/number";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"fakeOuterNumberSerialize call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<BigDecimal>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Test serialization of outer string types
|
||||||
|
* @param body Input string as post body (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String fakeOuterStringSerialize(String body) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/outer/string";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"fakeOuterStringSerialize call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* For this test, the body for this request much reference a schema named `File`.
|
||||||
|
* @param body (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/body-with-file-schema";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testBodyWithFileSchema call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param query (required)
|
||||||
|
* @param body (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void testBodyWithQueryParams(String query, User body) throws ApiException {
|
||||||
|
// verify the required parameter 'query' is set
|
||||||
|
if (query == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/body-with-query-params";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testBodyWithQueryParams call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* To test \"client\" model
|
||||||
|
* To test \"client\" model
|
||||||
|
* @param body client model (required)
|
||||||
|
* @return Client
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Client testClientModel(Client body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testClientModel call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
* @param number None (required)
|
||||||
|
* @param _double None (required)
|
||||||
|
* @param patternWithoutDelimiter None (required)
|
||||||
|
* @param _byte None (required)
|
||||||
|
* @param integer None (optional)
|
||||||
|
* @param int32 None (optional)
|
||||||
|
* @param int64 None (optional)
|
||||||
|
* @param _float None (optional)
|
||||||
|
* @param string None (optional)
|
||||||
|
* @param binary None (optional)
|
||||||
|
* @param date None (optional)
|
||||||
|
* @param dateTime None (optional)
|
||||||
|
* @param password None (optional)
|
||||||
|
* @param paramCallback None (optional)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public 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 ApiException {
|
||||||
|
// verify the required parameter 'number' is set
|
||||||
|
if (number == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters");
|
||||||
|
}
|
||||||
|
// verify the required parameter '_double' is set
|
||||||
|
if (_double == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'patternWithoutDelimiter' is set
|
||||||
|
if (patternWithoutDelimiter == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
|
||||||
|
}
|
||||||
|
// verify the required parameter '_byte' is set
|
||||||
|
if (_byte == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testEndpointParameters call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* To test enum parameters
|
||||||
|
* To test enum parameters
|
||||||
|
* @param enumHeaderStringArray Header parameter enum test (string array) (optional
|
||||||
|
* @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
|
||||||
|
* @param enumQueryStringArray Query parameter enum test (string array) (optional
|
||||||
|
* @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
|
||||||
|
* @param enumQueryInteger Query parameter enum test (double) (optional)
|
||||||
|
* @param enumQueryDouble Query parameter enum test (double) (optional)
|
||||||
|
* @param enumFormStringArray Form parameter enum test (string array) (optional
|
||||||
|
* @param enumFormString Form parameter enum test (string) (optional, default to -efg)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_string", enumQueryString));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_integer", enumQueryInteger));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_double", enumQueryDouble));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enumHeaderStringArray != null) {
|
||||||
|
localVarRequestBuilder.header("enum_header_string_array", enumHeaderStringArray.toString());
|
||||||
|
}
|
||||||
|
if (enumHeaderString != null) {
|
||||||
|
localVarRequestBuilder.header("enum_header_string", enumHeaderString.toString());
|
||||||
|
}
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testEnumParameters call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
* Fake endpoint to test group parameters (optional)
|
||||||
|
* @param requiredStringGroup Required String in group parameters (required)
|
||||||
|
* @param requiredBooleanGroup Required Boolean in group parameters (required)
|
||||||
|
* @param requiredInt64Group Required Integer in group parameters (required)
|
||||||
|
* @param stringGroup String in group parameters (optional)
|
||||||
|
* @param booleanGroup Boolean in group parameters (optional)
|
||||||
|
* @param int64Group Integer in group parameters (optional)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
|
||||||
|
// verify the required parameter 'requiredStringGroup' is set
|
||||||
|
if (requiredStringGroup == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'requiredBooleanGroup' is set
|
||||||
|
if (requiredBooleanGroup == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'requiredInt64Group' is set
|
||||||
|
if (requiredInt64Group == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("required_string_group", requiredStringGroup));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("required_int64_group", requiredInt64Group));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("string_group", stringGroup));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("int64_group", int64Group));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requiredBooleanGroup != null) {
|
||||||
|
localVarRequestBuilder.header("required_boolean_group", requiredBooleanGroup.toString());
|
||||||
|
}
|
||||||
|
if (booleanGroup != null) {
|
||||||
|
localVarRequestBuilder.header("boolean_group", booleanGroup.toString());
|
||||||
|
}
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testGroupParameters call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* test inline additionalProperties
|
||||||
|
*
|
||||||
|
* @param param request body (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void testInlineAdditionalProperties(Map<String, String> param) throws ApiException {
|
||||||
|
// verify the required parameter 'param' is set
|
||||||
|
if (param == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/inline-additionalProperties";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(param);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testInlineAdditionalProperties call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* test json serialization of form data
|
||||||
|
*
|
||||||
|
* @param param field1 (required)
|
||||||
|
* @param param2 field2 (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void testJsonFormData(String param, String param2) throws ApiException {
|
||||||
|
// verify the required parameter 'param' is set
|
||||||
|
if (param == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'param2' is set
|
||||||
|
if (param2 == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/jsonFormData";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testJsonFormData call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class FakeClassnameTags123Api {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public FakeClassnameTags123Api() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public FakeClassnameTags123Api(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test class name in snake case
|
||||||
|
* To test class name in snake case
|
||||||
|
* @param body client model (required)
|
||||||
|
* @return Client
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Client testClassname(Client body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake_classname_test";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"testClassname call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,500 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import org.openapitools.client.model.ModelApiResponse;
|
||||||
|
import org.openapitools.client.model.Pet;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class PetApi {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public PetApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PetApi(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
* @param body Pet object that needs to be added to the store (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void addPet(Pet body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling addPet");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"addPet call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
* @param petId Pet id to delete (required)
|
||||||
|
* @param apiKey (optional)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void deletePet(Long petId, String apiKey) throws ApiException {
|
||||||
|
// verify the required parameter 'petId' is set
|
||||||
|
if (petId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet/{petId}"
|
||||||
|
.replace("{petId}", ApiClient.urlEncode(petId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
if (apiKey != null) {
|
||||||
|
localVarRequestBuilder.header("api_key", apiKey.toString());
|
||||||
|
}
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"deletePet call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
* @param status Status values that need to be considered for filter (required)
|
||||||
|
* @return List<Pet>
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public List<Pet> findPetsByStatus(List<String> status) throws ApiException {
|
||||||
|
// verify the required parameter 'status' is set
|
||||||
|
if (status == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet/findByStatus";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "status", status));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"findPetsByStatus call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* @param tags Tags to filter by (required)
|
||||||
|
* @return List<Pet>
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public List<Pet> findPetsByTags(List<String> tags) throws ApiException {
|
||||||
|
// verify the required parameter 'tags' is set
|
||||||
|
if (tags == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet/findByTags";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"findPetsByTags call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
* Returns a single pet
|
||||||
|
* @param petId ID of pet to return (required)
|
||||||
|
* @return Pet
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Pet getPetById(Long petId) throws ApiException {
|
||||||
|
// verify the required parameter 'petId' is set
|
||||||
|
if (petId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet/{petId}"
|
||||||
|
.replace("{petId}", ApiClient.urlEncode(petId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"getPetById call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Pet>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
* @param body Pet object that needs to be added to the store (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void updatePet(Pet body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"updatePet call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*
|
||||||
|
* @param petId ID of pet that needs to be updated (required)
|
||||||
|
* @param name Updated name of the pet (optional)
|
||||||
|
* @param status Updated status of the pet (optional)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void updatePetWithForm(Long petId, String name, String status) throws ApiException {
|
||||||
|
// verify the required parameter 'petId' is set
|
||||||
|
if (petId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet/{petId}"
|
||||||
|
.replace("{petId}", ApiClient.urlEncode(petId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"updatePetWithForm call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*
|
||||||
|
* @param petId ID of pet to update (required)
|
||||||
|
* @param additionalMetadata Additional data to pass to server (optional)
|
||||||
|
* @param file file to upload (optional)
|
||||||
|
* @return ModelApiResponse
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException {
|
||||||
|
// verify the required parameter 'petId' is set
|
||||||
|
if (petId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/pet/{petId}/uploadImage"
|
||||||
|
.replace("{petId}", ApiClient.urlEncode(petId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"uploadFile call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* uploads an image (required)
|
||||||
|
*
|
||||||
|
* @param petId ID of pet to update (required)
|
||||||
|
* @param requiredFile file to upload (required)
|
||||||
|
* @param additionalMetadata Additional data to pass to server (optional)
|
||||||
|
* @return ModelApiResponse
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException {
|
||||||
|
// verify the required parameter 'petId' is set
|
||||||
|
if (petId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'requiredFile' is set
|
||||||
|
if (requiredFile == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"
|
||||||
|
.replace("{petId}", ApiClient.urlEncode(petId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"uploadFileWithRequiredFile call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Order;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class StoreApi {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public StoreApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public StoreApi(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete purchase order by ID
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
* @param orderId ID of the order that needs to be deleted (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void deleteOrder(String orderId) throws ApiException {
|
||||||
|
// verify the required parameter 'orderId' is set
|
||||||
|
if (orderId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/store/order/{order_id}"
|
||||||
|
.replace("{order_id}", ApiClient.urlEncode(orderId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"deleteOrder call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
* @return Map<String, Integer>
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Map<String, Integer> getInventory() throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/store/inventory";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"getInventory call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Map<String, Integer>>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Find purchase order by ID
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
* @param orderId ID of pet that needs to be fetched (required)
|
||||||
|
* @return Order
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Order getOrderById(Long orderId) throws ApiException {
|
||||||
|
// verify the required parameter 'orderId' is set
|
||||||
|
if (orderId == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/store/order/{order_id}"
|
||||||
|
.replace("{order_id}", ApiClient.urlEncode(orderId.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"getOrderById call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
* @param body order placed for purchasing the pet (required)
|
||||||
|
* @return Order
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public Order placeOrder(Order body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/store/order";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"placeOrder call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,432 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.User;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class UserApi {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
|
||||||
|
public UserApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserApi(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param body Created user object (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void createUser(User body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling createUser");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"createUser call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* @param body List of user object (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void createUsersWithArrayInput(List<User> body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/createWithArray";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"createUsersWithArrayInput call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
* @param body List of user object (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void createUsersWithListInput(List<User> body) throws ApiException {
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/createWithList";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"createUsersWithListInput call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param username The name that needs to be deleted (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void deleteUser(String username) throws ApiException {
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if (username == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/{username}"
|
||||||
|
.replace("{username}", ApiClient.urlEncode(username.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"deleteUser call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
* @param username The name that needs to be fetched. Use user1 for testing. (required)
|
||||||
|
* @return User
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public User getUserByName(String username) throws ApiException {
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if (username == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/{username}"
|
||||||
|
.replace("{username}", ApiClient.urlEncode(username.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"getUserByName call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<User>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
* @param username The user name for login (required)
|
||||||
|
* @param password The password for login in clear text (required)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String loginUser(String username, String password) throws ApiException {
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if (username == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'password' is set
|
||||||
|
if (password == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/login";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"loginUser call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {});
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void logoutUser() throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/logout";
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"logoutUser call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Updated user
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
* @param username name that need to be deleted (required)
|
||||||
|
* @param body Updated user object (required)
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public void updateUser(String username, User body) throws ApiException {
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if (username == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'body' is set
|
||||||
|
if (body == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/user/{username}"
|
||||||
|
.replace("{username}", ApiClient.urlEncode(username.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||||
|
localVarRequestBuilder.header("Accept", "application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
|
||||||
|
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw new ApiException(localVarResponse.statusCode(),
|
||||||
|
"updateUser call received non-success response",
|
||||||
|
localVarResponse.headers(),
|
||||||
|
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdditionalPropertiesAnyType
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public AdditionalPropertiesAnyType name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o;
|
||||||
|
return Objects.equals(this.name, additionalPropertiesAnyType.name) &&
|
||||||
|
super.equals(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name, super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesAnyType {\n");
|
||||||
|
sb.append(" ").append(toIndentedString(super.toString())).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 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdditionalPropertiesArray
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdditionalPropertiesArray extends HashMap<String, List> {
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public AdditionalPropertiesArray name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o;
|
||||||
|
return Objects.equals(this.name, additionalPropertiesArray.name) &&
|
||||||
|
super.equals(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name, super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesArray {\n");
|
||||||
|
sb.append(" ").append(toIndentedString(super.toString())).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 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdditionalPropertiesBoolean
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public AdditionalPropertiesBoolean name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o;
|
||||||
|
return Objects.equals(this.name, additionalPropertiesBoolean.name) &&
|
||||||
|
super.equals(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name, super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesBoolean {\n");
|
||||||
|
sb.append(" ").append(toIndentedString(super.toString())).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 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,399 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdditionalPropertiesClass
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdditionalPropertiesClass {
|
||||||
|
@JsonProperty("map_string")
|
||||||
|
private Map<String, String> mapString = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_number")
|
||||||
|
private Map<String, BigDecimal> mapNumber = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_integer")
|
||||||
|
private Map<String, Integer> mapInteger = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_boolean")
|
||||||
|
private Map<String, Boolean> mapBoolean = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_array_integer")
|
||||||
|
private Map<String, List<Integer>> mapArrayInteger = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_array_anytype")
|
||||||
|
private Map<String, List<Object>> mapArrayAnytype = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_map_string")
|
||||||
|
private Map<String, Map<String, String>> mapMapString = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("map_map_anytype")
|
||||||
|
private Map<String, Map<String, Object>> mapMapAnytype = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("anytype_1")
|
||||||
|
private Object anytype1 = null;
|
||||||
|
|
||||||
|
@JsonProperty("anytype_2")
|
||||||
|
private Object anytype2 = null;
|
||||||
|
|
||||||
|
@JsonProperty("anytype_3")
|
||||||
|
private Object anytype3 = null;
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapString(Map<String, String> mapString) {
|
||||||
|
this.mapString = mapString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) {
|
||||||
|
if (this.mapString == null) {
|
||||||
|
this.mapString = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapString.put(key, mapStringItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapString
|
||||||
|
* @return mapString
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, String> getMapString() {
|
||||||
|
return mapString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapString(Map<String, String> mapString) {
|
||||||
|
this.mapString = mapString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) {
|
||||||
|
this.mapNumber = mapNumber;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) {
|
||||||
|
if (this.mapNumber == null) {
|
||||||
|
this.mapNumber = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapNumber.put(key, mapNumberItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapNumber
|
||||||
|
* @return mapNumber
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, BigDecimal> getMapNumber() {
|
||||||
|
return mapNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapNumber(Map<String, BigDecimal> mapNumber) {
|
||||||
|
this.mapNumber = mapNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) {
|
||||||
|
this.mapInteger = mapInteger;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) {
|
||||||
|
if (this.mapInteger == null) {
|
||||||
|
this.mapInteger = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapInteger.put(key, mapIntegerItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapInteger
|
||||||
|
* @return mapInteger
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, Integer> getMapInteger() {
|
||||||
|
return mapInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapInteger(Map<String, Integer> mapInteger) {
|
||||||
|
this.mapInteger = mapInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) {
|
||||||
|
this.mapBoolean = mapBoolean;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) {
|
||||||
|
if (this.mapBoolean == null) {
|
||||||
|
this.mapBoolean = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapBoolean.put(key, mapBooleanItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapBoolean
|
||||||
|
* @return mapBoolean
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, Boolean> getMapBoolean() {
|
||||||
|
return mapBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapBoolean(Map<String, Boolean> mapBoolean) {
|
||||||
|
this.mapBoolean = mapBoolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
|
||||||
|
this.mapArrayInteger = mapArrayInteger;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) {
|
||||||
|
if (this.mapArrayInteger == null) {
|
||||||
|
this.mapArrayInteger = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapArrayInteger.put(key, mapArrayIntegerItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapArrayInteger
|
||||||
|
* @return mapArrayInteger
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, List<Integer>> getMapArrayInteger() {
|
||||||
|
return mapArrayInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapArrayInteger(Map<String, List<Integer>> mapArrayInteger) {
|
||||||
|
this.mapArrayInteger = mapArrayInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
|
||||||
|
this.mapArrayAnytype = mapArrayAnytype;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) {
|
||||||
|
if (this.mapArrayAnytype == null) {
|
||||||
|
this.mapArrayAnytype = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapArrayAnytype.put(key, mapArrayAnytypeItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapArrayAnytype
|
||||||
|
* @return mapArrayAnytype
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, List<Object>> getMapArrayAnytype() {
|
||||||
|
return mapArrayAnytype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) {
|
||||||
|
this.mapArrayAnytype = mapArrayAnytype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) {
|
||||||
|
this.mapMapString = mapMapString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) {
|
||||||
|
if (this.mapMapString == null) {
|
||||||
|
this.mapMapString = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapMapString.put(key, mapMapStringItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapMapString
|
||||||
|
* @return mapMapString
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, Map<String, String>> getMapMapString() {
|
||||||
|
return mapMapString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapMapString(Map<String, Map<String, String>> mapMapString) {
|
||||||
|
this.mapMapString = mapMapString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
|
||||||
|
this.mapMapAnytype = mapMapAnytype;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) {
|
||||||
|
if (this.mapMapAnytype == null) {
|
||||||
|
this.mapMapAnytype = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.mapMapAnytype.put(key, mapMapAnytypeItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mapMapAnytype
|
||||||
|
* @return mapMapAnytype
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Map<String, Map<String, Object>> getMapMapAnytype() {
|
||||||
|
return mapMapAnytype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) {
|
||||||
|
this.mapMapAnytype = mapMapAnytype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass anytype1(Object anytype1) {
|
||||||
|
this.anytype1 = anytype1;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get anytype1
|
||||||
|
* @return anytype1
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Object getAnytype1() {
|
||||||
|
return anytype1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnytype1(Object anytype1) {
|
||||||
|
this.anytype1 = anytype1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass anytype2(Object anytype2) {
|
||||||
|
this.anytype2 = anytype2;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get anytype2
|
||||||
|
* @return anytype2
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Object getAnytype2() {
|
||||||
|
return anytype2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnytype2(Object anytype2) {
|
||||||
|
this.anytype2 = anytype2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdditionalPropertiesClass anytype3(Object anytype3) {
|
||||||
|
this.anytype3 = anytype3;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get anytype3
|
||||||
|
* @return anytype3
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
public Object getAnytype3() {
|
||||||
|
return anytype3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnytype3(Object anytype3) {
|
||||||
|
this.anytype3 = anytype3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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.mapString, additionalPropertiesClass.mapString) &&
|
||||||
|
Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) &&
|
||||||
|
Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) &&
|
||||||
|
Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) &&
|
||||||
|
Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) &&
|
||||||
|
Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) &&
|
||||||
|
Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) &&
|
||||||
|
Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) &&
|
||||||
|
Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) &&
|
||||||
|
Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) &&
|
||||||
|
Objects.equals(this.anytype3, additionalPropertiesClass.anytype3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesClass {\n");
|
||||||
|
sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n");
|
||||||
|
sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n");
|
||||||
|
sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n");
|
||||||
|
sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n");
|
||||||
|
sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n");
|
||||||
|
sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n");
|
||||||
|
sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n");
|
||||||
|
sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n");
|
||||||
|
sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n");
|
||||||
|
sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n");
|
||||||
|
sb.append(" anytype3: ").append(toIndentedString(anytype3)).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 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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: \" \\
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 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.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdditionalPropertiesInteger
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public AdditionalPropertiesInteger name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o;
|
||||||
|
return Objects.equals(this.name, additionalPropertiesInteger.name) &&
|
||||||
|
super.equals(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(name, super.hashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesInteger {\n");
|
||||||
|
sb.append(" ").append(toIndentedString(super.toString())).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 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user