forked from loafle/openapi-generator-original
[Java][Client] Add support for the new Spring RestClient (#18522)
* feat (JAVA SPRING RESTTEMPLATE) 17571: initial commit for Spring RestClient * feat (JAVA SPRING RESTTEMPLATE) 17571: Copied and changed the webclient mustache files The RestClient API is oriented on the WebClient API so many parts of the templates can be the same * fix (JAVA SPRING RESTTEMPLATE) 17571: Renaming error & add README template The README must be changed because the minimal Java Version for this client is 17 * fix (JAVA SPRING RESTTEMPLATE) 17571: Imports, compile errors and cookie setting * feat (JAVA SPRING RESTTEMPLATE) 17571: Add generated samples * test (JAVA SPRING RESTTEMPLATE) 17571: Add tests * feat (JAVA SPRING RESTTEMPLATE) 17571: Update doc * Add the restcilent to samples-java-client-jdk17.yam The minimum Java version of the used Spring Version is 17 * fix (JAVA SPRING RESTTEMPLATE) 17571: Workflow paths to petstore samples * fix (JAVA SPRING RESTTEMPLATE) 17571: Regenerated samples * feat (JAVA SPRING RESTTEMPLATE) 17571: Generated echo-api sample for RestClient * fix (JAVA SPRING RESTTEMPLATE) 17571: Missing import * fix (JAVA SPRING RESTTEMPLATE) 17571: Missing body class exception when null body is set * test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api Auth test * fix (JAVA SPRING RESTTEMPLATE) 17571: Gradlew file permissions * feat (JAVA SPRING RESTTEMPLATE) 17571: Reggenerate samples after rebase * test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api Body gif test * test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api octet stream body test * test (JAVA SPRING RESTTEMPLATE) 17571: Add echo-api multipart form data test * fix (JAVA SPRING RESTTEMPLATE) 17571: Form as body when body is null Also regenerated the restclient samples
This commit is contained in:
parent
d573f00e84
commit
ef2fa03e96
42
.github/workflows/samples-java-client-echo-api-jdk17.yaml
vendored
Normal file
42
.github/workflows/samples-java-client-echo-api-jdk17.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: Java Client (Echo API) JDK17
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/client/echo_api/java/restclient
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/echo_api/java/restclient
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Client JDK17
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/echo_api/java/restclient
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Setup node.js
|
||||
uses: actions/setup-node@v4
|
||||
- name: Run echo server
|
||||
run: |
|
||||
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
||||
(cd http-echo-server && npm install && npm start &)
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: mvn clean package
|
@ -5,10 +5,12 @@ on:
|
||||
paths:
|
||||
- samples/client/petstore/java/resttemplate-jakarta/**
|
||||
- samples/client/petstore/java/webclient-jakarta/**
|
||||
- samples/client/petstore/java/restclient-*/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/petstore/java/resttemplate-jakarta/**
|
||||
- samples/client/petstore/java/webclient-jakarta/**
|
||||
- samples/client/petstore/java/restclient-*/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build Java Client JDK17
|
||||
@ -20,6 +22,9 @@ jobs:
|
||||
# clients
|
||||
- samples/client/petstore/java/resttemplate-jakarta
|
||||
- samples/client/petstore/java/webclient-jakarta
|
||||
- samples/client/petstore/java/restclient
|
||||
- samples/client/petstore/java/restclient-nullable-arrays
|
||||
- samples/client/petstore/java/restclient-swagger2
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
|
13
bin/configs/java-restclient-echo-api.yaml
Normal file
13
bin/configs/java-restclient-echo-api.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/echo_api/java/restclient
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: echo-api-native
|
||||
hideGenerationTimestamp: "true"
|
||||
|
||||
typeMappings:
|
||||
OffsetDateTime: "Instant"
|
||||
importMappings:
|
||||
OffsetDateTime: "java.time.Instant"
|
8
bin/configs/java-restclient-nullable-array.yaml
Normal file
8
bin/configs/java-restclient-nullable-array.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/restclient-nullable-arrays
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/schema-with-nullable-arrays.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-restclient-nullable-arrays
|
||||
hideGenerationTimestamp: "true"
|
10
bin/configs/java-restclient-swagger2.yaml
Normal file
10
bin/configs/java-restclient-swagger2.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/restclient-swagger2
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-restclient
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
||||
annotationLibrary: "swagger2"
|
9
bin/configs/java-restclient-useAbstractionForFiles.yaml
Normal file
9
bin/configs/java-restclient-useAbstractionForFiles.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/others/java/restclient-useAbstractionForFiles
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue13146_file_abstraction_response.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: file-restclient
|
||||
hideGenerationTimestamp: "true"
|
||||
useAbstractionForFiles: true
|
9
bin/configs/java-restclient.yaml
Normal file
9
bin/configs/java-restclient.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
generatorName: java
|
||||
outputDir: samples/client/petstore/java/restclient
|
||||
library: restclient
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||
additionalProperties:
|
||||
artifactId: petstore-restclient
|
||||
hideGenerationTimestamp: "true"
|
||||
containerDefaultToNull: "true"
|
@ -58,7 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null|
|
||||
|invokerPackage|root package for generated code| |org.openapitools.client|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.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>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.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.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.x</dd></dl>|okhttp-gson|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey3**</dt><dd>HTTP client: Jersey client 3.x. JSON processing: Jackson 2.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x. or Gson 2.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>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**restclient**</dt><dd>HTTP client: Spring RestClient 6.1. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: JSON-B or Jackson 2.9.x</dd><dt>**apache-httpclient**</dt><dd>HTTP client: Apache httpclient 5.x</dd></dl>|okhttp-gson|
|
||||
|licenseName|The name of the license| |Unlicense|
|
||||
|licenseUrl|The URL of the license| |http://unlicense.org|
|
||||
|microprofileFramework|Framework for microprofile. Possible values "kumuluzee"| |null|
|
||||
@ -84,7 +84,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|supportStreaming|Support streaming endpoint (beta)| |false|
|
||||
|supportUrlQuery|Generate toUrlQueryString in POJO (default to true). Available on `native`, `apache-httpclient` libraries.| |false|
|
||||
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|
||||
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries| |false|
|
||||
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations| |false|
|
||||
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
|
||||
|useGzipFeature|Send gzip-encoded requests| |false|
|
||||
|
@ -83,6 +83,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
public static final String RESTEASY = "resteasy";
|
||||
public static final String RESTTEMPLATE = "resttemplate";
|
||||
public static final String WEBCLIENT = "webclient";
|
||||
public static final String RESTCLIENT = "restclient";
|
||||
public static final String REST_ASSURED = "rest-assured";
|
||||
public static final String RETROFIT_2 = "retrofit2";
|
||||
public static final String VERTX = "vertx";
|
||||
@ -216,7 +217,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries"));
|
||||
cliOptions.add(CliOption.newString(MICROPROFILE_FRAMEWORK, "Framework for microprofile. Possible values \"kumuluzee\""));
|
||||
cliOptions.add(CliOption.newString(MICROPROFILE_MUTINY, "Whether to use async types for microprofile (currently only Smallrye Mutiny is supported)."));
|
||||
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, libraries"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_ABSTRACTION_FOR_FILES, "Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate, webclient, restclient, libraries"));
|
||||
cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations));
|
||||
cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming));
|
||||
cliOptions.add(CliOption.newBoolean(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT_DESC + " (only available for okhttp-gson library)", this.withAWSV4Signature));
|
||||
@ -238,6 +239,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)");
|
||||
supportedLibraries.put(RESTTEMPLATE, "HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(WEBCLIENT, "HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(RESTCLIENT, "HTTP client: Spring RestClient 6.1. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(RESTEASY, "HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(VERTX, "HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x");
|
||||
supportedLibraries.put(GOOGLE_API_CLIENT, "HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x");
|
||||
@ -300,7 +302,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
if (WEBCLIENT.equals(getLibrary()) || NATIVE.equals(getLibrary())) {
|
||||
if (WEBCLIENT.equals(getLibrary()) || NATIVE.equals(getLibrary()) || RESTCLIENT.equals(getLibrary())) {
|
||||
dateLibrary = "java8";
|
||||
} else if (MICROPROFILE.equals(getLibrary())) {
|
||||
dateLibrary = "legacy";
|
||||
@ -508,7 +510,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
|
||||
// helper for client library that allow to parse/format java.time.OffsetDateTime or org.threeten.bp.OffsetDateTime
|
||||
if (additionalProperties.containsKey("jsr310") && (isLibrary(WEBCLIENT) || isLibrary(VERTX) || isLibrary(RESTTEMPLATE) || isLibrary(RESTEASY) || isLibrary(MICROPROFILE) || isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(APACHE))) {
|
||||
if (additionalProperties.containsKey("jsr310") && (isLibrary(WEBCLIENT) || isLibrary(VERTX) || isLibrary(RESTTEMPLATE) || isLibrary(RESTEASY) || isLibrary(MICROPROFILE) || isLibrary(JERSEY2) || isLibrary(JERSEY3) || isLibrary(APACHE) || isLibrary(RESTCLIENT))) {
|
||||
supportingFiles.add(new SupportingFile("JavaTimeFormatter.mustache", invokerFolder, "JavaTimeFormatter.java"));
|
||||
}
|
||||
|
||||
@ -556,7 +558,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
reservedWords.remove("file");
|
||||
}
|
||||
|
||||
if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || RETROFIT_2.equals(getLibrary()) || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()))) {
|
||||
if (!(FEIGN.equals(getLibrary()) || RESTTEMPLATE.equals(getLibrary()) || RETROFIT_2.equals(getLibrary()) || GOOGLE_API_CLIENT.equals(getLibrary()) || REST_ASSURED.equals(getLibrary()) || WEBCLIENT.equals(getLibrary()) || MICROPROFILE.equals(getLibrary()) || RESTCLIENT.equals(getLibrary()))) {
|
||||
supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java"));
|
||||
supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java"));
|
||||
supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java"));
|
||||
@ -659,6 +661,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java"));
|
||||
} else if (WEBCLIENT.equals(getLibrary())) {
|
||||
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
|
||||
} else if (RESTCLIENT.equals(getLibrary())) {
|
||||
forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON);
|
||||
applyJakartaPackage();
|
||||
} else if (VERTX.equals(getLibrary())) {
|
||||
typeMapping.put("file", "AsyncFile");
|
||||
importMapping.put("AsyncFile", "io.vertx.core.file.AsyncFile");
|
||||
|
750
modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache
vendored
Normal file
750
modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache
vendored
Normal file
@ -0,0 +1,750 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.util.function.Consumer;
|
||||
{{#openApiNullable}}
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
{{/openApiNullable}}
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.InvalidMediaTypeException;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
{{#withXml}}
|
||||
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
|
||||
{{/withXml}}
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import org.springframework.web.client.RestClient;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import java.util.Optional;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import {{javaxPackage}}.annotation.Nullable;
|
||||
|
||||
{{#jsr310}}
|
||||
import java.time.OffsetDateTime;
|
||||
{{/jsr310}}
|
||||
|
||||
import {{invokerPackage}}.auth.Authentication;
|
||||
import {{invokerPackage}}.auth.HttpBasicAuth;
|
||||
import {{invokerPackage}}.auth.HttpBearerAuth;
|
||||
import {{invokerPackage}}.auth.ApiKeyAuth;
|
||||
{{#hasOAuthMethods}}
|
||||
import {{invokerPackage}}.auth.OAuth;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
public enum CollectionFormat {
|
||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||
|
||||
private final String separator;
|
||||
CollectionFormat(String separator) {
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
private String collectionToString(Collection<?> collection) {
|
||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||
}
|
||||
}
|
||||
|
||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||
|
||||
private String basePath = "{{basePath}}";
|
||||
|
||||
private final RestClient restClient;
|
||||
private final DateFormat dateFormat;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
private Map<String, Authentication> authentications;
|
||||
|
||||
|
||||
public ApiClient() {
|
||||
this.dateFormat = createDefaultDateFormat();
|
||||
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
|
||||
this.restClient = buildRestClient(this.objectMapper);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public ApiClient(RestClient restClient) {
|
||||
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
|
||||
}
|
||||
|
||||
public ApiClient(ObjectMapper mapper, DateFormat format) {
|
||||
this(buildRestClient(mapper.copy()), format);
|
||||
}
|
||||
|
||||
public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
|
||||
this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
|
||||
}
|
||||
|
||||
private ApiClient(RestClient restClient, DateFormat format) {
|
||||
this.restClient = restClient;
|
||||
this.dateFormat = format;
|
||||
this.objectMapper = createDefaultObjectMapper(format);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public static DateFormat createDefaultDateFormat() {
|
||||
DateFormat dateFormat = new RFC3339DateFormat();
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
|
||||
if (null == dateFormat) {
|
||||
dateFormat = createDefaultDateFormat();
|
||||
}
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setDateFormat(dateFormat);
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
{{#openApiNullable}}
|
||||
JsonNullableModule jnm = new JsonNullableModule();
|
||||
mapper.registerModule(jnm);
|
||||
{{/openApiNullable}}
|
||||
return mapper;
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<>();{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
||||
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasicBasic}}{{#isBasicBearer}}
|
||||
authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}"));{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
|
||||
authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}}
|
||||
authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}}
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClientBuilder used to make RestClient.
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient.Builder buildRestClientBuilder(ObjectMapper mapper) {
|
||||
{{#withXml}}
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
{{#openApiNullable}}
|
||||
xmlMapper.registerModule(new JsonNullableModule());
|
||||
{{/openApiNullable}}
|
||||
|
||||
{{/withXml}}
|
||||
Consumer<List<HttpMessageConverter<?>>> messageConverters = converters -> {
|
||||
converters.add(new MappingJackson2HttpMessageConverter(mapper));
|
||||
{{#withXml}}
|
||||
converters.add(new MappingJackson2XmlHttpMessageConverter(xmlMapper));
|
||||
{{/withXml}}
|
||||
};
|
||||
|
||||
return RestClient.builder().messageConverters(messageConverters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClientBuilder used to make RestClient.
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient.Builder buildRestClientBuilder() {
|
||||
return buildRestClientBuilder(createDefaultObjectMapper(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClient used to make HTTP requests.
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient buildRestClient(ObjectMapper mapper) {
|
||||
return buildRestClientBuilder(mapper).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClient used to make HTTP requests.
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient buildRestClient() {
|
||||
return buildRestClientBuilder(createDefaultObjectMapper(null)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current base path
|
||||
* @return String the base path
|
||||
*/
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base path, which should include the host
|
||||
* @param basePath the base path
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authentications (key: authentication name, value: authentication).
|
||||
* @return Map the currently configured authentication types
|
||||
*/
|
||||
public Map<String, Authentication> getAuthentications() {
|
||||
return authentications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authentication for the given name.
|
||||
*
|
||||
* @param authName The authentication name
|
||||
* @return The authentication, null if not found
|
||||
*/
|
||||
public Authentication getAuthentication(String authName) {
|
||||
return authentications.get(authName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set access token for the first Bearer authentication.
|
||||
* @param bearerToken Bearer token
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof HttpBearerAuth) {
|
||||
((HttpBearerAuth) auth).setBearerToken(bearerToken);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No Bearer authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set username for the first HTTP basic authentication.
|
||||
* @param username the username
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof HttpBasicAuth) {
|
||||
((HttpBasicAuth) auth).setUsername(username);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No HTTP basic authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set password for the first HTTP basic authentication.
|
||||
* @param password the password
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof HttpBasicAuth) {
|
||||
((HttpBasicAuth) auth).setPassword(password);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No HTTP basic authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set API key value for the first API key authentication.
|
||||
* @param apiKey the API key
|
||||
*/
|
||||
public void setApiKey(String apiKey) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof ApiKeyAuth) {
|
||||
((ApiKeyAuth) auth).setApiKey(apiKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No API key authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set API key prefix for the first API key authentication.
|
||||
* @param apiKeyPrefix the API key prefix
|
||||
*/
|
||||
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof ApiKeyAuth) {
|
||||
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No API key authentication configured!");
|
||||
}
|
||||
|
||||
{{#hasOAuthMethods}}
|
||||
/**
|
||||
* Helper method to set access token for the first OAuth2 authentication.
|
||||
* @param accessToken the access token
|
||||
*/
|
||||
public void setAccessToken(String accessToken) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof OAuth) {
|
||||
((OAuth) auth).setAccessToken(accessToken);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No OAuth2 authentication configured!");
|
||||
}
|
||||
|
||||
{{/hasOAuthMethods}}
|
||||
/**
|
||||
* Set the User-Agent header's value (by adding to the default header map).
|
||||
* @param userAgent the user agent string
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient setUserAgent(String userAgent) {
|
||||
addDefaultHeader("User-Agent", userAgent);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a default header.
|
||||
*
|
||||
* @param name The header's name
|
||||
* @param value The header's value
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultHeader(String name, String value) {
|
||||
if (defaultHeaders.containsKey(name)) {
|
||||
defaultHeaders.remove(name);
|
||||
}
|
||||
defaultHeaders.add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a default cookie.
|
||||
*
|
||||
* @param name The cookie's name
|
||||
* @param value The cookie's value
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultCookie(String name, String value) {
|
||||
if (defaultCookies.containsKey(name)) {
|
||||
defaultCookies.remove(name);
|
||||
}
|
||||
defaultCookies.add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format date parameters.
|
||||
* @return DateFormat format
|
||||
*/
|
||||
public DateFormat getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given string into Date object.
|
||||
*/
|
||||
public Date parseDate(String str) {
|
||||
try {
|
||||
return dateFormat.parse(str);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given Date object into string.
|
||||
*/
|
||||
public String formatDate(Date date) {
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ObjectMapper used to make HTTP requests.
|
||||
* @return ObjectMapper objectMapper
|
||||
*/
|
||||
public ObjectMapper getObjectMapper() {
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the RestClient used to make HTTP requests.
|
||||
* @return RestClient restClient
|
||||
*/
|
||||
public RestClient getRestClient() {
|
||||
return restClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given parameter object into string.
|
||||
* @param param the object to convert
|
||||
* @return String the parameter represented as a String
|
||||
*/
|
||||
public String parameterToString(Object param) {
|
||||
if (param == null) {
|
||||
return "";
|
||||
} else if (param instanceof Date) {
|
||||
return formatDate( (Date) param);
|
||||
} {{#jsr310}}else if (param instanceof OffsetDateTime) {
|
||||
return formatOffsetDateTime((OffsetDateTime) param);
|
||||
} {{/jsr310}}else if (param instanceof Collection) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(Object o : (Collection<?>) param) {
|
||||
if(b.length() > 0) {
|
||||
b.append(",");
|
||||
}
|
||||
b.append(String.valueOf(o));
|
||||
}
|
||||
return b.toString();
|
||||
} else {
|
||||
return String.valueOf(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a parameter to a {@link MultiValueMap} for use in REST requests
|
||||
* @param collectionFormat The format to convert to
|
||||
* @param name The name of the parameter
|
||||
* @param value The parameter's value
|
||||
* @return a Map containing the String value(s) of the input parameter
|
||||
*/
|
||||
public MultiValueMap<String, String> parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) {
|
||||
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
|
||||
|
||||
if (name == null || name.isEmpty() || value == null) {
|
||||
return params;
|
||||
}
|
||||
|
||||
if(collectionFormat == null) {
|
||||
collectionFormat = CollectionFormat.CSV;
|
||||
}
|
||||
|
||||
if (value instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, Object> valuesMap = (Map<String, Object>) value;
|
||||
for (final Entry<String, Object> entry : valuesMap.entrySet()) {
|
||||
params.add(entry.getKey(), parameterToString(entry.getValue()));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
Collection<?> valueCollection = null;
|
||||
if (value instanceof Collection) {
|
||||
valueCollection = (Collection<?>) value;
|
||||
} else {
|
||||
params.add(name, parameterToString(value));
|
||||
return params;
|
||||
}
|
||||
|
||||
if (valueCollection.isEmpty()){
|
||||
return params;
|
||||
}
|
||||
|
||||
if (collectionFormat.equals(CollectionFormat.MULTI)) {
|
||||
for (Object item : valueCollection) {
|
||||
params.add(name, parameterToString(item));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
List<String> values = new ArrayList<>();
|
||||
for(Object o : valueCollection) {
|
||||
values.add(parameterToString(o));
|
||||
}
|
||||
params.add(name, collectionFormat.collectionToString(values));
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given {@code String} is a JSON MIME.
|
||||
* @param mediaType the input MediaType
|
||||
* @return boolean true if the MediaType represents JSON, false otherwise
|
||||
*/
|
||||
public boolean isJsonMime(String mediaType) {
|
||||
// "* / *" is default to JSON
|
||||
if ("*/*".equals(mediaType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
return isJsonMime(MediaType.parseMediaType(mediaType));
|
||||
} catch (InvalidMediaTypeException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* @param mediaType the input MediaType
|
||||
* @return boolean true if the MediaType represents JSON, false otherwise
|
||||
*/
|
||||
public boolean isJsonMime(MediaType mediaType) {
|
||||
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*(\\+json|ndjson)[;]?\\s*$"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given {@code String} is a Problem JSON MIME (RFC-7807).
|
||||
* @param mediaType the input MediaType
|
||||
* @return boolean true if the MediaType represents Problem JSON, false otherwise
|
||||
*/
|
||||
public boolean isProblemJsonMime(String mediaType) {
|
||||
return "application/problem+json".equalsIgnoreCase(mediaType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Accept header's value from the given accepts array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use all of them (joining into a string)
|
||||
*
|
||||
* @param accepts The accepts array to select from
|
||||
* @return List The list of MediaTypes to use for the Accept header
|
||||
*/
|
||||
public List<MediaType> selectHeaderAccept(String[] accepts) {
|
||||
if (accepts.length == 0) {
|
||||
return null;
|
||||
}
|
||||
for (String accept : accepts) {
|
||||
MediaType mediaType = MediaType.parseMediaType(accept);
|
||||
if (isJsonMime(mediaType) && !isProblemJsonMime(accept)) {
|
||||
return Collections.singletonList(mediaType);
|
||||
}
|
||||
}
|
||||
return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Content-Type header's value from the given array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use the first one of the array.
|
||||
*
|
||||
* @param contentTypes The Content-Type array to select from
|
||||
* @return MediaType The Content-Type header to use. If the given array is empty, null will be returned.
|
||||
*/
|
||||
public MediaType selectHeaderContentType(String[] contentTypes) {
|
||||
if (contentTypes.length == 0) {
|
||||
return null;
|
||||
}
|
||||
for (String contentType : contentTypes) {
|
||||
MediaType mediaType = MediaType.parseMediaType(contentType);
|
||||
if (isJsonMime(mediaType)) {
|
||||
return mediaType;
|
||||
}
|
||||
}
|
||||
return MediaType.parseMediaType(contentTypes[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the body to use for the request
|
||||
*
|
||||
* @param obj the body object
|
||||
* @param formParams the form parameters
|
||||
* @param contentType the content type of the request
|
||||
* @return Object the selected body
|
||||
*/
|
||||
protected Object selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) {
|
||||
boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType);
|
||||
return isForm ? formParams : obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke API by sending HTTP request with the given options.
|
||||
*
|
||||
* @param <T> the return type to use
|
||||
* @param path The sub-path of the HTTP URL
|
||||
* @param method The request method
|
||||
* @param pathParams The path parameters
|
||||
* @param queryParams The query parameters
|
||||
* @param body The request body object
|
||||
* @param headerParams The header parameters
|
||||
* @param formParams The form parameters
|
||||
* @param accept The request's Accept header
|
||||
* @param contentType The request's Content-Type header
|
||||
* @param authNames The authentications to apply
|
||||
* @param returnType The return type into which to deserialize the response
|
||||
* @return The response body in chosen type
|
||||
*/
|
||||
public <T> ResponseSpec invokeAPI(String path, HttpMethod method, Map<String, Object> pathParams, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
final RestClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames);
|
||||
return requestBuilder.retrieve();
|
||||
}
|
||||
|
||||
/**
|
||||
* Include queryParams in uriParams taking into account the paramName
|
||||
* @param queryParams The query parameters
|
||||
* @param uriParams The path parameters
|
||||
* return templatized query string
|
||||
*/
|
||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||
StringBuilder queryBuilder = new StringBuilder();
|
||||
queryParams.forEach((name, values) -> {
|
||||
if (CollectionUtils.isEmpty(values)) {
|
||||
if (queryBuilder.length() != 0) {
|
||||
queryBuilder.append('&');
|
||||
}
|
||||
queryBuilder.append(name);
|
||||
} else {
|
||||
int valueItemCounter = 0;
|
||||
for (Object value : values) {
|
||||
if (queryBuilder.length() != 0) {
|
||||
queryBuilder.append('&');
|
||||
}
|
||||
queryBuilder.append(name);
|
||||
if (value != null) {
|
||||
String templatizedKey = name + valueItemCounter++;
|
||||
uriParams.put(templatizedKey, value.toString());
|
||||
queryBuilder.append('=').append("{").append(templatizedKey).append("}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return queryBuilder.toString();
|
||||
}
|
||||
|
||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||
MediaType contentType, String[] authNames) {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
|
||||
|
||||
String finalUri = builder.build(false).toUriString();
|
||||
Map<String, Object> uriParams = new HashMap<>();
|
||||
uriParams.putAll(pathParams);
|
||||
|
||||
if (queryParams != null && !queryParams.isEmpty()) {
|
||||
//Include queryParams in uriParams taking into account the paramName
|
||||
String queryUri = generateQueryUri(queryParams, uriParams);
|
||||
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
|
||||
finalUri += "?" + queryUri;
|
||||
}
|
||||
|
||||
final RestClient.RequestBodySpec requestBuilder = restClient.method(method).uri(finalUri, uriParams);
|
||||
|
||||
if (accept != null) {
|
||||
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
|
||||
}
|
||||
if(contentType != null) {
|
||||
requestBuilder.contentType(contentType);
|
||||
}
|
||||
|
||||
addHeadersToRequest(headerParams, requestBuilder);
|
||||
addHeadersToRequest(defaultHeaders, requestBuilder);
|
||||
addCookiesToRequest(cookieParams, requestBuilder);
|
||||
addCookiesToRequest(defaultCookies, requestBuilder);
|
||||
|
||||
var selectedBody = selectBody(body, formParams, contentType);
|
||||
if (selectedBody != null) {
|
||||
requestBuilder.body(selectedBody);
|
||||
}
|
||||
|
||||
return requestBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add headers to the request that is being built
|
||||
* @param headers The headers to add
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addHeadersToRequest(HttpHeaders headers, RestClient.RequestBodySpec requestBuilder) {
|
||||
for (Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
List<String> values = entry.getValue();
|
||||
for(String value : values) {
|
||||
if (value != null) {
|
||||
requestBuilder.header(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add cookies to the request that is being built
|
||||
*
|
||||
* @param cookies The cookies to add
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, RestClient.RequestBodySpec requestBuilder) {
|
||||
if (!cookies.isEmpty()) {
|
||||
requestBuilder.header("Cookie", buildCookieHeader(cookies));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build cookie header. Keeps a single value per cookie (as per <a href="https://tools.ietf.org/html/rfc6265#section-5.3">
|
||||
* RFC6265 section 5.3</a>).
|
||||
*
|
||||
* @param cookies map all cookies
|
||||
* @return header string for cookies.
|
||||
*/
|
||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||
final StringBuilder cookieValue = new StringBuilder();
|
||||
String delimiter = "";
|
||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||
final String value = entry.getValue().get(entry.getValue().size() - 1);
|
||||
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
|
||||
delimiter = "; ";
|
||||
}
|
||||
return cookieValue.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update query and header parameters based on authentication settings.
|
||||
*
|
||||
* @param authNames The authentications to apply
|
||||
* @param queryParams The query parameters
|
||||
* @param headerParams The header parameters
|
||||
* @param cookieParams the cookie parameters
|
||||
*/
|
||||
protected void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
for (String authName : authNames) {
|
||||
Authentication auth = authentications.get(authName);
|
||||
if (auth == null) {
|
||||
throw new RestClientException("Authentication undefined: " + authName);
|
||||
}
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the specified collection path parameter to a string value.
|
||||
*
|
||||
* @param collectionFormat The collection format of the parameter.
|
||||
* @param values The values of the parameter.
|
||||
* @return String representation of the parameter
|
||||
*/
|
||||
public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection<?> values) {
|
||||
// create the value based on the collection format
|
||||
if (CollectionFormat.MULTI.equals(collectionFormat)) {
|
||||
// not valid for path params
|
||||
return parameterToString(values);
|
||||
}
|
||||
|
||||
// collectionFormat is assumed to be "csv" by default
|
||||
if(collectionFormat == null) {
|
||||
collectionFormat = CollectionFormat.CSV;
|
||||
}
|
||||
|
||||
return collectionFormat.collectionToString(values);
|
||||
}
|
||||
}
|
248
modules/openapi-generator/src/main/resources/Java/libraries/restclient/README.mustache
vendored
Normal file
248
modules/openapi-generator/src/main/resources/Java/libraries/restclient/README.mustache
vendored
Normal file
@ -0,0 +1,248 @@
|
||||
# {{artifactId}}
|
||||
|
||||
{{appName}}
|
||||
|
||||
- API version: {{appVersion}}
|
||||
{{^hideGenerationTimestamp}}
|
||||
|
||||
- Build date: {{generatedDate}}
|
||||
{{/hideGenerationTimestamp}}
|
||||
|
||||
- Generator version: {{generatorVersion}}
|
||||
|
||||
{{{appDescriptionWithNewLines}}}
|
||||
|
||||
{{#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 17+
|
||||
{{#jersey2}}
|
||||
2. Maven (3.8.3+)/Gradle (7.2+)
|
||||
{{/jersey2}}
|
||||
{{^jersey2}}
|
||||
2. Maven/Gradle
|
||||
{{/jersey2}}
|
||||
|
||||
## 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
|
||||
repositories {
|
||||
mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central.
|
||||
mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo.
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "{{{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`
|
||||
|
||||
{{#jersey2}}
|
||||
## Usage
|
||||
|
||||
To add a HTTP proxy for the API client, use `ClientConfig`:
|
||||
```java
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
|
||||
import org.glassfish.jersey.client.ClientConfig;
|
||||
import org.glassfish.jersey.client.ClientProperties;
|
||||
import {{{invokerPackage}}}.*;
|
||||
import {{{package}}}.{{{classname}}};
|
||||
|
||||
...
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
ClientConfig clientConfig = defaultClient.getClientConfig();
|
||||
clientConfig.connectorProvider(new ApacheConnectorProvider());
|
||||
clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here");
|
||||
clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username");
|
||||
clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password");
|
||||
defaultClient.setClientConfig(clientConfig);
|
||||
|
||||
{{{classname}}} apiInstance = new {{{classname}}}(defaultClient);
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
{{/jersey2}}
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||
|
||||
```java
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||
import {{{invokerPackage}}}.*;
|
||||
import {{{invokerPackage}}}.auth.*;
|
||||
import {{{modelPackage}}}.*;
|
||||
import {{{package}}}.{{{classname}}};
|
||||
|
||||
public class {{{classname}}}Example {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("{{{basePath}}}");
|
||||
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setUsername("YOUR USERNAME");
|
||||
{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}}
|
||||
// Configure HTTP bearer authorization: {{{name}}}
|
||||
HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setApiKey("YOUR API KEY");
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}}{{#isHttpSignature}}
|
||||
// Configure HTTP signature authorization: {{{name}}}
|
||||
HttpSignatureAuth {{{name}}} = (HttpSignatureAuth) defaultClient.getAuthentication("{{{name}}}");
|
||||
// All the HTTP signature parameters below should be customized to your environment.
|
||||
// Configure the keyId
|
||||
{{{name}}}.setKeyId("YOUR KEY ID");
|
||||
// Configure the signature algorithm
|
||||
{{{name}}}.setSigningAlgorithm(SigningAlgorithm.HS2019);
|
||||
// Configure the specific cryptographic algorithm
|
||||
{{{name}}}.setAlgorithm(Algorithm.ECDSA_SHA256);
|
||||
// Configure the cryptographic algorithm parameters, if applicable
|
||||
{{{name}}}.setAlgorithmParameterSpec(null);
|
||||
// Set the cryptographic digest algorithm.
|
||||
{{{name}}}.setDigestAlgorithm("SHA-256");
|
||||
// Set the HTTP headers that should be included in the HTTP signature.
|
||||
{{{name}}}.setHeaders(Arrays.asList("date", "host"));
|
||||
// Set the private key used to sign the HTTP messages
|
||||
{{{name}}}.setPrivateKey();{{/isHttpSignature}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{{classname}}} apiInstance = new {{{classname}}}(defaultClient);
|
||||
{{#allParams}}
|
||||
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/allParams}}
|
||||
try {
|
||||
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/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}}** {{commonPath}}{{path}} | {{summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
<a id="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
|
||||
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
<a id="{{name}}"></a>
|
||||
### {{name}}
|
||||
|
||||
{{#isApiKey}}
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: {{keyParamName}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasicBasic}}
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
{{/isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
|
||||
- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
|
||||
{{/isBasicBearer}}
|
||||
{{#isHttpSignature}}
|
||||
|
||||
- **Type**: HTTP signature authentication
|
||||
{{/isHttpSignature}}
|
||||
{{#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.
|
||||
|
||||
## Author
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
|
||||
{{/-last}}{{/apis}}{{/apiInfo}}
|
185
modules/openapi-generator/src/main/resources/Java/libraries/restclient/api.mustache
vendored
Normal file
185
modules/openapi-generator/src/main/resources/Java/libraries/restclient/api.mustache
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
package {{package}};
|
||||
|
||||
import {{invokerPackage}}.ApiClient;
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public {{classname}}() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public {{classname}}(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#responses}} * <p><b>{{code}}</b>{{#message}} - {{.}}{{/message}}
|
||||
{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}}
|
||||
{{/allParams}}{{#returnType}} * @return {{.}}
|
||||
{{/returnType}} * @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
{{#externalDocs}}
|
||||
* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||
{{/externalDocs}}
|
||||
{{#isDeprecated}}
|
||||
* @deprecated
|
||||
{{/isDeprecated}}
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
private ResponseSpec {{operationId}}RequestCreation({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.AbstractResource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException {
|
||||
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
// verify the required parameter '{{paramName}}' is set
|
||||
if ({{paramName}} == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter '{{paramName}}' when calling {{operationId}}", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
{{#hasPathParams}}
|
||||
|
||||
{{#pathParams}}
|
||||
pathParams.put("{{baseName}}", {{#collectionFormat}}apiClient.collectionPathParameterToString(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), {{/collectionFormat}}{{{paramName}}}{{#collectionFormat}}){{/collectionFormat}});
|
||||
{{/pathParams}}
|
||||
{{/hasPathParams}}
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
{{#hasQueryParams}}
|
||||
|
||||
{{#queryParams}}{{#isExplode}}{{#hasVars}}{{#vars}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}.{{getter}}()));
|
||||
{{/vars}}{{/hasVars}}{{^hasVars}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));
|
||||
{{/hasVars}}{{/isExplode}}{{^isExplode}}queryParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));
|
||||
{{/isExplode}}{{/queryParams}}{{/hasQueryParams}}{{#hasHeaderParams}}
|
||||
|
||||
{{#headerParams}}
|
||||
if ({{paramName}} != null)
|
||||
headerParams.add("{{baseName}}", apiClient.parameterToString({{paramName}}));{{^-last}}
|
||||
{{/-last}}
|
||||
{{/headerParams}}
|
||||
{{/hasHeaderParams}}
|
||||
{{#hasCookieParams}}
|
||||
|
||||
{{#cookieParams}}
|
||||
cookieParams.putAll(apiClient.parameterToMultiValueMap({{#collectionFormat}}ApiClient.CollectionFormat.valueOf("{{{.}}}".toUpperCase(Locale.ROOT)){{/collectionFormat}}{{^collectionFormat}}null{{/collectionFormat}}, "{{baseName}}", {{paramName}}));
|
||||
{{/cookieParams}}
|
||||
{{/hasCookieParams}}
|
||||
{{#hasFormParams}}
|
||||
|
||||
{{#formParams}}
|
||||
if ({{paramName}} != null)
|
||||
formParams.add{{#collectionFormat}}All{{/collectionFormat}}("{{baseName}}", {{#isFile}}{{^collectionFormat}}{{#useAbstractionForFiles}}{{paramName}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}new FileSystemResource({{paramName}}){{/useAbstractionForFiles}}{{/collectionFormat}}{{/isFile}}{{#isFile}}{{#collectionFormat}}{{paramName}}.stream(){{^useAbstractionForFiles}}.map(FileSystemResource::new){{/useAbstractionForFiles}}.collect(Collectors.toList()){{/collectionFormat}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}});
|
||||
{{/formParams}}
|
||||
{{/hasFormParams}}
|
||||
|
||||
final String[] localVarAccepts = { {{#hasProduces}}
|
||||
{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}
|
||||
{{/hasProduces}}};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { {{#hasConsumes}}
|
||||
{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}
|
||||
{{/hasConsumes}}};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} };
|
||||
|
||||
{{#returnType}}ParameterizedTypeReference<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}
|
||||
return apiClient.invokeAPI("{{{path}}}", HttpMethod.{{httpMethod}}, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#responses}} * <p><b>{{code}}</b>{{#message}} - {{.}}{{/message}}
|
||||
{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}}
|
||||
{{/allParams}}{{#returnType}} * @return {{.}}
|
||||
{{/returnType}} * @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
{{#externalDocs}}
|
||||
* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||
{{/externalDocs}}
|
||||
*/
|
||||
public {{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.AbstractResource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException {
|
||||
{{#returnType}}ParameterizedTypeReference<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}
|
||||
{{#returnType}}return {{/returnType}}{{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#responses}} * <p><b>{{code}}</b>{{#message}} - {{.}}{{/message}}
|
||||
{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}}
|
||||
{{/allParams}}{{#returnType}} * @return ResponseEntity<{{.}}>
|
||||
{{/returnType}} * @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
{{#externalDocs}}
|
||||
* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||
{{/externalDocs}}
|
||||
*/
|
||||
public {{#returnType}}ResponseEntity<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}ResponseEntity<Void>{{/returnType}} {{operationId}}WithHttpInfo({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.AbstractResource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException {
|
||||
{{#returnType}}ParameterizedTypeReference<{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{returnType}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}{{^returnType}}ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<>() {};{{/returnType}}
|
||||
return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {{summary}}
|
||||
* {{notes}}
|
||||
{{#responses}} * <p><b>{{code}}</b>{{#message}} - {{.}}{{/message}}
|
||||
{{/responses}}{{#allParams}} * @param {{paramName}} {{description}}{{^description}}The {{paramName}} parameter{{/description}}
|
||||
{{/allParams}}
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
{{#externalDocs}}
|
||||
* {{description}}
|
||||
* @see <a href="{{url}}">{{summary}} Documentation</a>
|
||||
{{/externalDocs}}
|
||||
*/
|
||||
public ResponseSpec {{operationId}}WithResponseSpec({{#allParams}}{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.AbstractResource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws RestClientResponseException {
|
||||
return {{operationId}}RequestCreation({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
40
modules/openapi-generator/src/main/resources/Java/libraries/restclient/api_test.mustache
vendored
Normal file
40
modules/openapi-generator/src/main/resources/Java/libraries/restclient/api_test.mustache
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
{{>licenseInfo}}
|
||||
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API tests for {{classname}}
|
||||
*/
|
||||
@Ignore
|
||||
public class {{classname}}Test {
|
||||
|
||||
private final {{classname}} api = new {{classname}}();
|
||||
|
||||
{{#operations}}{{#operation}}
|
||||
/**
|
||||
* {{summary}}
|
||||
*
|
||||
* {{notes}}
|
||||
*/
|
||||
@Test
|
||||
public void {{operationId}}Test() {
|
||||
{{#allParams}}
|
||||
{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.AbstractResource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.AbstractResource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null;
|
||||
{{/allParams}}
|
||||
{{#returnType}}{{#isResponseFile}}{{#useAbstractionForFiles}}org.springframework.core.io.Resource{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{.}}}{{/useAbstractionForFiles}}{{/isResponseFile}}{{^isResponseFile}}{{{.}}}{{/isResponseFile}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
{{/operation}}{{/operations}}
|
||||
}
|
62
modules/openapi-generator/src/main/resources/Java/libraries/restclient/auth/ApiKeyAuth.mustache
vendored
Normal file
62
modules/openapi-generator/src/main/resources/Java/libraries/restclient/auth/ApiKeyAuth.mustache
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
private String apiKey;
|
||||
private String apiKeyPrefix;
|
||||
|
||||
public ApiKeyAuth(String location, String paramName) {
|
||||
this.location = location;
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public String getApiKeyPrefix() {
|
||||
return apiKeyPrefix;
|
||||
}
|
||||
|
||||
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||
this.apiKeyPrefix = apiKeyPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (apiKey == null) {
|
||||
return;
|
||||
}
|
||||
String value;
|
||||
if (apiKeyPrefix != null) {
|
||||
value = apiKeyPrefix + " " + apiKey;
|
||||
} else {
|
||||
value = apiKey;
|
||||
}
|
||||
if (location.equals("query")) {
|
||||
queryParams.add(paramName, value);
|
||||
} else if (location.equals("header")) {
|
||||
headerParams.add(paramName, value);
|
||||
} else if (location.equals("cookie")) {
|
||||
cookieParams.add(paramName, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and / or query parameters.
|
||||
* @param queryParams The query parameters for the request
|
||||
* @param headerParams The header parameters for the request
|
||||
* @param cookieParams The cookie parameters for the request
|
||||
*/
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (username == null && password == null) {
|
||||
return;
|
||||
}
|
||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
public HttpBearerAuth(String scheme) {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @return The bearer token
|
||||
*/
|
||||
public String getBearerToken() {
|
||||
return tokenSupplier.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @param bearerToken The bearer token to send in the Authorization header
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
this.tokenSupplier = () -> bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @param tokenSupplier The supplier of bearer tokens to send in the Authorization header
|
||||
*/
|
||||
public void setBearerToken(Supplier<String> tokenSupplier) {
|
||||
this.tokenSupplier = tokenSupplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null);
|
||||
if (bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||
}
|
||||
|
||||
private static String upperCaseBearer(String scheme) {
|
||||
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||
}
|
||||
}
|
24
modules/openapi-generator/src/main/resources/Java/libraries/restclient/auth/OAuth.mustache
vendored
Normal file
24
modules/openapi-generator/src/main/resources/Java/libraries/restclient/auth/OAuth.mustache
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class OAuth implements Authentication {
|
||||
private String accessToken;
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (accessToken != null) {
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
public enum OAuthFlow {
|
||||
accessCode, implicit, password, application
|
||||
}
|
159
modules/openapi-generator/src/main/resources/Java/libraries/restclient/build.gradle.mustache
vendored
Normal file
159
modules/openapi-generator/src/main/resources/Java/libraries/restclient/build.gradle.mustache
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
group = '{{groupId}}'
|
||||
version = '{{artifactVersion}}'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
if(hasProperty('target') && target == 'android') {
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion '23.0.2'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 22
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDirectory
|
||||
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
archiveClassifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
artifactId = '{{artifactId}}'
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
mainClass = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
swagger_annotations_version = "1.6.9"
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
swagger_annotations_version = "2.2.9"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
jackson_version = "2.14.2"
|
||||
jackson_databind_version = "2.15.1"
|
||||
{{#openApiNullable}}
|
||||
jackson_databind_nullable_version = "0.2.6"
|
||||
{{/openApiNullable}}
|
||||
spring_web_version = "6.1.6"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
implementation "io.swagger.core.v3:swagger-annotations:$swagger_annotations_version"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.springframework:spring-web:$spring_web_version"
|
||||
implementation "org.springframework:spring-context:$spring_web_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
{{#openApiNullable}}
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
{{/openApiNullable}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
{{#joda}}
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
implementation "joda-time:joda-time:$jodatime_version"
|
||||
{{/joda}}
|
||||
{{#withXml}}
|
||||
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
{{/withXml}}
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
||||
test {
|
||||
// Enable JUnit 5 (Gradle 4.6+).
|
||||
useJUnitPlatform()
|
||||
|
||||
// Always run tests, even when nothing changed.
|
||||
dependsOn 'cleanTest'
|
||||
|
||||
// Show test results.
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
|
||||
}
|
374
modules/openapi-generator/src/main/resources/Java/libraries/restclient/pom.mustache
vendored
Normal file
374
modules/openapi-generator/src/main/resources/Java/libraries/restclient/pom.mustache
vendored
Normal file
@ -0,0 +1,374 @@
|
||||
<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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>2.2.0</version>
|
||||
</requireMavenVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemPropertyVariables>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
<useUnlimitedThreads>true</useUnlimitedThreads>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<!--Custom provider and engine for Junit 5 to surefire-->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<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.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
</dependency>
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>${swagger-annotations-version}</version>
|
||||
</dependency>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Spring RestClient -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring-web-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring-web-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-databind-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
|
||||
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#openApiNullable}}
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>${jackson-databind-nullable-version}</version>
|
||||
</dependency>
|
||||
{{/openApiNullable}}
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.threeten-jaxb</groupId>
|
||||
<artifactId>threeten-jaxb-core</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
{{/withXml}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-joda</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>${jodatime-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
{{#useBeanValidation}}
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>${beanvalidation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
{{/useBeanValidation}}
|
||||
{{#performBeanValidation}}
|
||||
<!-- Bean Validation Impl. used to perform BeanValidation -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator-version}</version>
|
||||
</dependency>
|
||||
{{/performBeanValidation}}
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${jakarta-annotation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-runner</artifactId>
|
||||
<version>${junit-platform-runner.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
{{#swagger1AnnotationLibrary}}
|
||||
<swagger-annotations-version>1.6.9</swagger-annotations-version>
|
||||
{{/swagger1AnnotationLibrary}}
|
||||
{{#swagger2AnnotationLibrary}}
|
||||
<swagger-annotations-version>2.2.15</swagger-annotations-version>
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
<spring-web-version>6.1.6</spring-web-version>
|
||||
<jackson-version>2.15.2</jackson-version>
|
||||
<jackson-databind-version>2.15.2</jackson-databind-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
{{#joda}}
|
||||
<jodatime-version>2.9.9</jodatime-version>
|
||||
{{/joda}}
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
{{#performBeanValidation}}
|
||||
<hibernate-validator-version>5.4.3.Final</hibernate-validator-version>
|
||||
{{/performBeanValidation}}
|
||||
<junit-version>5.10.2</junit-version>
|
||||
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
|
||||
</properties>
|
||||
</project>
|
@ -3218,4 +3218,209 @@ public class JavaClientCodegenTest {
|
||||
JavaFileAssert.assertThat(files.get("Cat.java"))
|
||||
.assertConstructor("Integer", "String", "LocalDate", "String", "String");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestClientFormMultipart() throws IOException {
|
||||
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
|
||||
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("java")
|
||||
.setLibrary(JavaClientCodegen.RESTCLIENT)
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/3_0/form-multipart-binary-array.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
|
||||
Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/MultipartApi.java");
|
||||
TestUtils.assertFileContains(
|
||||
defaultApi,
|
||||
// multiple files
|
||||
"multipartArray(List<File> files)",
|
||||
"formParams.addAll(\"files\","
|
||||
+ " files.stream().map(FileSystemResource::new).collect(Collectors.toList()));",
|
||||
|
||||
// mixed
|
||||
"multipartMixed(MultipartMixedStatus status, File _file, MultipartMixedRequestMarker marker, List<MultipartMixedStatus> statusArray)",
|
||||
"formParams.add(\"file\", new FileSystemResource(_file));",
|
||||
|
||||
// single file
|
||||
"multipartSingle(File _file)",
|
||||
"formParams.add(\"file\", new FileSystemResource(_file));");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestClientWithUseAbstractionForFiles() throws IOException {
|
||||
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
|
||||
properties.put(JavaClientCodegen.USE_ABSTRACTION_FOR_FILES, true);
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("java")
|
||||
.setLibrary(JavaClientCodegen.RESTCLIENT)
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/3_0/form-multipart-binary-array.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
|
||||
Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/MultipartApi.java");
|
||||
TestUtils.assertFileContains(
|
||||
defaultApi,
|
||||
// multiple files
|
||||
"multipartArray(java.util.Collection<org.springframework.core.io.AbstractResource> files)",
|
||||
"formParams.addAll(\"files\", files.stream().collect(Collectors.toList()));",
|
||||
|
||||
// mixed
|
||||
"multipartMixed(MultipartMixedStatus status, org.springframework.core.io.AbstractResource _file, MultipartMixedRequestMarker marker, List<MultipartMixedStatus> statusArray)",
|
||||
"formParams.add(\"file\", _file);",
|
||||
|
||||
// single file
|
||||
"multipartSingle(org.springframework.core.io.AbstractResource _file)",
|
||||
"formParams.add(\"file\", _file);");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestClientWithFreeFormInQueryParameters() throws IOException {
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
|
||||
|
||||
final File output = Files.createTempDirectory("test")
|
||||
.toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator().setGeneratorName("java")
|
||||
.setLibrary(JavaClientCodegen.RESTCLIENT)
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/3_0/issue8352.yaml")
|
||||
.setOutputDir(output.getAbsolutePath()
|
||||
.replace("\\", "/"));
|
||||
|
||||
final DefaultGenerator generator = new DefaultGenerator();
|
||||
final List<File> files = generator.opts(configurator.toClientOptInput())
|
||||
.generate();
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
|
||||
final Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/ApiClient.java");
|
||||
TestUtils.assertFileContains(defaultApi, "value instanceof Map");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestClientJsonCreatorWithNullable_issue12790() throws Exception {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(AbstractJavaCodegen.OPENAPI_NULLABLE, "true");
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setAdditionalProperties(properties)
|
||||
.setGeneratorName("java")
|
||||
.setLibrary(JavaClientCodegen.RESTCLIENT)
|
||||
.setInputSpec("src/test/resources/bugs/issue_12790.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
Map<String, File> files = generator.opts(clientOptInput).generate().stream()
|
||||
.collect(Collectors.toMap(File::getName, Function.identity()));
|
||||
|
||||
JavaFileAssert.assertThat(files.get("TestObject.java"))
|
||||
.printFileContent()
|
||||
.assertConstructor("String", "String")
|
||||
.bodyContainsLines(
|
||||
"this.nullableProperty = nullableProperty == null ? JsonNullable.<String>undefined() :"
|
||||
+ " JsonNullable.of(nullableProperty);",
|
||||
"this.notNullableProperty = notNullableProperty;");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestClientSupportListOfStringReturnType_issue7118() throws IOException {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
|
||||
properties.put(JavaClientCodegen.USE_ABSTRACTION_FOR_FILES, true);
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("java")
|
||||
.setLibrary(JavaClientCodegen.RESTCLIENT)
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/bugs/issue_7118.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
|
||||
Path userApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/UsersApi.java");
|
||||
TestUtils.assertFileContains(
|
||||
userApi,
|
||||
// set of string
|
||||
"ParameterizedTypeReference<Set<String>> localVarReturnType = new"
|
||||
+ " ParameterizedTypeReference<>() {};",
|
||||
"getUserIdSetRequestCreation().toEntity(localVarReturnType)",
|
||||
// list of string
|
||||
"ParameterizedTypeReference<List<String>> localVarReturnType = new"
|
||||
+ " ParameterizedTypeReference<>() {};",
|
||||
"getUserIdListRequestCreation().toEntity(localVarReturnType)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestClientResponseTypeWithUseAbstractionForFiles_issue16589() throws IOException {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api");
|
||||
properties.put(JavaClientCodegen.USE_ABSTRACTION_FOR_FILES, true);
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("java")
|
||||
.setLibrary(JavaClientCodegen.RESTCLIENT)
|
||||
.setAdditionalProperties(properties)
|
||||
.setInputSpec("src/test/resources/3_0/issue13146_file_abstraction_response.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
|
||||
Path defaultApi = Paths.get(output + "/src/main/java/xyz/abcdef/api/ResourceApi.java");
|
||||
|
||||
TestUtils.assertFileContains(defaultApi,
|
||||
"org.springframework.core.io.Resource resourceInResponse()",
|
||||
"ResponseEntity<org.springframework.core.io.Resource> resourceInResponseWithHttpInfo()",
|
||||
"ParameterizedTypeReference<org.springframework.core.io.Resource> localVarReturnType = new ParameterizedTypeReference<>()"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
30
samples/client/echo_api/java/restclient/.github/workflows/maven.yml
vendored
Normal file
30
samples/client/echo_api/java/restclient/.github/workflows/maven.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
#
|
||||
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
name: Java CI with Maven
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Echo Server API
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ 17, 21 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --no-transfer-progress --file pom.xml
|
21
samples/client/echo_api/java/restclient/.gitignore
vendored
Normal file
21
samples/client/echo_api/java/restclient/.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,62 @@
|
||||
.github/workflows/maven.yml
|
||||
.gitignore
|
||||
.travis.yml
|
||||
README.md
|
||||
api/openapi.yaml
|
||||
build.gradle
|
||||
build.sbt
|
||||
docs/AuthApi.md
|
||||
docs/Bird.md
|
||||
docs/BodyApi.md
|
||||
docs/Category.md
|
||||
docs/DataQuery.md
|
||||
docs/DefaultValue.md
|
||||
docs/FormApi.md
|
||||
docs/HeaderApi.md
|
||||
docs/NumberPropertiesOnly.md
|
||||
docs/PathApi.md
|
||||
docs/Pet.md
|
||||
docs/Query.md
|
||||
docs/QueryApi.md
|
||||
docs/StringEnumRef.md
|
||||
docs/Tag.md
|
||||
docs/TestFormObjectMultipartRequestMarker.md
|
||||
docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
|
||||
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
|
||||
git_push.sh
|
||||
gradle.properties
|
||||
gradle/wrapper/gradle-wrapper.jar
|
||||
gradle/wrapper/gradle-wrapper.properties
|
||||
gradlew
|
||||
gradlew.bat
|
||||
pom.xml
|
||||
settings.gradle
|
||||
src/main/AndroidManifest.xml
|
||||
src/main/java/org/openapitools/client/ApiClient.java
|
||||
src/main/java/org/openapitools/client/JavaTimeFormatter.java
|
||||
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||
src/main/java/org/openapitools/client/ServerVariable.java
|
||||
src/main/java/org/openapitools/client/StringUtil.java
|
||||
src/main/java/org/openapitools/client/api/AuthApi.java
|
||||
src/main/java/org/openapitools/client/api/BodyApi.java
|
||||
src/main/java/org/openapitools/client/api/FormApi.java
|
||||
src/main/java/org/openapitools/client/api/HeaderApi.java
|
||||
src/main/java/org/openapitools/client/api/PathApi.java
|
||||
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||
src/main/java/org/openapitools/client/auth/Authentication.java
|
||||
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
|
||||
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
|
||||
src/main/java/org/openapitools/client/model/Bird.java
|
||||
src/main/java/org/openapitools/client/model/Category.java
|
||||
src/main/java/org/openapitools/client/model/DataQuery.java
|
||||
src/main/java/org/openapitools/client/model/DefaultValue.java
|
||||
src/main/java/org/openapitools/client/model/NumberPropertiesOnly.java
|
||||
src/main/java/org/openapitools/client/model/Pet.java
|
||||
src/main/java/org/openapitools/client/model/Query.java
|
||||
src/main/java/org/openapitools/client/model/StringEnumRef.java
|
||||
src/main/java/org/openapitools/client/model/Tag.java
|
||||
src/main/java/org/openapitools/client/model/TestFormObjectMultipartRequestMarker.java
|
||||
src/main/java/org/openapitools/client/model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.java
|
||||
src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java
|
@ -0,0 +1 @@
|
||||
7.6.0-SNAPSHOT
|
22
samples/client/echo_api/java/restclient/.travis.yml
Normal file
22
samples/client/echo_api/java/restclient/.travis.yml
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Generated by OpenAPI Generator: https://openapi-generator.tech
|
||||
#
|
||||
# Ref: https://docs.travis-ci.com/user/languages/java/
|
||||
#
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk12
|
||||
- openjdk11
|
||||
- openjdk10
|
||||
- openjdk9
|
||||
- openjdk8
|
||||
before_install:
|
||||
# ensure gradlew has proper permission
|
||||
- chmod a+x ./gradlew
|
||||
script:
|
||||
# test using maven
|
||||
#- mvn test
|
||||
# test using gradle
|
||||
- gradle test
|
||||
# test using sbt
|
||||
# - sbt test
|
192
samples/client/echo_api/java/restclient/README.md
Normal file
192
samples/client/echo_api/java/restclient/README.md
Normal file
@ -0,0 +1,192 @@
|
||||
# echo-api-native
|
||||
|
||||
Echo Server API
|
||||
|
||||
- API version: 0.1.0
|
||||
|
||||
- Generator version: 7.6.0-SNAPSHOT
|
||||
|
||||
Echo Server API
|
||||
|
||||
|
||||
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires:
|
||||
|
||||
1. Java 17+
|
||||
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>echo-api-native</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle users
|
||||
|
||||
Add this dependency to your project's build file:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral() // Needed if the 'echo-api-native' jar has been published to maven central.
|
||||
mavenLocal() // Needed if the 'echo-api-native' jar has been published to the local maven repo.
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.openapitools:echo-api-native:0.1.0"
|
||||
}
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
At first generate the JAR by executing:
|
||||
|
||||
```shell
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
Then manually install the following JARs:
|
||||
|
||||
- `target/echo-api-native-0.1.0.jar`
|
||||
- `target/lib/*.jar`
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||
|
||||
```java
|
||||
|
||||
import org.openapitools.client.*;
|
||||
import org.openapitools.client.auth.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.AuthApi;
|
||||
|
||||
public class AuthApiExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
// Configure HTTP basic authorization: http_auth
|
||||
HttpBasicAuth http_auth = (HttpBasicAuth) defaultClient.getAuthentication("http_auth");
|
||||
http_auth.setUsername("YOUR USERNAME");
|
||||
http_auth.setPassword("YOUR PASSWORD");
|
||||
|
||||
AuthApi apiInstance = new AuthApi(defaultClient);
|
||||
try {
|
||||
String result = apiInstance.testAuthHttpBasic();
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling AuthApi#testAuthHttpBasic");
|
||||
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://localhost:3000*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AuthApi* | [**testAuthHttpBasic**](docs/AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication
|
||||
*AuthApi* | [**testAuthHttpBearer**](docs/AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication
|
||||
*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body
|
||||
*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s)
|
||||
*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
|
||||
*BodyApi* | [**testBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime
|
||||
*BodyApi* | [**testEchoBodyAllOfPet**](docs/BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||
*BodyApi* | [**testEchoBodyStringEnum**](docs/BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body
|
||||
*BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
|
||||
*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
|
||||
*FormApi* | [**testFormObjectMultipart**](docs/FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema
|
||||
*FormApi* | [**testFormOneof**](docs/FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
|
||||
*HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
|
||||
*PathApi* | [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
|
||||
*QueryApi* | [**testEnumRefString**](docs/QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryDatetimeDateString**](docs/QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleFormExplodeFalseArrayInteger**](docs/QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleFormExplodeFalseArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [Bird](docs/Bird.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [DataQuery](docs/DataQuery.md)
|
||||
- [DefaultValue](docs/DefaultValue.md)
|
||||
- [NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [Query](docs/Query.md)
|
||||
- [StringEnumRef](docs/StringEnumRef.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TestFormObjectMultipartRequestMarker](docs/TestFormObjectMultipartRequestMarker.md)
|
||||
- [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
|
||||
- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
|
||||
|
||||
|
||||
<a id="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
<a id="http_auth"></a>
|
||||
### http_auth
|
||||
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
<a id="http_bearer_auth"></a>
|
||||
### http_bearer_auth
|
||||
|
||||
|
||||
- **Type**: HTTP Bearer Token authentication
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||
|
||||
## Author
|
||||
|
||||
team@openapitools.org
|
||||
|
1004
samples/client/echo_api/java/restclient/api/openapi.yaml
Normal file
1004
samples/client/echo_api/java/restclient/api/openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
136
samples/client/echo_api/java/restclient/build.gradle
Normal file
136
samples/client/echo_api/java/restclient/build.gradle
Normal file
@ -0,0 +1,136 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
group = 'org.openapitools'
|
||||
version = '0.1.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
|
||||
if(hasProperty('target') && target == 'android') {
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion '23.0.2'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 22
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDirectory
|
||||
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
archiveClassifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
artifactId = 'echo-api-native'
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
mainClass = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
jackson_version = "2.14.2"
|
||||
jackson_databind_version = "2.15.1"
|
||||
jackson_databind_nullable_version = "0.2.6"
|
||||
spring_web_version = "6.1.6"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "5.10.2"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
implementation "org.springframework:spring-web:$spring_web_version"
|
||||
implementation "org.springframework:spring-context:$spring_web_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
||||
test {
|
||||
// Enable JUnit 5 (Gradle 4.6+).
|
||||
useJUnitPlatform()
|
||||
|
||||
// Always run tests, even when nothing changed.
|
||||
dependsOn 'cleanTest'
|
||||
|
||||
// Show test results.
|
||||
testLogging {
|
||||
events "passed", "skipped", "failed"
|
||||
}
|
||||
|
||||
}
|
1
samples/client/echo_api/java/restclient/build.sbt
Normal file
1
samples/client/echo_api/java/restclient/build.sbt
Normal file
@ -0,0 +1 @@
|
||||
# TODO
|
145
samples/client/echo_api/java/restclient/docs/AuthApi.md
Normal file
145
samples/client/echo_api/java/restclient/docs/AuthApi.md
Normal file
@ -0,0 +1,145 @@
|
||||
# AuthApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testAuthHttpBasic**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication |
|
||||
| [**testAuthHttpBearer**](AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication |
|
||||
|
||||
|
||||
|
||||
## testAuthHttpBasic
|
||||
|
||||
> String testAuthHttpBasic()
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
### 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.AuthApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
// Configure HTTP basic authorization: http_auth
|
||||
HttpBasicAuth http_auth = (HttpBasicAuth) defaultClient.getAuthentication("http_auth");
|
||||
http_auth.setUsername("YOUR USERNAME");
|
||||
http_auth.setPassword("YOUR PASSWORD");
|
||||
|
||||
AuthApi apiInstance = new AuthApi(defaultClient);
|
||||
try {
|
||||
String result = apiInstance.testAuthHttpBasic();
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling AuthApi#testAuthHttpBasic");
|
||||
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
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_auth](../README.md#http_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testAuthHttpBearer
|
||||
|
||||
> String testAuthHttpBearer()
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
To test HTTP bearer authentication
|
||||
|
||||
### 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.AuthApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
// Configure HTTP bearer authorization: http_bearer_auth
|
||||
HttpBearerAuth http_bearer_auth = (HttpBearerAuth) defaultClient.getAuthentication("http_bearer_auth");
|
||||
http_bearer_auth.setBearerToken("BEARER TOKEN");
|
||||
|
||||
AuthApi apiInstance = new AuthApi(defaultClient);
|
||||
try {
|
||||
String result = apiInstance.testAuthHttpBearer();
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling AuthApi#testAuthHttpBearer");
|
||||
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
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_bearer_auth](../README.md#http_bearer_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
14
samples/client/echo_api/java/restclient/docs/Bird.md
Normal file
14
samples/client/echo_api/java/restclient/docs/Bird.md
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# Bird
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**size** | **String** | | [optional] |
|
||||
|**color** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
674
samples/client/echo_api/java/restclient/docs/BodyApi.md
Normal file
674
samples/client/echo_api/java/restclient/docs/BodyApi.md
Normal file
@ -0,0 +1,674 @@
|
||||
# BodyApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body |
|
||||
| [**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) |
|
||||
| [**testBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime |
|
||||
| [**testBodyMultipartFormdataSingleBinary**](BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime |
|
||||
| [**testEchoBodyAllOfPet**](BodyApi.md#testEchoBodyAllOfPet) | **POST** /echo/body/allOf/Pet | Test body parameter(s) |
|
||||
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
||||
| [**testEchoBodyStringEnum**](BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body |
|
||||
| [**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) |
|
||||
|
||||
|
||||
|
||||
## testBinaryGif
|
||||
|
||||
> File testBinaryGif()
|
||||
|
||||
Test binary (gif) response body
|
||||
|
||||
Test binary (gif) response 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
try {
|
||||
File result = apiInstance.testBinaryGif();
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testBinaryGif");
|
||||
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
|
||||
|
||||
[**File**](File.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/gif
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testBodyApplicationOctetstreamBinary
|
||||
|
||||
> String testBodyApplicationOctetstreamBinary(body)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
File body = new File("/path/to/file"); // File |
|
||||
try {
|
||||
String result = apiInstance.testBodyApplicationOctetstreamBinary(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testBodyApplicationOctetstreamBinary");
|
||||
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** | **File**| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/octet-stream
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testBodyMultipartFormdataArrayOfBinary
|
||||
|
||||
> String testBodyMultipartFormdataArrayOfBinary(files)
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
### 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
List<File> files = Arrays.asList(); // List<File> |
|
||||
try {
|
||||
String result = apiInstance.testBodyMultipartFormdataArrayOfBinary(files);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testBodyMultipartFormdataArrayOfBinary");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **files** | **List<File>**| | |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testBodyMultipartFormdataSingleBinary
|
||||
|
||||
> String testBodyMultipartFormdataSingleBinary(myFile)
|
||||
|
||||
Test single binary in multipart mime
|
||||
|
||||
Test single binary in multipart mime
|
||||
|
||||
### 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
File myFile = new File("/path/to/file"); // File |
|
||||
try {
|
||||
String result = apiInstance.testBodyMultipartFormdataSingleBinary(myFile);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testBodyMultipartFormdataSingleBinary");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **myFile** | **File**| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testEchoBodyAllOfPet
|
||||
|
||||
> Pet testEchoBodyAllOfPet(pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
Pet result = apiInstance.testEchoBodyAllOfPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyAllOfPet");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.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 | - |
|
||||
|
||||
|
||||
## testEchoBodyFreeFormObjectResponseString
|
||||
|
||||
> String testEchoBodyFreeFormObjectResponseString(body)
|
||||
|
||||
Test free form object
|
||||
|
||||
Test free form object
|
||||
|
||||
### 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Object body = null; // Object | Free form object
|
||||
try {
|
||||
String result = apiInstance.testEchoBodyFreeFormObjectResponseString(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyFreeFormObjectResponseString");
|
||||
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** | **Object**| Free form object | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testEchoBodyPet
|
||||
|
||||
> Pet testEchoBodyPet(pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
Pet result = apiInstance.testEchoBodyPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.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 | - |
|
||||
|
||||
|
||||
## testEchoBodyPetResponseString
|
||||
|
||||
> String testEchoBodyPetResponseString(pet)
|
||||
|
||||
Test empty response body
|
||||
|
||||
Test empty response 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
String result = apiInstance.testEchoBodyPetResponseString(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPetResponseString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testEchoBodyStringEnum
|
||||
|
||||
> StringEnumRef testEchoBodyStringEnum(body)
|
||||
|
||||
Test string enum response body
|
||||
|
||||
Test string enum response 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
String body = "body_example"; // String | String enum
|
||||
try {
|
||||
StringEnumRef result = apiInstance.testEchoBodyStringEnum(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyStringEnum");
|
||||
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**| String enum | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
[**StringEnumRef**](StringEnumRef.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 | - |
|
||||
|
||||
|
||||
## testEchoBodyTagResponseString
|
||||
|
||||
> String testEchoBodyTagResponseString(tag)
|
||||
|
||||
Test empty json (request body)
|
||||
|
||||
Test empty json (request 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.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Tag tag = new Tag(); // Tag | Tag object
|
||||
try {
|
||||
String result = apiInstance.testEchoBodyTagResponseString(tag);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyTagResponseString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **tag** | [**Tag**](Tag.md)| Tag object | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
14
samples/client/echo_api/java/restclient/docs/Category.md
Normal file
14
samples/client/echo_api/java/restclient/docs/Category.md
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# Category
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**id** | **Long** | | [optional] |
|
||||
|**name** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
15
samples/client/echo_api/java/restclient/docs/DataQuery.md
Normal file
15
samples/client/echo_api/java/restclient/docs/DataQuery.md
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# DataQuery
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**suffix** | **String** | test suffix | [optional] |
|
||||
|**text** | **String** | Some text containing white spaces | [optional] |
|
||||
|**date** | **Instant** | A date | [optional] |
|
||||
|
||||
|
||||
|
31
samples/client/echo_api/java/restclient/docs/DefaultValue.md
Normal file
31
samples/client/echo_api/java/restclient/docs/DefaultValue.md
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
# DefaultValue
|
||||
|
||||
to test the default value of properties
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**arrayStringEnumRefDefault** | **List<StringEnumRef>** | | [optional] |
|
||||
|**arrayStringEnumDefault** | [**List<ArrayStringEnumDefaultEnum>**](#List<ArrayStringEnumDefaultEnum>) | | [optional] |
|
||||
|**arrayStringDefault** | **List<String>** | | [optional] |
|
||||
|**arrayIntegerDefault** | **List<Integer>** | | [optional] |
|
||||
|**arrayString** | **List<String>** | | [optional] |
|
||||
|**arrayStringNullable** | **List<String>** | | [optional] |
|
||||
|**arrayStringExtensionNullable** | **List<String>** | | [optional] |
|
||||
|**stringNullable** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: List<ArrayStringEnumDefaultEnum>
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| SUCCESS | "success" |
|
||||
| FAILURE | "failure" |
|
||||
| UNCLASSIFIED | "unclassified" |
|
||||
|
||||
|
||||
|
223
samples/client/echo_api/java/restclient/docs/FormApi.md
Normal file
223
samples/client/echo_api/java/restclient/docs/FormApi.md
Normal file
@ -0,0 +1,223 @@
|
||||
# FormApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) |
|
||||
| [**testFormObjectMultipart**](FormApi.md#testFormObjectMultipart) | **POST** /form/object/multipart | Test form parameter(s) for multipart schema |
|
||||
| [**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema |
|
||||
|
||||
|
||||
|
||||
## testFormIntegerBooleanString
|
||||
|
||||
> String testFormIntegerBooleanString(integerForm, booleanForm, stringForm)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
### 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.FormApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
FormApi apiInstance = new FormApi(defaultClient);
|
||||
Integer integerForm = 56; // Integer |
|
||||
Boolean booleanForm = true; // Boolean |
|
||||
String stringForm = "stringForm_example"; // String |
|
||||
try {
|
||||
String result = apiInstance.testFormIntegerBooleanString(integerForm, booleanForm, stringForm);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FormApi#testFormIntegerBooleanString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **integerForm** | **Integer**| | [optional] |
|
||||
| **booleanForm** | **Boolean**| | [optional] |
|
||||
| **stringForm** | **String**| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testFormObjectMultipart
|
||||
|
||||
> String testFormObjectMultipart(marker)
|
||||
|
||||
Test form parameter(s) for multipart schema
|
||||
|
||||
Test form parameter(s) for multipart schema
|
||||
|
||||
### 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.FormApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
FormApi apiInstance = new FormApi(defaultClient);
|
||||
TestFormObjectMultipartRequestMarker marker = new TestFormObjectMultipartRequestMarker(); // TestFormObjectMultipartRequestMarker |
|
||||
try {
|
||||
String result = apiInstance.testFormObjectMultipart(marker);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FormApi#testFormObjectMultipart");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **marker** | [**TestFormObjectMultipartRequestMarker**](TestFormObjectMultipartRequestMarker.md)| | |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testFormOneof
|
||||
|
||||
> String testFormOneof(form1, form2, form3, form4, id, name)
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
### 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.FormApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
FormApi apiInstance = new FormApi(defaultClient);
|
||||
String form1 = "form1_example"; // String |
|
||||
Integer form2 = 56; // Integer |
|
||||
String form3 = "form3_example"; // String |
|
||||
Boolean form4 = true; // Boolean |
|
||||
Long id = 56L; // Long |
|
||||
String name = "name_example"; // String |
|
||||
try {
|
||||
String result = apiInstance.testFormOneof(form1, form2, form3, form4, id, name);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FormApi#testFormOneof");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **form1** | **String**| | [optional] |
|
||||
| **form2** | **Integer**| | [optional] |
|
||||
| **form3** | **String**| | [optional] |
|
||||
| **form4** | **Boolean**| | [optional] |
|
||||
| **id** | **Long**| | [optional] |
|
||||
| **name** | **String**| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
83
samples/client/echo_api/java/restclient/docs/HeaderApi.md
Normal file
83
samples/client/echo_api/java/restclient/docs/HeaderApi.md
Normal file
@ -0,0 +1,83 @@
|
||||
# HeaderApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testHeaderIntegerBooleanStringEnums**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) |
|
||||
|
||||
|
||||
|
||||
## testHeaderIntegerBooleanStringEnums
|
||||
|
||||
> String testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
### 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.HeaderApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
HeaderApi apiInstance = new HeaderApi(defaultClient);
|
||||
Integer integerHeader = 56; // Integer |
|
||||
Boolean booleanHeader = true; // Boolean |
|
||||
String stringHeader = "stringHeader_example"; // String |
|
||||
String enumNonrefStringHeader = "success"; // String |
|
||||
StringEnumRef enumRefStringHeader = StringEnumRef.fromValue("success"); // StringEnumRef |
|
||||
try {
|
||||
String result = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling HeaderApi#testHeaderIntegerBooleanStringEnums");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **integerHeader** | **Integer**| | [optional] |
|
||||
| **booleanHeader** | **Boolean**| | [optional] |
|
||||
| **stringHeader** | **String**| | [optional] |
|
||||
| **enumNonrefStringHeader** | **String**| | [optional] [enum: success, failure, unclassified] |
|
||||
| **enumRefStringHeader** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# NumberPropertiesOnly
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**number** | **BigDecimal** | | [optional] |
|
||||
|**_float** | **Float** | | [optional] |
|
||||
|**_double** | **Double** | | [optional] |
|
||||
|
||||
|
||||
|
81
samples/client/echo_api/java/restclient/docs/PathApi.md
Normal file
81
samples/client/echo_api/java/restclient/docs/PathApi.md
Normal file
@ -0,0 +1,81 @@
|
||||
# PathApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
|
||||
|
||||
|
||||
|
||||
## testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath
|
||||
|
||||
> String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
### 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.PathApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
PathApi apiInstance = new PathApi(defaultClient);
|
||||
String pathString = "pathString_example"; // String |
|
||||
Integer pathInteger = 56; // Integer |
|
||||
String enumNonrefStringPath = "success"; // String |
|
||||
StringEnumRef enumRefStringPath = StringEnumRef.fromValue("success"); // StringEnumRef |
|
||||
try {
|
||||
String result = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pathString** | **String**| | |
|
||||
| **pathInteger** | **Integer**| | |
|
||||
| **enumNonrefStringPath** | **String**| | [enum: success, failure, unclassified] |
|
||||
| **enumRefStringPath** | [**StringEnumRef**](.md)| | [enum: success, failure, unclassified] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
28
samples/client/echo_api/java/restclient/docs/Pet.md
Normal file
28
samples/client/echo_api/java/restclient/docs/Pet.md
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
# Pet
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**id** | **Long** | | [optional] |
|
||||
|**name** | **String** | | |
|
||||
|**category** | [**Category**](Category.md) | | [optional] |
|
||||
|**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" |
|
||||
|
||||
|
||||
|
24
samples/client/echo_api/java/restclient/docs/Query.md
Normal file
24
samples/client/echo_api/java/restclient/docs/Query.md
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
# Query
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**id** | **Long** | Query | [optional] |
|
||||
|**outcomes** | [**List<OutcomesEnum>**](#List<OutcomesEnum>) | | [optional] |
|
||||
|
||||
|
||||
|
||||
## Enum: List<OutcomesEnum>
|
||||
|
||||
| Name | Value |
|
||||
|---- | -----|
|
||||
| SUCCESS | "SUCCESS" |
|
||||
| FAILURE | "FAILURE" |
|
||||
| SKIPPED | "SKIPPED" |
|
||||
|
||||
|
||||
|
688
samples/client/echo_api/java/restclient/docs/QueryApi.md
Normal file
688
samples/client/echo_api/java/restclient/docs/QueryApi.md
Normal file
@ -0,0 +1,688 @@
|
||||
# QueryApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testEnumRefString**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) |
|
||||
| [**testQueryDatetimeDateString**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) |
|
||||
| [**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) |
|
||||
| [**testQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) |
|
||||
| [**testQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObjectAllOf) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) |
|
||||
| [**testQueryStyleFormExplodeFalseArrayInteger**](QueryApi.md#testQueryStyleFormExplodeFalseArrayInteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s) |
|
||||
| [**testQueryStyleFormExplodeFalseArrayString**](QueryApi.md#testQueryStyleFormExplodeFalseArrayString) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s) |
|
||||
| [**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
||||
| [**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
|
||||
| [**testQueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#testQueryStyleFormExplodeTrueObjectAllOf) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) |
|
||||
|
||||
|
||||
|
||||
## testEnumRefString
|
||||
|
||||
> String testEnumRefString(enumNonrefStringQuery, enumRefStringQuery)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
String enumNonrefStringQuery = "success"; // String |
|
||||
StringEnumRef enumRefStringQuery = StringEnumRef.fromValue("success"); // StringEnumRef |
|
||||
try {
|
||||
String result = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testEnumRefString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **enumNonrefStringQuery** | **String**| | [optional] [enum: success, failure, unclassified] |
|
||||
| **enumRefStringQuery** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryDatetimeDateString
|
||||
|
||||
> String testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
Instant datetimeQuery = new Instant(); // Instant |
|
||||
LocalDate dateQuery = LocalDate.now(); // LocalDate |
|
||||
String stringQuery = "stringQuery_example"; // String |
|
||||
try {
|
||||
String result = apiInstance.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryDatetimeDateString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **datetimeQuery** | **Instant**| | [optional] |
|
||||
| **dateQuery** | **LocalDate**| | [optional] |
|
||||
| **stringQuery** | **String**| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryIntegerBooleanString
|
||||
|
||||
> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
Integer integerQuery = 56; // Integer |
|
||||
Boolean booleanQuery = true; // Boolean |
|
||||
String stringQuery = "stringQuery_example"; // String |
|
||||
try {
|
||||
String result = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryIntegerBooleanString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **integerQuery** | **Integer**| | [optional] |
|
||||
| **booleanQuery** | **Boolean**| | [optional] |
|
||||
| **stringQuery** | **String**| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleDeepObjectExplodeTrueObject
|
||||
|
||||
> String testQueryStyleDeepObjectExplodeTrueObject(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
Pet queryObject = new Pet(); // Pet |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleDeepObjectExplodeTrueObject(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleDeepObjectExplodeTrueObject");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**Pet**](.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleDeepObjectExplodeTrueObjectAllOf
|
||||
|
||||
> String testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(); // TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleDeepObjectExplodeTrueObjectAllOf");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleFormExplodeFalseArrayInteger
|
||||
|
||||
> String testQueryStyleFormExplodeFalseArrayInteger(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
List<Integer> queryObject = Arrays.asList(); // List<Integer> |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleFormExplodeFalseArrayInteger(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeFalseArrayInteger");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**List<Integer>**](Integer.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleFormExplodeFalseArrayString
|
||||
|
||||
> String testQueryStyleFormExplodeFalseArrayString(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
List<String> queryObject = Arrays.asList(); // List<String> |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleFormExplodeFalseArrayString(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeFalseArrayString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**List<String>**](String.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleFormExplodeTrueArrayString
|
||||
|
||||
> String testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(); // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueArrayString");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleFormExplodeTrueObject
|
||||
|
||||
> String testQueryStyleFormExplodeTrueObject(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
Pet queryObject = new Pet(); // Pet |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueObject");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**Pet**](.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testQueryStyleFormExplodeTrueObjectAllOf
|
||||
|
||||
> String testQueryStyleFormExplodeTrueObjectAllOf(queryObject)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
### 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.QueryApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
DataQuery queryObject = new DataQuery(); // DataQuery |
|
||||
try {
|
||||
String result = apiInstance.testQueryStyleFormExplodeTrueObjectAllOf(queryObject);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueObjectAllOf");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **queryObject** | [**DataQuery**](.md)| | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
# StringEnumRef
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `SUCCESS` (value: `"success"`)
|
||||
|
||||
* `FAILURE` (value: `"failure"`)
|
||||
|
||||
* `UNCLASSIFIED` (value: `"unclassified"`)
|
||||
|
||||
|
||||
|
14
samples/client/echo_api/java/restclient/docs/Tag.md
Normal file
14
samples/client/echo_api/java/restclient/docs/Tag.md
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# Tag
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**id** | **Long** | | [optional] |
|
||||
|**name** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# TestFormObjectMultipartRequestMarker
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**name** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**size** | **String** | | [optional] |
|
||||
|**color** | **String** | | [optional] |
|
||||
|**id** | **Long** | | [optional] |
|
||||
|**name** | **String** | | [optional] |
|
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**values** | **List<String>** | | [optional] |
|
||||
|
||||
|
||||
|
57
samples/client/echo_api/java/restclient/git_push.sh
Normal file
57
samples/client/echo_api/java/restclient/git_push.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/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-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
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://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${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://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
@ -0,0 +1,6 @@
|
||||
# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator).
|
||||
# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option.
|
||||
#
|
||||
# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
||||
# For example, uncomment below to build for Android
|
||||
#target = android
|
BIN
samples/client/echo_api/java/restclient/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/echo_api/java/restclient/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
samples/client/echo_api/java/restclient/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
samples/client/echo_api/java/restclient/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
249
samples/client/echo_api/java/restclient/gradlew
vendored
Normal file
249
samples/client/echo_api/java/restclient/gradlew
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# 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 ;; #(
|
||||
MSYS* | 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
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
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
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# 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"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
92
samples/client/echo_api/java/restclient/gradlew.bat
vendored
Normal file
92
samples/client/echo_api/java/restclient/gradlew.bat
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
@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=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@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% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
: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 %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 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!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
291
samples/client/echo_api/java/restclient/pom.xml
Normal file
291
samples/client/echo_api/java/restclient/pom.xml
Normal file
@ -0,0 +1,291 @@
|
||||
<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>echo-api-native</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>echo-api-native</name>
|
||||
<version>0.1.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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>2.2.0</version>
|
||||
</requireMavenVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemPropertyVariables>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
<useUnlimitedThreads>true</useUnlimitedThreads>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<!--Custom provider and engine for Junit 5 to surefire-->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<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.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add_test_sources</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- @Nullable annotation -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HTTP client: Spring RestClient -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring-web-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring-web-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-databind-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jakarta.rs</groupId>
|
||||
<artifactId>jackson-jakarta-rs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>jackson-databind-nullable</artifactId>
|
||||
<version>${jackson-databind-nullable-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>${jakarta-annotation-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-runner</artifactId>
|
||||
<version>${junit-platform-runner.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-web-version>6.1.6</spring-web-version>
|
||||
<jackson-version>2.15.2</jackson-version>
|
||||
<jackson-databind-version>2.15.2</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<junit-version>5.10.2</junit-version>
|
||||
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
|
||||
</properties>
|
||||
</project>
|
1
samples/client/echo_api/java/restclient/settings.gradle
Normal file
1
samples/client/echo_api/java/restclient/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
rootProject.name = "echo-api-native"
|
@ -0,0 +1,3 @@
|
||||
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application />
|
||||
</manifest>
|
@ -0,0 +1,709 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.util.function.Consumer;
|
||||
import org.openapitools.jackson.nullable.JsonNullableModule;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.InvalidMediaTypeException;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import org.springframework.web.client.RestClient;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import java.util.Optional;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
import org.openapitools.client.auth.Authentication;
|
||||
import org.openapitools.client.auth.HttpBasicAuth;
|
||||
import org.openapitools.client.auth.HttpBearerAuth;
|
||||
import org.openapitools.client.auth.ApiKeyAuth;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class ApiClient extends JavaTimeFormatter {
|
||||
public enum CollectionFormat {
|
||||
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
|
||||
|
||||
private final String separator;
|
||||
CollectionFormat(String separator) {
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
private String collectionToString(Collection<?> collection) {
|
||||
return StringUtils.collectionToDelimitedString(collection, separator);
|
||||
}
|
||||
}
|
||||
|
||||
private final HttpHeaders defaultHeaders = new HttpHeaders();
|
||||
private final MultiValueMap<String, String> defaultCookies = new LinkedMultiValueMap<>();
|
||||
|
||||
private String basePath = "http://localhost:3000";
|
||||
|
||||
private final RestClient restClient;
|
||||
private final DateFormat dateFormat;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
private Map<String, Authentication> authentications;
|
||||
|
||||
|
||||
public ApiClient() {
|
||||
this.dateFormat = createDefaultDateFormat();
|
||||
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
|
||||
this.restClient = buildRestClient(this.objectMapper);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public ApiClient(RestClient restClient) {
|
||||
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
|
||||
}
|
||||
|
||||
public ApiClient(ObjectMapper mapper, DateFormat format) {
|
||||
this(buildRestClient(mapper.copy()), format);
|
||||
}
|
||||
|
||||
public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
|
||||
this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
|
||||
}
|
||||
|
||||
private ApiClient(RestClient restClient, DateFormat format) {
|
||||
this.restClient = restClient;
|
||||
this.dateFormat = format;
|
||||
this.objectMapper = createDefaultObjectMapper(format);
|
||||
this.init();
|
||||
}
|
||||
|
||||
public static DateFormat createDefaultDateFormat() {
|
||||
DateFormat dateFormat = new RFC3339DateFormat();
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
|
||||
if (null == dateFormat) {
|
||||
dateFormat = createDefaultDateFormat();
|
||||
}
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setDateFormat(dateFormat);
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
JsonNullableModule jnm = new JsonNullableModule();
|
||||
mapper.registerModule(jnm);
|
||||
return mapper;
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<>();
|
||||
authentications.put("http_auth", new HttpBasicAuth());
|
||||
authentications.put("http_bearer_auth", new HttpBearerAuth("bearer"));
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClientBuilder used to make RestClient.
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient.Builder buildRestClientBuilder(ObjectMapper mapper) {
|
||||
Consumer<List<HttpMessageConverter<?>>> messageConverters = converters -> {
|
||||
converters.add(new MappingJackson2HttpMessageConverter(mapper));
|
||||
};
|
||||
|
||||
return RestClient.builder().messageConverters(messageConverters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClientBuilder used to make RestClient.
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient.Builder buildRestClientBuilder() {
|
||||
return buildRestClientBuilder(createDefaultObjectMapper(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClient used to make HTTP requests.
|
||||
* @param mapper ObjectMapper used for serialize/deserialize
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient buildRestClient(ObjectMapper mapper) {
|
||||
return buildRestClientBuilder(mapper).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the RestClient used to make HTTP requests.
|
||||
* @return RestClient
|
||||
*/
|
||||
public static RestClient buildRestClient() {
|
||||
return buildRestClientBuilder(createDefaultObjectMapper(null)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current base path
|
||||
* @return String the base path
|
||||
*/
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base path, which should include the host
|
||||
* @param basePath the base path
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authentications (key: authentication name, value: authentication).
|
||||
* @return Map the currently configured authentication types
|
||||
*/
|
||||
public Map<String, Authentication> getAuthentications() {
|
||||
return authentications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authentication for the given name.
|
||||
*
|
||||
* @param authName The authentication name
|
||||
* @return The authentication, null if not found
|
||||
*/
|
||||
public Authentication getAuthentication(String authName) {
|
||||
return authentications.get(authName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set access token for the first Bearer authentication.
|
||||
* @param bearerToken Bearer token
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof HttpBearerAuth) {
|
||||
((HttpBearerAuth) auth).setBearerToken(bearerToken);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No Bearer authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set username for the first HTTP basic authentication.
|
||||
* @param username the username
|
||||
*/
|
||||
public void setUsername(String username) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof HttpBasicAuth) {
|
||||
((HttpBasicAuth) auth).setUsername(username);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No HTTP basic authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set password for the first HTTP basic authentication.
|
||||
* @param password the password
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof HttpBasicAuth) {
|
||||
((HttpBasicAuth) auth).setPassword(password);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No HTTP basic authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set API key value for the first API key authentication.
|
||||
* @param apiKey the API key
|
||||
*/
|
||||
public void setApiKey(String apiKey) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof ApiKeyAuth) {
|
||||
((ApiKeyAuth) auth).setApiKey(apiKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No API key authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set API key prefix for the first API key authentication.
|
||||
* @param apiKeyPrefix the API key prefix
|
||||
*/
|
||||
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||
for (Authentication auth : authentications.values()) {
|
||||
if (auth instanceof ApiKeyAuth) {
|
||||
((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No API key authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the User-Agent header's value (by adding to the default header map).
|
||||
* @param userAgent the user agent string
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient setUserAgent(String userAgent) {
|
||||
addDefaultHeader("User-Agent", userAgent);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a default header.
|
||||
*
|
||||
* @param name The header's name
|
||||
* @param value The header's value
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultHeader(String name, String value) {
|
||||
if (defaultHeaders.containsKey(name)) {
|
||||
defaultHeaders.remove(name);
|
||||
}
|
||||
defaultHeaders.add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a default cookie.
|
||||
*
|
||||
* @param name The cookie's name
|
||||
* @param value The cookie's value
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultCookie(String name, String value) {
|
||||
if (defaultCookies.containsKey(name)) {
|
||||
defaultCookies.remove(name);
|
||||
}
|
||||
defaultCookies.add(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format date parameters.
|
||||
* @return DateFormat format
|
||||
*/
|
||||
public DateFormat getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given string into Date object.
|
||||
*/
|
||||
public Date parseDate(String str) {
|
||||
try {
|
||||
return dateFormat.parse(str);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given Date object into string.
|
||||
*/
|
||||
public String formatDate(Date date) {
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ObjectMapper used to make HTTP requests.
|
||||
* @return ObjectMapper objectMapper
|
||||
*/
|
||||
public ObjectMapper getObjectMapper() {
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the RestClient used to make HTTP requests.
|
||||
* @return RestClient restClient
|
||||
*/
|
||||
public RestClient getRestClient() {
|
||||
return restClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the given parameter object into string.
|
||||
* @param param the object to convert
|
||||
* @return String the parameter represented as a String
|
||||
*/
|
||||
public String parameterToString(Object param) {
|
||||
if (param == null) {
|
||||
return "";
|
||||
} else if (param instanceof Date) {
|
||||
return formatDate( (Date) param);
|
||||
} else if (param instanceof OffsetDateTime) {
|
||||
return formatOffsetDateTime((OffsetDateTime) param);
|
||||
} else if (param instanceof Collection) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(Object o : (Collection<?>) param) {
|
||||
if(b.length() > 0) {
|
||||
b.append(",");
|
||||
}
|
||||
b.append(String.valueOf(o));
|
||||
}
|
||||
return b.toString();
|
||||
} else {
|
||||
return String.valueOf(param);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a parameter to a {@link MultiValueMap} for use in REST requests
|
||||
* @param collectionFormat The format to convert to
|
||||
* @param name The name of the parameter
|
||||
* @param value The parameter's value
|
||||
* @return a Map containing the String value(s) of the input parameter
|
||||
*/
|
||||
public MultiValueMap<String, String> parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) {
|
||||
final MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
|
||||
|
||||
if (name == null || name.isEmpty() || value == null) {
|
||||
return params;
|
||||
}
|
||||
|
||||
if(collectionFormat == null) {
|
||||
collectionFormat = CollectionFormat.CSV;
|
||||
}
|
||||
|
||||
if (value instanceof Map) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, Object> valuesMap = (Map<String, Object>) value;
|
||||
for (final Entry<String, Object> entry : valuesMap.entrySet()) {
|
||||
params.add(entry.getKey(), parameterToString(entry.getValue()));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
Collection<?> valueCollection = null;
|
||||
if (value instanceof Collection) {
|
||||
valueCollection = (Collection<?>) value;
|
||||
} else {
|
||||
params.add(name, parameterToString(value));
|
||||
return params;
|
||||
}
|
||||
|
||||
if (valueCollection.isEmpty()){
|
||||
return params;
|
||||
}
|
||||
|
||||
if (collectionFormat.equals(CollectionFormat.MULTI)) {
|
||||
for (Object item : valueCollection) {
|
||||
params.add(name, parameterToString(item));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
List<String> values = new ArrayList<>();
|
||||
for(Object o : valueCollection) {
|
||||
values.add(parameterToString(o));
|
||||
}
|
||||
params.add(name, collectionFormat.collectionToString(values));
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given {@code String} is a JSON MIME.
|
||||
* @param mediaType the input MediaType
|
||||
* @return boolean true if the MediaType represents JSON, false otherwise
|
||||
*/
|
||||
public boolean isJsonMime(String mediaType) {
|
||||
// "* / *" is default to JSON
|
||||
if ("*/*".equals(mediaType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
return isJsonMime(MediaType.parseMediaType(mediaType));
|
||||
} catch (InvalidMediaTypeException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* @param mediaType the input MediaType
|
||||
* @return boolean true if the MediaType represents JSON, false otherwise
|
||||
*/
|
||||
public boolean isJsonMime(MediaType mediaType) {
|
||||
return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*(\\+json|ndjson)[;]?\\s*$"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given {@code String} is a Problem JSON MIME (RFC-7807).
|
||||
* @param mediaType the input MediaType
|
||||
* @return boolean true if the MediaType represents Problem JSON, false otherwise
|
||||
*/
|
||||
public boolean isProblemJsonMime(String mediaType) {
|
||||
return "application/problem+json".equalsIgnoreCase(mediaType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Accept header's value from the given accepts array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use all of them (joining into a string)
|
||||
*
|
||||
* @param accepts The accepts array to select from
|
||||
* @return List The list of MediaTypes to use for the Accept header
|
||||
*/
|
||||
public List<MediaType> selectHeaderAccept(String[] accepts) {
|
||||
if (accepts.length == 0) {
|
||||
return null;
|
||||
}
|
||||
for (String accept : accepts) {
|
||||
MediaType mediaType = MediaType.parseMediaType(accept);
|
||||
if (isJsonMime(mediaType) && !isProblemJsonMime(accept)) {
|
||||
return Collections.singletonList(mediaType);
|
||||
}
|
||||
}
|
||||
return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Content-Type header's value from the given array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use the first one of the array.
|
||||
*
|
||||
* @param contentTypes The Content-Type array to select from
|
||||
* @return MediaType The Content-Type header to use. If the given array is empty, null will be returned.
|
||||
*/
|
||||
public MediaType selectHeaderContentType(String[] contentTypes) {
|
||||
if (contentTypes.length == 0) {
|
||||
return null;
|
||||
}
|
||||
for (String contentType : contentTypes) {
|
||||
MediaType mediaType = MediaType.parseMediaType(contentType);
|
||||
if (isJsonMime(mediaType)) {
|
||||
return mediaType;
|
||||
}
|
||||
}
|
||||
return MediaType.parseMediaType(contentTypes[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the body to use for the request
|
||||
*
|
||||
* @param obj the body object
|
||||
* @param formParams the form parameters
|
||||
* @param contentType the content type of the request
|
||||
* @return Object the selected body
|
||||
*/
|
||||
protected Object selectBody(Object obj, MultiValueMap<String, Object> formParams, MediaType contentType) {
|
||||
boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType);
|
||||
return isForm ? formParams : obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke API by sending HTTP request with the given options.
|
||||
*
|
||||
* @param <T> the return type to use
|
||||
* @param path The sub-path of the HTTP URL
|
||||
* @param method The request method
|
||||
* @param pathParams The path parameters
|
||||
* @param queryParams The query parameters
|
||||
* @param body The request body object
|
||||
* @param headerParams The header parameters
|
||||
* @param formParams The form parameters
|
||||
* @param accept The request's Accept header
|
||||
* @param contentType The request's Content-Type header
|
||||
* @param authNames The authentications to apply
|
||||
* @param returnType The return type into which to deserialize the response
|
||||
* @return The response body in chosen type
|
||||
*/
|
||||
public <T> ResponseSpec invokeAPI(String path, HttpMethod method, Map<String, Object> pathParams, MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept, MediaType contentType, String[] authNames, ParameterizedTypeReference<T> returnType) throws RestClientException {
|
||||
final RestClient.RequestBodySpec requestBuilder = prepareRequest(path, method, pathParams, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames);
|
||||
return requestBuilder.retrieve();
|
||||
}
|
||||
|
||||
/**
|
||||
* Include queryParams in uriParams taking into account the paramName
|
||||
* @param queryParams The query parameters
|
||||
* @param uriParams The path parameters
|
||||
* return templatized query string
|
||||
*/
|
||||
private String generateQueryUri(MultiValueMap<String, String> queryParams, Map<String, Object> uriParams) {
|
||||
StringBuilder queryBuilder = new StringBuilder();
|
||||
queryParams.forEach((name, values) -> {
|
||||
if (CollectionUtils.isEmpty(values)) {
|
||||
if (queryBuilder.length() != 0) {
|
||||
queryBuilder.append('&');
|
||||
}
|
||||
queryBuilder.append(name);
|
||||
} else {
|
||||
int valueItemCounter = 0;
|
||||
for (Object value : values) {
|
||||
if (queryBuilder.length() != 0) {
|
||||
queryBuilder.append('&');
|
||||
}
|
||||
queryBuilder.append(name);
|
||||
if (value != null) {
|
||||
String templatizedKey = name + valueItemCounter++;
|
||||
uriParams.put(templatizedKey, value.toString());
|
||||
queryBuilder.append('=').append("{").append(templatizedKey).append("}");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return queryBuilder.toString();
|
||||
}
|
||||
|
||||
private RestClient.RequestBodySpec prepareRequest(String path, HttpMethod method, Map<String, Object> pathParams,
|
||||
MultiValueMap<String, String> queryParams, Object body, HttpHeaders headerParams,
|
||||
MultiValueMap<String, String> cookieParams, MultiValueMap<String, Object> formParams, List<MediaType> accept,
|
||||
MediaType contentType, String[] authNames) {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
||||
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path);
|
||||
|
||||
String finalUri = builder.build(false).toUriString();
|
||||
Map<String, Object> uriParams = new HashMap<>();
|
||||
uriParams.putAll(pathParams);
|
||||
|
||||
if (queryParams != null && !queryParams.isEmpty()) {
|
||||
//Include queryParams in uriParams taking into account the paramName
|
||||
String queryUri = generateQueryUri(queryParams, uriParams);
|
||||
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
|
||||
finalUri += "?" + queryUri;
|
||||
}
|
||||
|
||||
final RestClient.RequestBodySpec requestBuilder = restClient.method(method).uri(finalUri, uriParams);
|
||||
|
||||
if (accept != null) {
|
||||
requestBuilder.accept(accept.toArray(new MediaType[accept.size()]));
|
||||
}
|
||||
if(contentType != null) {
|
||||
requestBuilder.contentType(contentType);
|
||||
}
|
||||
|
||||
addHeadersToRequest(headerParams, requestBuilder);
|
||||
addHeadersToRequest(defaultHeaders, requestBuilder);
|
||||
addCookiesToRequest(cookieParams, requestBuilder);
|
||||
addCookiesToRequest(defaultCookies, requestBuilder);
|
||||
|
||||
var selectedBody = selectBody(body, formParams, contentType);
|
||||
if (selectedBody != null) {
|
||||
requestBuilder.body(selectedBody);
|
||||
}
|
||||
|
||||
return requestBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add headers to the request that is being built
|
||||
* @param headers The headers to add
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addHeadersToRequest(HttpHeaders headers, RestClient.RequestBodySpec requestBuilder) {
|
||||
for (Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
List<String> values = entry.getValue();
|
||||
for(String value : values) {
|
||||
if (value != null) {
|
||||
requestBuilder.header(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add cookies to the request that is being built
|
||||
*
|
||||
* @param cookies The cookies to add
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addCookiesToRequest(MultiValueMap<String, String> cookies, RestClient.RequestBodySpec requestBuilder) {
|
||||
if (!cookies.isEmpty()) {
|
||||
requestBuilder.header("Cookie", buildCookieHeader(cookies));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build cookie header. Keeps a single value per cookie (as per <a href="https://tools.ietf.org/html/rfc6265#section-5.3">
|
||||
* RFC6265 section 5.3</a>).
|
||||
*
|
||||
* @param cookies map all cookies
|
||||
* @return header string for cookies.
|
||||
*/
|
||||
private String buildCookieHeader(MultiValueMap<String, String> cookies) {
|
||||
final StringBuilder cookieValue = new StringBuilder();
|
||||
String delimiter = "";
|
||||
for (final Map.Entry<String, List<String>> entry : cookies.entrySet()) {
|
||||
final String value = entry.getValue().get(entry.getValue().size() - 1);
|
||||
cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
|
||||
delimiter = "; ";
|
||||
}
|
||||
return cookieValue.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update query and header parameters based on authentication settings.
|
||||
*
|
||||
* @param authNames The authentications to apply
|
||||
* @param queryParams The query parameters
|
||||
* @param headerParams The header parameters
|
||||
* @param cookieParams the cookie parameters
|
||||
*/
|
||||
protected void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
for (String authName : authNames) {
|
||||
Authentication auth = authentications.get(authName);
|
||||
if (auth == null) {
|
||||
throw new RestClientException("Authentication undefined: " + authName);
|
||||
}
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the specified collection path parameter to a string value.
|
||||
*
|
||||
* @param collectionFormat The collection format of the parameter.
|
||||
* @param values The values of the parameter.
|
||||
* @return String representation of the parameter
|
||||
*/
|
||||
public String collectionPathParameterToString(CollectionFormat collectionFormat, Collection<?> values) {
|
||||
// create the value based on the collection format
|
||||
if (CollectionFormat.MULTI.equals(collectionFormat)) {
|
||||
// not valid for path params
|
||||
return parameterToString(values);
|
||||
}
|
||||
|
||||
// collectionFormat is assumed to be "csv" by default
|
||||
if(collectionFormat == null) {
|
||||
collectionFormat = CollectionFormat.CSV;
|
||||
}
|
||||
|
||||
return collectionFormat.collectionToString(values);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.http.HttpInputMessage;
|
||||
import org.springframework.http.HttpOutputMessage;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
|
||||
public class GifHttpMessageConverter implements HttpMessageConverter<File> {
|
||||
|
||||
@Override
|
||||
public boolean canRead(Class<?> clazz, MediaType mediaType) {
|
||||
return clazz == File.class && mediaType.includes(MediaType.IMAGE_GIF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MediaType> getSupportedMediaTypes() {
|
||||
return Collections.singletonList(MediaType.IMAGE_GIF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File read(Class<? extends File> clazz, HttpInputMessage inputMessage) throws IOException {
|
||||
File tempFile = Files.createTempFile("downloaded", ".gif").toFile();
|
||||
try (InputStream in = inputMessage.getBody(); FileOutputStream out = new FileOutputStream(tempFile)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(File file, MediaType contentType, HttpOutputMessage outputMessage) throws IOException {
|
||||
throw new UnsupportedOperationException("This converter is only for reading");
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
/**
|
||||
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
|
||||
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
|
||||
*/
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class JavaTimeFormatter {
|
||||
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.springframework.http.HttpInputMessage;
|
||||
import org.springframework.http.HttpOutputMessage;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class OctetStreamHttpMessageConverter implements HttpMessageConverter<File> {
|
||||
|
||||
@Override
|
||||
public boolean canRead(Class<?> clazz, MediaType mediaType) {
|
||||
return clazz == File.class && mediaType.includes(MediaType.APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
|
||||
return clazz == File.class
|
||||
&& (mediaType == null || mediaType.includes(MediaType.APPLICATION_OCTET_STREAM));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MediaType> getSupportedMediaTypes() {
|
||||
return Collections.singletonList(MediaType.APPLICATION_OCTET_STREAM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File read(Class<? extends File> clazz, HttpInputMessage inputMessage) throws IOException {
|
||||
File tempFile = Files.createTempFile("downloaded", ".bin").toFile();
|
||||
try (InputStream in = inputMessage.getBody();
|
||||
FileOutputStream out = new FileOutputStream(tempFile)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(File file, MediaType contentType, HttpOutputMessage outputMessage)
|
||||
throws IOException {
|
||||
Files.copy(file.toPath(), outputMessage.getBody());
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package org.openapitools.client;
|
||||
|
||||
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.ParsePosition;
|
||||
import java.util.Date;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class RFC3339DateFormat extends DateFormat {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||
|
||||
private final StdDateFormat fmt = new StdDateFormat()
|
||||
.withTimeZone(TIMEZONE_Z)
|
||||
.withColonInTimeZone(true);
|
||||
|
||||
public RFC3339DateFormat() {
|
||||
this.calendar = new GregorianCalendar();
|
||||
this.numberFormat = new DecimalFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date parse(String source) {
|
||||
return parse(source, new ParsePosition(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date parse(String source, ParsePosition pos) {
|
||||
return fmt.parse(source, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
|
||||
return fmt.format(date, toAppendTo, fieldPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
return super.clone();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Representing a Server configuration.
|
||||
*/
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class ServerConfiguration {
|
||||
public String URL;
|
||||
public String description;
|
||||
public Map<String, ServerVariable> variables;
|
||||
|
||||
/**
|
||||
* @param URL A URL to the target host.
|
||||
* @param description A description of the host designated by the URL.
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||
this.URL = URL;
|
||||
this.description = description;
|
||||
this.variables = variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format URL template using given variables.
|
||||
*
|
||||
* @param variables A map between a variable name and its value.
|
||||
* @return Formatted URL.
|
||||
*/
|
||||
public String URL(Map<String, String> variables) {
|
||||
String url = this.URL;
|
||||
|
||||
// go through variables and replace placeholders
|
||||
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||
String name = variable.getKey();
|
||||
ServerVariable serverVariable = variable.getValue();
|
||||
String value = serverVariable.defaultValue;
|
||||
|
||||
if (variables != null && variables.containsKey(name)) {
|
||||
value = variables.get(name);
|
||||
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||
}
|
||||
}
|
||||
url = url.replace("{" + name + "}", value);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format URL template using default server variables.
|
||||
*
|
||||
* @return Formatted URL.
|
||||
*/
|
||||
public String URL() {
|
||||
return URL(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Representing a Server Variable for server URL template substitution.
|
||||
*/
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class ServerVariable {
|
||||
public String description;
|
||||
public String defaultValue;
|
||||
public HashSet<String> enumValues = null;
|
||||
|
||||
/**
|
||||
* @param description A description for the server variable.
|
||||
* @param defaultValue The default value to use for substitution.
|
||||
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||
*/
|
||||
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||
this.description = description;
|
||||
this.defaultValue = defaultValue;
|
||||
this.enumValues = enumValues;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
*
|
||||
* @param array The array
|
||||
* @param value The value to search
|
||||
* @return true if the array contains the value
|
||||
*/
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) {
|
||||
return true;
|
||||
}
|
||||
if (value != null && value.equalsIgnoreCase(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join an array of strings with the given separator.
|
||||
* <p>
|
||||
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||
* if one of those libraries is added as dependency.
|
||||
* </p>
|
||||
*
|
||||
* @param array The array of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Join a list of strings with the given separator.
|
||||
*
|
||||
* @param list The list of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(Collection<String> list, String separator) {
|
||||
Iterator<String> iterator = list.iterator();
|
||||
StringBuilder out = new StringBuilder();
|
||||
if (iterator.hasNext()) {
|
||||
out.append(iterator.next());
|
||||
}
|
||||
while (iterator.hasNext()) {
|
||||
out.append(separator).append(iterator.next());
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class AuthApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public AuthApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public AuthApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testAuthHttpBasicRequestCreation() throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "http_auth" };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/auth/http/basic", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testAuthHttpBasic() throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testAuthHttpBasicRequestCreation().body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testAuthHttpBasicWithHttpInfo() throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testAuthHttpBasicRequestCreation().toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
* To test HTTP basic authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testAuthHttpBasicWithResponseSpec() throws RestClientResponseException {
|
||||
return testAuthHttpBasicRequestCreation();
|
||||
}
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testAuthHttpBearerRequestCreation() throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { "http_bearer_auth" };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/auth/http/bearer", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testAuthHttpBearer() throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testAuthHttpBearerRequestCreation().body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testAuthHttpBearerWithHttpInfo() throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testAuthHttpBearerRequestCreation().toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
* To test HTTP bearer authentication
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testAuthHttpBearerWithResponseSpec() throws RestClientResponseException {
|
||||
return testAuthHttpBearerRequestCreation();
|
||||
}
|
||||
}
|
@ -0,0 +1,754 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import java.io.File;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.client.model.Tag;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class BodyApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public BodyApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public BodyApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
* Test binary (gif) response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return File
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testBinaryGifRequestCreation() throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"image/gif"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<File> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/binary/gif", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
* Test binary (gif) response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return File
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public File testBinaryGif() throws RestClientResponseException {
|
||||
ParameterizedTypeReference<File> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBinaryGifRequestCreation().body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
* Test binary (gif) response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return ResponseEntity<File>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<File> testBinaryGifWithHttpInfo() throws RestClientResponseException {
|
||||
ParameterizedTypeReference<File> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBinaryGifRequestCreation().toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
* Test binary (gif) response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testBinaryGifWithResponseSpec() throws RestClientResponseException {
|
||||
return testBinaryGifRequestCreation();
|
||||
}
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body The body parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testBodyApplicationOctetstreamBinaryRequestCreation(File body) throws RestClientResponseException {
|
||||
Object postBody = body;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/octet-stream"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/body/application/octetstream/binary", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body The body parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testBodyApplicationOctetstreamBinary(File body) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBodyApplicationOctetstreamBinaryRequestCreation(body).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body The body parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(File body) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBodyApplicationOctetstreamBinaryRequestCreation(body).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body The body parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testBodyApplicationOctetstreamBinaryWithResponseSpec(File body) throws RestClientResponseException {
|
||||
return testBodyApplicationOctetstreamBinaryRequestCreation(body);
|
||||
}
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
* Test array of binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param files The files parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testBodyMultipartFormdataArrayOfBinaryRequestCreation(List<File> files) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// verify the required parameter 'files' is set
|
||||
if (files == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
if (files != null)
|
||||
formParams.addAll("files", files.stream().map(FileSystemResource::new).collect(Collectors.toList()));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/body/application/octetstream/array_of_binary", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
* Test array of binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param files The files parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testBodyMultipartFormdataArrayOfBinary(List<File> files) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBodyMultipartFormdataArrayOfBinaryRequestCreation(files).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
* Test array of binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param files The files parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(List<File> files) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBodyMultipartFormdataArrayOfBinaryRequestCreation(files).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
* Test array of binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param files The files parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testBodyMultipartFormdataArrayOfBinaryWithResponseSpec(List<File> files) throws RestClientResponseException {
|
||||
return testBodyMultipartFormdataArrayOfBinaryRequestCreation(files);
|
||||
}
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
* Test single binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param myFile The myFile parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testBodyMultipartFormdataSingleBinaryRequestCreation(File myFile) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
if (myFile != null)
|
||||
formParams.add("my-file", new FileSystemResource(myFile));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/body/application/octetstream/single_binary", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
* Test single binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param myFile The myFile parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testBodyMultipartFormdataSingleBinary(File myFile) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBodyMultipartFormdataSingleBinaryRequestCreation(myFile).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
* Test single binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param myFile The myFile parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testBodyMultipartFormdataSingleBinaryWithHttpInfo(File myFile) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testBodyMultipartFormdataSingleBinaryRequestCreation(myFile).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
* Test single binary in multipart mime
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param myFile The myFile parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testBodyMultipartFormdataSingleBinaryWithResponseSpec(File myFile) throws RestClientResponseException {
|
||||
return testBodyMultipartFormdataSingleBinaryRequestCreation(myFile);
|
||||
}
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return Pet
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEchoBodyAllOfPetRequestCreation(Pet pet) throws RestClientResponseException {
|
||||
Object postBody = pet;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/echo/body/allOf/Pet", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return Pet
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Pet testEchoBodyAllOfPet(Pet pet) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyAllOfPetRequestCreation(pet).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return ResponseEntity<Pet>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<Pet> testEchoBodyAllOfPetWithHttpInfo(Pet pet) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyAllOfPetRequestCreation(pet).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEchoBodyAllOfPetWithResponseSpec(Pet pet) throws RestClientResponseException {
|
||||
return testEchoBodyAllOfPetRequestCreation(pet);
|
||||
}
|
||||
/**
|
||||
* Test free form object
|
||||
* Test free form object
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body Free form object
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEchoBodyFreeFormObjectResponseStringRequestCreation(Object body) throws RestClientResponseException {
|
||||
Object postBody = body;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/echo/body/FreeFormObject/response_string", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
* Test free form object
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body Free form object
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testEchoBodyFreeFormObjectResponseString(Object body) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyFreeFormObjectResponseStringRequestCreation(body).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
* Test free form object
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body Free form object
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testEchoBodyFreeFormObjectResponseStringWithHttpInfo(Object body) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyFreeFormObjectResponseStringRequestCreation(body).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
* Test free form object
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body Free form object
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEchoBodyFreeFormObjectResponseStringWithResponseSpec(Object body) throws RestClientResponseException {
|
||||
return testEchoBodyFreeFormObjectResponseStringRequestCreation(body);
|
||||
}
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return Pet
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEchoBodyPetRequestCreation(Pet pet) throws RestClientResponseException {
|
||||
Object postBody = pet;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/echo/body/Pet", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return Pet
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Pet testEchoBodyPet(Pet pet) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyPetRequestCreation(pet).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return ResponseEntity<Pet>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<Pet> testEchoBodyPetWithHttpInfo(Pet pet) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<Pet> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyPetRequestCreation(pet).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEchoBodyPetWithResponseSpec(Pet pet) throws RestClientResponseException {
|
||||
return testEchoBodyPetRequestCreation(pet);
|
||||
}
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEchoBodyPetResponseStringRequestCreation(Pet pet) throws RestClientResponseException {
|
||||
Object postBody = pet;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/echo/body/Pet/response_string", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testEchoBodyPetResponseString(Pet pet) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyPetResponseStringRequestCreation(pet).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testEchoBodyPetResponseStringWithHttpInfo(Pet pet) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyPetResponseStringRequestCreation(pet).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEchoBodyPetResponseStringWithResponseSpec(Pet pet) throws RestClientResponseException {
|
||||
return testEchoBodyPetResponseStringRequestCreation(pet);
|
||||
}
|
||||
/**
|
||||
* Test string enum response body
|
||||
* Test string enum response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body String enum
|
||||
* @return StringEnumRef
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEchoBodyStringEnumRequestCreation(String body) throws RestClientResponseException {
|
||||
Object postBody = body;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<StringEnumRef> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/echo/body/string_enum", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
* Test string enum response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body String enum
|
||||
* @return StringEnumRef
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public StringEnumRef testEchoBodyStringEnum(String body) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<StringEnumRef> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyStringEnumRequestCreation(body).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
* Test string enum response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body String enum
|
||||
* @return ResponseEntity<StringEnumRef>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<StringEnumRef> testEchoBodyStringEnumWithHttpInfo(String body) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<StringEnumRef> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyStringEnumRequestCreation(body).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
* Test string enum response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body String enum
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEchoBodyStringEnumWithResponseSpec(String body) throws RestClientResponseException {
|
||||
return testEchoBodyStringEnumRequestCreation(body);
|
||||
}
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param tag Tag object
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEchoBodyTagResponseStringRequestCreation(Tag tag) throws RestClientResponseException {
|
||||
Object postBody = tag;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/echo/body/Tag/response_string", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param tag Tag object
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testEchoBodyTagResponseString(Tag tag) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyTagResponseStringRequestCreation(tag).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param tag Tag object
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testEchoBodyTagResponseStringWithHttpInfo(Tag tag) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEchoBodyTagResponseStringRequestCreation(tag).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param tag Tag object
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEchoBodyTagResponseStringWithResponseSpec(Tag tag) throws RestClientResponseException {
|
||||
return testEchoBodyTagResponseStringRequestCreation(tag);
|
||||
}
|
||||
}
|
@ -0,0 +1,312 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import org.openapitools.client.model.TestFormObjectMultipartRequestMarker;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class FormApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public FormApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public FormApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerForm The integerForm parameter
|
||||
* @param booleanForm The booleanForm parameter
|
||||
* @param stringForm The stringForm parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testFormIntegerBooleanStringRequestCreation(Integer integerForm, Boolean booleanForm, String stringForm) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
if (integerForm != null)
|
||||
formParams.add("integer_form", integerForm);
|
||||
if (booleanForm != null)
|
||||
formParams.add("boolean_form", booleanForm);
|
||||
if (stringForm != null)
|
||||
formParams.add("string_form", stringForm);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/x-www-form-urlencoded"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/form/integer/boolean/string", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerForm The integerForm parameter
|
||||
* @param booleanForm The booleanForm parameter
|
||||
* @param stringForm The stringForm parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanForm, String stringForm) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testFormIntegerBooleanStringRequestCreation(integerForm, booleanForm, stringForm).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerForm The integerForm parameter
|
||||
* @param booleanForm The booleanForm parameter
|
||||
* @param stringForm The stringForm parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testFormIntegerBooleanStringWithHttpInfo(Integer integerForm, Boolean booleanForm, String stringForm) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testFormIntegerBooleanStringRequestCreation(integerForm, booleanForm, stringForm).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerForm The integerForm parameter
|
||||
* @param booleanForm The booleanForm parameter
|
||||
* @param stringForm The stringForm parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testFormIntegerBooleanStringWithResponseSpec(Integer integerForm, Boolean booleanForm, String stringForm) throws RestClientResponseException {
|
||||
return testFormIntegerBooleanStringRequestCreation(integerForm, booleanForm, stringForm);
|
||||
}
|
||||
/**
|
||||
* Test form parameter(s) for multipart schema
|
||||
* Test form parameter(s) for multipart schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param marker The marker parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testFormObjectMultipartRequestCreation(TestFormObjectMultipartRequestMarker marker) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// verify the required parameter 'marker' is set
|
||||
if (marker == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter 'marker' when calling testFormObjectMultipart", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
if (marker != null)
|
||||
formParams.add("marker", marker);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"multipart/form-data"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/form/object/multipart", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for multipart schema
|
||||
* Test form parameter(s) for multipart schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param marker The marker parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testFormObjectMultipartRequestCreation(marker).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for multipart schema
|
||||
* Test form parameter(s) for multipart schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param marker The marker parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testFormObjectMultipartWithHttpInfo(TestFormObjectMultipartRequestMarker marker) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testFormObjectMultipartRequestCreation(marker).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for multipart schema
|
||||
* Test form parameter(s) for multipart schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param marker The marker parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testFormObjectMultipartWithResponseSpec(TestFormObjectMultipartRequestMarker marker) throws RestClientResponseException {
|
||||
return testFormObjectMultipartRequestCreation(marker);
|
||||
}
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param form1 The form1 parameter
|
||||
* @param form2 The form2 parameter
|
||||
* @param form3 The form3 parameter
|
||||
* @param form4 The form4 parameter
|
||||
* @param id The id parameter
|
||||
* @param name The name parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testFormOneofRequestCreation(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
if (form1 != null)
|
||||
formParams.add("form1", form1);
|
||||
if (form2 != null)
|
||||
formParams.add("form2", form2);
|
||||
if (form3 != null)
|
||||
formParams.add("form3", form3);
|
||||
if (form4 != null)
|
||||
formParams.add("form4", form4);
|
||||
if (id != null)
|
||||
formParams.add("id", id);
|
||||
if (name != null)
|
||||
formParams.add("name", name);
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/x-www-form-urlencoded"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/form/oneof", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param form1 The form1 parameter
|
||||
* @param form2 The form2 parameter
|
||||
* @param form3 The form3 parameter
|
||||
* @param form4 The form4 parameter
|
||||
* @param id The id parameter
|
||||
* @param name The name parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testFormOneofRequestCreation(form1, form2, form3, form4, id, name).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param form1 The form1 parameter
|
||||
* @param form2 The form2 parameter
|
||||
* @param form3 The form3 parameter
|
||||
* @param form4 The form4 parameter
|
||||
* @param id The id parameter
|
||||
* @param name The name parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testFormOneofWithHttpInfo(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testFormOneofRequestCreation(form1, form2, form3, form4, id, name).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* Test form parameter(s) for oneOf schema
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param form1 The form1 parameter
|
||||
* @param form2 The form2 parameter
|
||||
* @param form3 The form3 parameter
|
||||
* @param form4 The form4 parameter
|
||||
* @param id The id parameter
|
||||
* @param name The name parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testFormOneofWithResponseSpec(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws RestClientResponseException {
|
||||
return testFormOneofRequestCreation(form1, form2, form3, form4, id, name);
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class HeaderApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public HeaderApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public HeaderApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerHeader The integerHeader parameter
|
||||
* @param booleanHeader The booleanHeader parameter
|
||||
* @param stringHeader The stringHeader parameter
|
||||
* @param enumNonrefStringHeader The enumNonrefStringHeader parameter
|
||||
* @param enumRefStringHeader The enumRefStringHeader parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testHeaderIntegerBooleanStringEnumsRequestCreation(Integer integerHeader, Boolean booleanHeader, String stringHeader, String enumNonrefStringHeader, StringEnumRef enumRefStringHeader) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
|
||||
if (integerHeader != null)
|
||||
headerParams.add("integer_header", apiClient.parameterToString(integerHeader));
|
||||
if (booleanHeader != null)
|
||||
headerParams.add("boolean_header", apiClient.parameterToString(booleanHeader));
|
||||
if (stringHeader != null)
|
||||
headerParams.add("string_header", apiClient.parameterToString(stringHeader));
|
||||
if (enumNonrefStringHeader != null)
|
||||
headerParams.add("enum_nonref_string_header", apiClient.parameterToString(enumNonrefStringHeader));
|
||||
if (enumRefStringHeader != null)
|
||||
headerParams.add("enum_ref_string_header", apiClient.parameterToString(enumRefStringHeader));
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/header/integer/boolean/string/enums", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerHeader The integerHeader parameter
|
||||
* @param booleanHeader The booleanHeader parameter
|
||||
* @param stringHeader The stringHeader parameter
|
||||
* @param enumNonrefStringHeader The enumNonrefStringHeader parameter
|
||||
* @param enumRefStringHeader The enumRefStringHeader parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testHeaderIntegerBooleanStringEnums(Integer integerHeader, Boolean booleanHeader, String stringHeader, String enumNonrefStringHeader, StringEnumRef enumRefStringHeader) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testHeaderIntegerBooleanStringEnumsRequestCreation(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerHeader The integerHeader parameter
|
||||
* @param booleanHeader The booleanHeader parameter
|
||||
* @param stringHeader The stringHeader parameter
|
||||
* @param enumNonrefStringHeader The enumNonrefStringHeader parameter
|
||||
* @param enumRefStringHeader The enumRefStringHeader parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testHeaderIntegerBooleanStringEnumsWithHttpInfo(Integer integerHeader, Boolean booleanHeader, String stringHeader, String enumNonrefStringHeader, StringEnumRef enumRefStringHeader) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testHeaderIntegerBooleanStringEnumsRequestCreation(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerHeader The integerHeader parameter
|
||||
* @param booleanHeader The booleanHeader parameter
|
||||
* @param stringHeader The stringHeader parameter
|
||||
* @param enumNonrefStringHeader The enumNonrefStringHeader parameter
|
||||
* @param enumRefStringHeader The enumRefStringHeader parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testHeaderIntegerBooleanStringEnumsWithResponseSpec(Integer integerHeader, Boolean booleanHeader, String stringHeader, String enumNonrefStringHeader, StringEnumRef enumRefStringHeader) throws RestClientResponseException {
|
||||
return testHeaderIntegerBooleanStringEnumsRequestCreation(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader);
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class PathApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public PathApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public PathApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pathString The pathString parameter
|
||||
* @param pathInteger The pathInteger parameter
|
||||
* @param enumNonrefStringPath The enumNonrefStringPath parameter
|
||||
* @param enumRefStringPath The enumRefStringPath parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestCreation(String pathString, Integer pathInteger, String enumNonrefStringPath, StringEnumRef enumRefStringPath) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// verify the required parameter 'pathString' is set
|
||||
if (pathString == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// verify the required parameter 'pathInteger' is set
|
||||
if (pathInteger == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// verify the required parameter 'enumNonrefStringPath' is set
|
||||
if (enumNonrefStringPath == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter 'enumNonrefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// verify the required parameter 'enumRefStringPath' is set
|
||||
if (enumRefStringPath == null) {
|
||||
throw new RestClientResponseException("Missing the required parameter 'enumRefStringPath' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
|
||||
}
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
pathParams.put("path_string", pathString);
|
||||
pathParams.put("path_integer", pathInteger);
|
||||
pathParams.put("enum_nonref_string_path", enumNonrefStringPath);
|
||||
pathParams.put("enum_ref_string_path", enumRefStringPath);
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pathString The pathString parameter
|
||||
* @param pathInteger The pathInteger parameter
|
||||
* @param enumNonrefStringPath The enumNonrefStringPath parameter
|
||||
* @param enumRefStringPath The enumRefStringPath parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(String pathString, Integer pathInteger, String enumNonrefStringPath, StringEnumRef enumRefStringPath) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestCreation(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pathString The pathString parameter
|
||||
* @param pathInteger The pathInteger parameter
|
||||
* @param enumNonrefStringPath The enumNonrefStringPath parameter
|
||||
* @param enumRefStringPath The enumRefStringPath parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(String pathString, Integer pathInteger, String enumNonrefStringPath, StringEnumRef enumRefStringPath) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestCreation(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
* Test path parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param pathString The pathString parameter
|
||||
* @param pathInteger The pathInteger parameter
|
||||
* @param enumNonrefStringPath The enumNonrefStringPath parameter
|
||||
* @param enumRefStringPath The enumRefStringPath parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithResponseSpec(String pathString, Integer pathInteger, String enumNonrefStringPath, StringEnumRef enumRefStringPath) throws RestClientResponseException {
|
||||
return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestCreation(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
|
||||
}
|
||||
}
|
@ -0,0 +1,788 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import org.openapitools.client.model.DataQuery;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Instant;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter;
|
||||
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.web.client.RestClient.ResponseSpec;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class QueryApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public QueryApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public QueryApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param enumNonrefStringQuery The enumNonrefStringQuery parameter
|
||||
* @param enumRefStringQuery The enumRefStringQuery parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testEnumRefStringRequestCreation(String enumNonrefStringQuery, StringEnumRef enumRefStringQuery) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_nonref_string_query", enumNonrefStringQuery));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_ref_string_query", enumRefStringQuery));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/enum_ref_string", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param enumNonrefStringQuery The enumNonrefStringQuery parameter
|
||||
* @param enumRefStringQuery The enumRefStringQuery parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testEnumRefString(String enumNonrefStringQuery, StringEnumRef enumRefStringQuery) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEnumRefStringRequestCreation(enumNonrefStringQuery, enumRefStringQuery).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param enumNonrefStringQuery The enumNonrefStringQuery parameter
|
||||
* @param enumRefStringQuery The enumRefStringQuery parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testEnumRefStringWithHttpInfo(String enumNonrefStringQuery, StringEnumRef enumRefStringQuery) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testEnumRefStringRequestCreation(enumNonrefStringQuery, enumRefStringQuery).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param enumNonrefStringQuery The enumNonrefStringQuery parameter
|
||||
* @param enumRefStringQuery The enumRefStringQuery parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testEnumRefStringWithResponseSpec(String enumNonrefStringQuery, StringEnumRef enumRefStringQuery) throws RestClientResponseException {
|
||||
return testEnumRefStringRequestCreation(enumNonrefStringQuery, enumRefStringQuery);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param datetimeQuery The datetimeQuery parameter
|
||||
* @param dateQuery The dateQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryDatetimeDateStringRequestCreation(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "datetime_query", datetimeQuery));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "date_query", dateQuery));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "string_query", stringQuery));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/datetime/date/string", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param datetimeQuery The datetimeQuery parameter
|
||||
* @param dateQuery The dateQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryDatetimeDateString(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryDatetimeDateStringRequestCreation(datetimeQuery, dateQuery, stringQuery).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param datetimeQuery The datetimeQuery parameter
|
||||
* @param dateQuery The dateQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryDatetimeDateStringWithHttpInfo(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryDatetimeDateStringRequestCreation(datetimeQuery, dateQuery, stringQuery).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param datetimeQuery The datetimeQuery parameter
|
||||
* @param dateQuery The dateQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryDatetimeDateStringWithResponseSpec(Instant datetimeQuery, LocalDate dateQuery, String stringQuery) throws RestClientResponseException {
|
||||
return testQueryDatetimeDateStringRequestCreation(datetimeQuery, dateQuery, stringQuery);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerQuery The integerQuery parameter
|
||||
* @param booleanQuery The booleanQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryIntegerBooleanStringRequestCreation(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "integer_query", integerQuery));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "boolean_query", booleanQuery));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "string_query", stringQuery));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/integer/boolean/string", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerQuery The integerQuery parameter
|
||||
* @param booleanQuery The booleanQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryIntegerBooleanString(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryIntegerBooleanStringRequestCreation(integerQuery, booleanQuery, stringQuery).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerQuery The integerQuery parameter
|
||||
* @param booleanQuery The booleanQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryIntegerBooleanStringWithHttpInfo(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryIntegerBooleanStringRequestCreation(integerQuery, booleanQuery, stringQuery).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param integerQuery The integerQuery parameter
|
||||
* @param booleanQuery The booleanQuery parameter
|
||||
* @param stringQuery The stringQuery parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryIntegerBooleanStringWithResponseSpec(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws RestClientResponseException {
|
||||
return testQueryIntegerBooleanStringRequestCreation(integerQuery, booleanQuery, stringQuery);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleDeepObjectExplodeTrueObjectRequestCreation(Pet queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "id", queryObject.getId()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "name", queryObject.getName()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "category", queryObject.getCategory()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "photoUrls", queryObject.getPhotoUrls()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tags", queryObject.getTags()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "status", queryObject.getStatus()));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_deepObject/explode_true/object", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleDeepObjectExplodeTrueObject(Pet queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleDeepObjectExplodeTrueObjectRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(Pet queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleDeepObjectExplodeTrueObjectRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleDeepObjectExplodeTrueObjectWithResponseSpec(Pet queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleDeepObjectExplodeTrueObjectRequestCreation(queryObject);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestCreation(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query_object", queryObject));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_deepObject/explode_true/object/allOf", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleDeepObjectExplodeTrueObjectAllOfWithResponseSpec(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestCreation(queryObject);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleFormExplodeFalseArrayIntegerRequestCreation(List<Integer> queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "query_object", queryObject));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_form/explode_false/array_integer", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleFormExplodeFalseArrayInteger(List<Integer> queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeFalseArrayIntegerRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(List<Integer> queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeFalseArrayIntegerRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleFormExplodeFalseArrayIntegerWithResponseSpec(List<Integer> queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleFormExplodeFalseArrayIntegerRequestCreation(queryObject);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleFormExplodeFalseArrayStringRequestCreation(List<String> queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase(Locale.ROOT)), "query_object", queryObject));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_form/explode_false/array_string", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleFormExplodeFalseArrayString(List<String> queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeFalseArrayStringRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(List<String> queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeFalseArrayStringRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleFormExplodeFalseArrayStringWithResponseSpec(List<String> queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleFormExplodeFalseArrayStringRequestCreation(queryObject);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleFormExplodeTrueArrayStringRequestCreation(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "values", queryObject.getValues()));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_form/explode_true/array_string", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueArrayString(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeTrueArrayStringRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeTrueArrayStringRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleFormExplodeTrueArrayStringWithResponseSpec(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleFormExplodeTrueArrayStringRequestCreation(queryObject);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleFormExplodeTrueObjectRequestCreation(Pet queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "id", queryObject.getId()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "name", queryObject.getName()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "category", queryObject.getCategory()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "photoUrls", queryObject.getPhotoUrls()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tags", queryObject.getTags()));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "status", queryObject.getStatus()));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_form/explode_true/object", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueObject(Pet queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeTrueObjectRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleFormExplodeTrueObjectWithHttpInfo(Pet queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeTrueObjectRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleFormExplodeTrueObjectWithResponseSpec(Pet queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleFormExplodeTrueObjectRequestCreation(queryObject);
|
||||
}
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec testQueryStyleFormExplodeTrueObjectAllOfRequestCreation(DataQuery queryObject) throws RestClientResponseException {
|
||||
Object postBody = null;
|
||||
// create path and map variables
|
||||
final Map<String, Object> pathParams = new HashMap<>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query_object", queryObject));
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"text/plain"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return apiClient.invokeAPI("/query/style_form/explode_true/object/allOf", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return String
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public String testQueryStyleFormExplodeTrueObjectAllOf(DataQuery queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeTrueObjectAllOfRequestCreation(queryObject).body(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseEntity<String>
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<String> testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(DataQuery queryObject) throws RestClientResponseException {
|
||||
ParameterizedTypeReference<String> localVarReturnType = new ParameterizedTypeReference<>() {};
|
||||
return testQueryStyleFormExplodeTrueObjectAllOfRequestCreation(queryObject).toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* Test query parameter(s)
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param queryObject The queryObject parameter
|
||||
* @return ResponseSpec
|
||||
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseSpec testQueryStyleFormExplodeTrueObjectAllOfWithResponseSpec(DataQuery queryObject) throws RestClientResponseException {
|
||||
return testQueryStyleFormExplodeTrueObjectAllOfRequestCreation(queryObject);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class ApiKeyAuth implements Authentication {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
private String apiKey;
|
||||
private String apiKeyPrefix;
|
||||
|
||||
public ApiKeyAuth(String location, String paramName) {
|
||||
this.location = location;
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public String getApiKeyPrefix() {
|
||||
return apiKeyPrefix;
|
||||
}
|
||||
|
||||
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||
this.apiKeyPrefix = apiKeyPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (apiKey == null) {
|
||||
return;
|
||||
}
|
||||
String value;
|
||||
if (apiKeyPrefix != null) {
|
||||
value = apiKeyPrefix + " " + apiKey;
|
||||
} else {
|
||||
value = apiKey;
|
||||
}
|
||||
if (location.equals("query")) {
|
||||
queryParams.add(paramName, value);
|
||||
} else if (location.equals("header")) {
|
||||
headerParams.add(paramName, value);
|
||||
} else if (location.equals("cookie")) {
|
||||
cookieParams.add(paramName, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
public interface Authentication {
|
||||
/**
|
||||
* Apply authentication settings to header and / or query parameters.
|
||||
* @param queryParams The query parameters for the request
|
||||
* @param headerParams The header parameters for the request
|
||||
* @param cookieParams The cookie parameters for the request
|
||||
*/
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams);
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class HttpBasicAuth implements Authentication {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
if (username == null && password == null) {
|
||||
return;
|
||||
}
|
||||
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class HttpBearerAuth implements Authentication {
|
||||
private final String scheme;
|
||||
private Supplier<String> tokenSupplier;
|
||||
|
||||
public HttpBearerAuth(String scheme) {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @return The bearer token
|
||||
*/
|
||||
public String getBearerToken() {
|
||||
return tokenSupplier.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @param bearerToken The bearer token to send in the Authorization header
|
||||
*/
|
||||
public void setBearerToken(String bearerToken) {
|
||||
this.tokenSupplier = () -> bearerToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header.
|
||||
*
|
||||
* @param tokenSupplier The supplier of bearer tokens to send in the Authorization header
|
||||
*/
|
||||
public void setBearerToken(Supplier<String> tokenSupplier) {
|
||||
this.tokenSupplier = tokenSupplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyToParams(MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) {
|
||||
String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null);
|
||||
if (bearerToken == null) {
|
||||
return;
|
||||
}
|
||||
headerParams.add(HttpHeaders.AUTHORIZATION, (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||
}
|
||||
|
||||
private static String upperCaseBearer(String scheme) {
|
||||
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* Bird
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
Bird.JSON_PROPERTY_SIZE,
|
||||
Bird.JSON_PROPERTY_COLOR
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class Bird {
|
||||
public static final String JSON_PROPERTY_SIZE = "size";
|
||||
private String size;
|
||||
|
||||
public static final String JSON_PROPERTY_COLOR = "color";
|
||||
private String color;
|
||||
|
||||
public Bird() {
|
||||
}
|
||||
|
||||
public Bird size(String size) {
|
||||
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get size
|
||||
* @return size
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SIZE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SIZE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setSize(String size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Bird color(String color) {
|
||||
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color
|
||||
* @return color
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_COLOR)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_COLOR)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Bird bird = (Bird) o;
|
||||
return Objects.equals(this.size, bird.size) &&
|
||||
Objects.equals(this.color, bird.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(size, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Bird {\n");
|
||||
sb.append(" size: ").append(toIndentedString(size)).append("\n");
|
||||
sb.append(" color: ").append(toIndentedString(color)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* Category
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
Category.JSON_PROPERTY_ID,
|
||||
Category.JSON_PROPERTY_NAME
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class Category {
|
||||
public static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME = "name";
|
||||
private String name;
|
||||
|
||||
public Category() {
|
||||
}
|
||||
|
||||
public Category id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Category name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(this.id, category.id) &&
|
||||
Objects.equals(this.name, category.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.Query;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* DataQuery
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
DataQuery.JSON_PROPERTY_SUFFIX,
|
||||
DataQuery.JSON_PROPERTY_TEXT,
|
||||
DataQuery.JSON_PROPERTY_DATE
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class DataQuery extends Query {
|
||||
public static final String JSON_PROPERTY_SUFFIX = "suffix";
|
||||
private String suffix;
|
||||
|
||||
public static final String JSON_PROPERTY_TEXT = "text";
|
||||
private String text;
|
||||
|
||||
public static final String JSON_PROPERTY_DATE = "date";
|
||||
private Instant date;
|
||||
|
||||
public DataQuery() {
|
||||
|
||||
}
|
||||
|
||||
public DataQuery suffix(String suffix) {
|
||||
|
||||
this.suffix = suffix;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* test suffix
|
||||
* @return suffix
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SUFFIX)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SUFFIX)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public DataQuery text(String text) {
|
||||
|
||||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some text containing white spaces
|
||||
* @return text
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_TEXT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_TEXT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public DataQuery date(Instant date) {
|
||||
|
||||
this.date = date;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A date
|
||||
* @return date
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_DATE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Instant getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_DATE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setDate(Instant date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataQuery id(Long id) {
|
||||
this.setId(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataQuery outcomes(List<OutcomesEnum> outcomes) {
|
||||
this.setOutcomes(outcomes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DataQuery dataQuery = (DataQuery) o;
|
||||
return Objects.equals(this.suffix, dataQuery.suffix) &&
|
||||
Objects.equals(this.text, dataQuery.text) &&
|
||||
Objects.equals(this.date, dataQuery.date) &&
|
||||
super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(suffix, text, date, super.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class DataQuery {\n");
|
||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||
sb.append(" suffix: ").append(toIndentedString(suffix)).append("\n");
|
||||
sb.append(" text: ").append(toIndentedString(text)).append("\n");
|
||||
sb.append(" date: ").append(toIndentedString(date)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,464 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import java.util.NoSuchElementException;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* to test the default value of properties
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT,
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT,
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING_DEFAULT,
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_INTEGER_DEFAULT,
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING,
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING_NULLABLE,
|
||||
DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE,
|
||||
DefaultValue.JSON_PROPERTY_STRING_NULLABLE
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class DefaultValue {
|
||||
public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT = "array_string_enum_ref_default";
|
||||
private List<StringEnumRef> arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE));
|
||||
|
||||
/**
|
||||
* Gets or Sets arrayStringEnumDefault
|
||||
*/
|
||||
public enum ArrayStringEnumDefaultEnum {
|
||||
SUCCESS("success"),
|
||||
|
||||
FAILURE("failure"),
|
||||
|
||||
UNCLASSIFIED("unclassified");
|
||||
|
||||
private String value;
|
||||
|
||||
ArrayStringEnumDefaultEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static ArrayStringEnumDefaultEnum fromValue(String value) {
|
||||
for (ArrayStringEnumDefaultEnum b : ArrayStringEnumDefaultEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT = "array_string_enum_default";
|
||||
private List<ArrayStringEnumDefaultEnum> arrayStringEnumDefault = new ArrayList<>(Arrays.asList(ArrayStringEnumDefaultEnum.SUCCESS, ArrayStringEnumDefaultEnum.FAILURE));
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_STRING_DEFAULT = "array_string_default";
|
||||
private List<String> arrayStringDefault = new ArrayList<>(Arrays.asList("failure", "skipped"));
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_INTEGER_DEFAULT = "array_integer_default";
|
||||
private List<Integer> arrayIntegerDefault = new ArrayList<>(Arrays.asList(1, 3));
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_STRING = "array_string";
|
||||
private List<String> arrayString = new ArrayList<>();
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_STRING_NULLABLE = "array_string_nullable";
|
||||
private JsonNullable<List<String>> arrayStringNullable = JsonNullable.<List<String>>undefined();
|
||||
|
||||
public static final String JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE = "array_string_extension_nullable";
|
||||
private JsonNullable<List<String>> arrayStringExtensionNullable = JsonNullable.<List<String>>undefined();
|
||||
|
||||
public static final String JSON_PROPERTY_STRING_NULLABLE = "string_nullable";
|
||||
private JsonNullable<String> stringNullable = JsonNullable.<String>undefined();
|
||||
|
||||
public DefaultValue() {
|
||||
}
|
||||
|
||||
public DefaultValue arrayStringEnumRefDefault(List<StringEnumRef> arrayStringEnumRefDefault) {
|
||||
|
||||
this.arrayStringEnumRefDefault = arrayStringEnumRefDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayStringEnumRefDefaultItem(StringEnumRef arrayStringEnumRefDefaultItem) {
|
||||
if (this.arrayStringEnumRefDefault == null) {
|
||||
this.arrayStringEnumRefDefault = new ArrayList<>(Arrays.asList(StringEnumRef.SUCCESS, StringEnumRef.FAILURE));
|
||||
}
|
||||
this.arrayStringEnumRefDefault.add(arrayStringEnumRefDefaultItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayStringEnumRefDefault
|
||||
* @return arrayStringEnumRefDefault
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<StringEnumRef> getArrayStringEnumRefDefault() {
|
||||
return arrayStringEnumRefDefault;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_REF_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setArrayStringEnumRefDefault(List<StringEnumRef> arrayStringEnumRefDefault) {
|
||||
this.arrayStringEnumRefDefault = arrayStringEnumRefDefault;
|
||||
}
|
||||
|
||||
public DefaultValue arrayStringEnumDefault(List<ArrayStringEnumDefaultEnum> arrayStringEnumDefault) {
|
||||
|
||||
this.arrayStringEnumDefault = arrayStringEnumDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayStringEnumDefaultItem(ArrayStringEnumDefaultEnum arrayStringEnumDefaultItem) {
|
||||
if (this.arrayStringEnumDefault == null) {
|
||||
this.arrayStringEnumDefault = new ArrayList<>(Arrays.asList(ArrayStringEnumDefaultEnum.SUCCESS, ArrayStringEnumDefaultEnum.FAILURE));
|
||||
}
|
||||
this.arrayStringEnumDefault.add(arrayStringEnumDefaultItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayStringEnumDefault
|
||||
* @return arrayStringEnumDefault
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<ArrayStringEnumDefaultEnum> getArrayStringEnumDefault() {
|
||||
return arrayStringEnumDefault;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_ENUM_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setArrayStringEnumDefault(List<ArrayStringEnumDefaultEnum> arrayStringEnumDefault) {
|
||||
this.arrayStringEnumDefault = arrayStringEnumDefault;
|
||||
}
|
||||
|
||||
public DefaultValue arrayStringDefault(List<String> arrayStringDefault) {
|
||||
|
||||
this.arrayStringDefault = arrayStringDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayStringDefaultItem(String arrayStringDefaultItem) {
|
||||
if (this.arrayStringDefault == null) {
|
||||
this.arrayStringDefault = new ArrayList<>(Arrays.asList("failure", "skipped"));
|
||||
}
|
||||
this.arrayStringDefault.add(arrayStringDefaultItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayStringDefault
|
||||
* @return arrayStringDefault
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<String> getArrayStringDefault() {
|
||||
return arrayStringDefault;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setArrayStringDefault(List<String> arrayStringDefault) {
|
||||
this.arrayStringDefault = arrayStringDefault;
|
||||
}
|
||||
|
||||
public DefaultValue arrayIntegerDefault(List<Integer> arrayIntegerDefault) {
|
||||
|
||||
this.arrayIntegerDefault = arrayIntegerDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayIntegerDefaultItem(Integer arrayIntegerDefaultItem) {
|
||||
if (this.arrayIntegerDefault == null) {
|
||||
this.arrayIntegerDefault = new ArrayList<>(Arrays.asList(1, 3));
|
||||
}
|
||||
this.arrayIntegerDefault.add(arrayIntegerDefaultItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayIntegerDefault
|
||||
* @return arrayIntegerDefault
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_INTEGER_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<Integer> getArrayIntegerDefault() {
|
||||
return arrayIntegerDefault;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_INTEGER_DEFAULT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setArrayIntegerDefault(List<Integer> arrayIntegerDefault) {
|
||||
this.arrayIntegerDefault = arrayIntegerDefault;
|
||||
}
|
||||
|
||||
public DefaultValue arrayString(List<String> arrayString) {
|
||||
|
||||
this.arrayString = arrayString;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayStringItem(String arrayStringItem) {
|
||||
if (this.arrayString == null) {
|
||||
this.arrayString = new ArrayList<>();
|
||||
}
|
||||
this.arrayString.add(arrayStringItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayString
|
||||
* @return arrayString
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<String> getArrayString() {
|
||||
return arrayString;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setArrayString(List<String> arrayString) {
|
||||
this.arrayString = arrayString;
|
||||
}
|
||||
|
||||
public DefaultValue arrayStringNullable(List<String> arrayStringNullable) {
|
||||
this.arrayStringNullable = JsonNullable.<List<String>>of(arrayStringNullable);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayStringNullableItem(String arrayStringNullableItem) {
|
||||
if (this.arrayStringNullable == null || !this.arrayStringNullable.isPresent()) {
|
||||
this.arrayStringNullable = JsonNullable.<List<String>>of(new ArrayList<>());
|
||||
}
|
||||
try {
|
||||
this.arrayStringNullable.get().add(arrayStringNullableItem);
|
||||
} catch (java.util.NoSuchElementException e) {
|
||||
// this can never happen, as we make sure above that the value is present
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayStringNullable
|
||||
* @return arrayStringNullable
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonIgnore
|
||||
|
||||
public List<String> getArrayStringNullable() {
|
||||
return arrayStringNullable.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_NULLABLE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<List<String>> getArrayStringNullable_JsonNullable() {
|
||||
return arrayStringNullable;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_NULLABLE)
|
||||
public void setArrayStringNullable_JsonNullable(JsonNullable<List<String>> arrayStringNullable) {
|
||||
this.arrayStringNullable = arrayStringNullable;
|
||||
}
|
||||
|
||||
public void setArrayStringNullable(List<String> arrayStringNullable) {
|
||||
this.arrayStringNullable = JsonNullable.<List<String>>of(arrayStringNullable);
|
||||
}
|
||||
|
||||
public DefaultValue arrayStringExtensionNullable(List<String> arrayStringExtensionNullable) {
|
||||
this.arrayStringExtensionNullable = JsonNullable.<List<String>>of(arrayStringExtensionNullable);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) {
|
||||
if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) {
|
||||
this.arrayStringExtensionNullable = JsonNullable.<List<String>>of(new ArrayList<>());
|
||||
}
|
||||
try {
|
||||
this.arrayStringExtensionNullable.get().add(arrayStringExtensionNullableItem);
|
||||
} catch (java.util.NoSuchElementException e) {
|
||||
// this can never happen, as we make sure above that the value is present
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arrayStringExtensionNullable
|
||||
* @return arrayStringExtensionNullable
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonIgnore
|
||||
|
||||
public List<String> getArrayStringExtensionNullable() {
|
||||
return arrayStringExtensionNullable.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<List<String>> getArrayStringExtensionNullable_JsonNullable() {
|
||||
return arrayStringExtensionNullable;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE)
|
||||
public void setArrayStringExtensionNullable_JsonNullable(JsonNullable<List<String>> arrayStringExtensionNullable) {
|
||||
this.arrayStringExtensionNullable = arrayStringExtensionNullable;
|
||||
}
|
||||
|
||||
public void setArrayStringExtensionNullable(List<String> arrayStringExtensionNullable) {
|
||||
this.arrayStringExtensionNullable = JsonNullable.<List<String>>of(arrayStringExtensionNullable);
|
||||
}
|
||||
|
||||
public DefaultValue stringNullable(String stringNullable) {
|
||||
this.stringNullable = JsonNullable.<String>of(stringNullable);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stringNullable
|
||||
* @return stringNullable
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonIgnore
|
||||
|
||||
public String getStringNullable() {
|
||||
return stringNullable.orElse(null);
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_STRING_NULLABLE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public JsonNullable<String> getStringNullable_JsonNullable() {
|
||||
return stringNullable;
|
||||
}
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_STRING_NULLABLE)
|
||||
public void setStringNullable_JsonNullable(JsonNullable<String> stringNullable) {
|
||||
this.stringNullable = stringNullable;
|
||||
}
|
||||
|
||||
public void setStringNullable(String stringNullable) {
|
||||
this.stringNullable = JsonNullable.<String>of(stringNullable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DefaultValue defaultValue = (DefaultValue) o;
|
||||
return Objects.equals(this.arrayStringEnumRefDefault, defaultValue.arrayStringEnumRefDefault) &&
|
||||
Objects.equals(this.arrayStringEnumDefault, defaultValue.arrayStringEnumDefault) &&
|
||||
Objects.equals(this.arrayStringDefault, defaultValue.arrayStringDefault) &&
|
||||
Objects.equals(this.arrayIntegerDefault, defaultValue.arrayIntegerDefault) &&
|
||||
Objects.equals(this.arrayString, defaultValue.arrayString) &&
|
||||
equalsNullable(this.arrayStringNullable, defaultValue.arrayStringNullable) &&
|
||||
equalsNullable(this.arrayStringExtensionNullable, defaultValue.arrayStringExtensionNullable) &&
|
||||
equalsNullable(this.stringNullable, defaultValue.stringNullable);
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, hashCodeNullable(arrayStringNullable), hashCodeNullable(arrayStringExtensionNullable), hashCodeNullable(stringNullable));
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
if (a == null) {
|
||||
return 1;
|
||||
}
|
||||
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class DefaultValue {\n");
|
||||
sb.append(" arrayStringEnumRefDefault: ").append(toIndentedString(arrayStringEnumRefDefault)).append("\n");
|
||||
sb.append(" arrayStringEnumDefault: ").append(toIndentedString(arrayStringEnumDefault)).append("\n");
|
||||
sb.append(" arrayStringDefault: ").append(toIndentedString(arrayStringDefault)).append("\n");
|
||||
sb.append(" arrayIntegerDefault: ").append(toIndentedString(arrayIntegerDefault)).append("\n");
|
||||
sb.append(" arrayString: ").append(toIndentedString(arrayString)).append("\n");
|
||||
sb.append(" arrayStringNullable: ").append(toIndentedString(arrayStringNullable)).append("\n");
|
||||
sb.append(" arrayStringExtensionNullable: ").append(toIndentedString(arrayStringExtensionNullable)).append("\n");
|
||||
sb.append(" stringNullable: ").append(toIndentedString(stringNullable)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* NumberPropertiesOnly
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
NumberPropertiesOnly.JSON_PROPERTY_NUMBER,
|
||||
NumberPropertiesOnly.JSON_PROPERTY_FLOAT,
|
||||
NumberPropertiesOnly.JSON_PROPERTY_DOUBLE
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class NumberPropertiesOnly {
|
||||
public static final String JSON_PROPERTY_NUMBER = "number";
|
||||
private BigDecimal number;
|
||||
|
||||
public static final String JSON_PROPERTY_FLOAT = "float";
|
||||
private Float _float;
|
||||
|
||||
public static final String JSON_PROPERTY_DOUBLE = "double";
|
||||
private Double _double;
|
||||
|
||||
public NumberPropertiesOnly() {
|
||||
}
|
||||
|
||||
public NumberPropertiesOnly number(BigDecimal number) {
|
||||
|
||||
this.number = number;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number
|
||||
* @return number
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NUMBER)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public BigDecimal getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NUMBER)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setNumber(BigDecimal number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public NumberPropertiesOnly _float(Float _float) {
|
||||
|
||||
this._float = _float;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _float
|
||||
* @return _float
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_FLOAT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Float getFloat() {
|
||||
return _float;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_FLOAT)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setFloat(Float _float) {
|
||||
this._float = _float;
|
||||
}
|
||||
|
||||
public NumberPropertiesOnly _double(Double _double) {
|
||||
|
||||
this._double = _double;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _double
|
||||
* minimum: 0.8
|
||||
* maximum: 50.2
|
||||
* @return _double
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_DOUBLE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Double getDouble() {
|
||||
return _double;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_DOUBLE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setDouble(Double _double) {
|
||||
this._double = _double;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NumberPropertiesOnly numberPropertiesOnly = (NumberPropertiesOnly) o;
|
||||
return Objects.equals(this.number, numberPropertiesOnly.number) &&
|
||||
Objects.equals(this._float, numberPropertiesOnly._float) &&
|
||||
Objects.equals(this._double, numberPropertiesOnly._double);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(number, _float, _double);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class NumberPropertiesOnly {\n");
|
||||
sb.append(" number: ").append(toIndentedString(number)).append("\n");
|
||||
sb.append(" _float: ").append(toIndentedString(_float)).append("\n");
|
||||
sb.append(" _double: ").append(toIndentedString(_double)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,316 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.Category;
|
||||
import org.openapitools.client.model.Tag;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* Pet
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
Pet.JSON_PROPERTY_ID,
|
||||
Pet.JSON_PROPERTY_NAME,
|
||||
Pet.JSON_PROPERTY_CATEGORY,
|
||||
Pet.JSON_PROPERTY_PHOTO_URLS,
|
||||
Pet.JSON_PROPERTY_TAGS,
|
||||
Pet.JSON_PROPERTY_STATUS
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class Pet {
|
||||
public static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME = "name";
|
||||
private String name;
|
||||
|
||||
public static final String JSON_PROPERTY_CATEGORY = "category";
|
||||
private Category category;
|
||||
|
||||
public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls";
|
||||
private List<String> photoUrls = new ArrayList<>();
|
||||
|
||||
public static final String JSON_PROPERTY_TAGS = "tags";
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
|
||||
PENDING("pending"),
|
||||
|
||||
SOLD("sold");
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static StatusEnum fromValue(String value) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_STATUS = "status";
|
||||
private StatusEnum status;
|
||||
|
||||
public Pet() {
|
||||
}
|
||||
|
||||
public Pet id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Pet name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@jakarta.annotation.Nonnull
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Pet category(Category category) {
|
||||
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get category
|
||||
* @return category
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_CATEGORY)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_CATEGORY)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Pet photoUrls(List<String> photoUrls) {
|
||||
|
||||
this.photoUrls = photoUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pet addPhotoUrlsItem(String photoUrlsItem) {
|
||||
if (this.photoUrls == null) {
|
||||
this.photoUrls = new ArrayList<>();
|
||||
}
|
||||
this.photoUrls.add(photoUrlsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get photoUrls
|
||||
* @return photoUrls
|
||||
**/
|
||||
@jakarta.annotation.Nonnull
|
||||
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
|
||||
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
|
||||
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
public Pet tags(List<Tag> tags) {
|
||||
|
||||
this.tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pet addTagsItem(Tag tagsItem) {
|
||||
if (this.tags == null) {
|
||||
this.tags = new ArrayList<>();
|
||||
}
|
||||
this.tags.add(tagsItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tags
|
||||
* @return tags
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_TAGS)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_TAGS)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Pet status(StatusEnum status) {
|
||||
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
* @return status
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_STATUS)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_STATUS)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(this.id, pet.id) &&
|
||||
Objects.equals(this.name, pet.name) &&
|
||||
Objects.equals(this.category, pet.category) &&
|
||||
Objects.equals(this.photoUrls, pet.photoUrls) &&
|
||||
Objects.equals(this.tags, pet.tags) &&
|
||||
Objects.equals(this.status, pet.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, category, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* Query
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
Query.JSON_PROPERTY_ID,
|
||||
Query.JSON_PROPERTY_OUTCOMES
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class Query {
|
||||
public static final String JSON_PROPERTY_ID = "id";
|
||||
protected Long id;
|
||||
|
||||
/**
|
||||
* Gets or Sets outcomes
|
||||
*/
|
||||
public enum OutcomesEnum {
|
||||
SUCCESS("SUCCESS"),
|
||||
|
||||
FAILURE("FAILURE"),
|
||||
|
||||
SKIPPED("SKIPPED");
|
||||
|
||||
private String value;
|
||||
|
||||
OutcomesEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static OutcomesEnum fromValue(String value) {
|
||||
for (OutcomesEnum b : OutcomesEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public static final String JSON_PROPERTY_OUTCOMES = "outcomes";
|
||||
protected List<OutcomesEnum> outcomes = new ArrayList<>(Arrays.asList(OutcomesEnum.SUCCESS, OutcomesEnum.FAILURE));
|
||||
|
||||
public Query() {
|
||||
}
|
||||
|
||||
public Query id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query
|
||||
* @return id
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Query outcomes(List<OutcomesEnum> outcomes) {
|
||||
|
||||
this.outcomes = outcomes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query addOutcomesItem(OutcomesEnum outcomesItem) {
|
||||
if (this.outcomes == null) {
|
||||
this.outcomes = new ArrayList<>(Arrays.asList(OutcomesEnum.SUCCESS, OutcomesEnum.FAILURE));
|
||||
}
|
||||
this.outcomes.add(outcomesItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get outcomes
|
||||
* @return outcomes
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_OUTCOMES)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<OutcomesEnum> getOutcomes() {
|
||||
return outcomes;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_OUTCOMES)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setOutcomes(List<OutcomesEnum> outcomes) {
|
||||
this.outcomes = outcomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Query query = (Query) o;
|
||||
return Objects.equals(this.id, query.id) &&
|
||||
Objects.equals(this.outcomes, query.outcomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, outcomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Query {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" outcomes: ").append(toIndentedString(outcomes)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* Gets or Sets StringEnumRef
|
||||
*/
|
||||
public enum StringEnumRef {
|
||||
|
||||
SUCCESS("success"),
|
||||
|
||||
FAILURE("failure"),
|
||||
|
||||
UNCLASSIFIED("unclassified");
|
||||
|
||||
private String value;
|
||||
|
||||
StringEnumRef(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static StringEnumRef fromValue(String value) {
|
||||
for (StringEnumRef b : StringEnumRef.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* Tag
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
Tag.JSON_PROPERTY_ID,
|
||||
Tag.JSON_PROPERTY_NAME
|
||||
})
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class Tag {
|
||||
public static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME = "name";
|
||||
private String name;
|
||||
|
||||
public Tag() {
|
||||
}
|
||||
|
||||
public Tag id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Tag name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(this.id, tag.id) &&
|
||||
Objects.equals(this.name, tag.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* TestFormObjectMultipartRequestMarker
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
TestFormObjectMultipartRequestMarker.JSON_PROPERTY_NAME
|
||||
})
|
||||
@JsonTypeName("test_form_object_multipart_request_marker")
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class TestFormObjectMultipartRequestMarker {
|
||||
public static final String JSON_PROPERTY_NAME = "name";
|
||||
private String name;
|
||||
|
||||
public TestFormObjectMultipartRequestMarker() {
|
||||
}
|
||||
|
||||
public TestFormObjectMultipartRequestMarker name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestFormObjectMultipartRequestMarker testFormObjectMultipartRequestMarker = (TestFormObjectMultipartRequestMarker) o;
|
||||
return Objects.equals(this.name, testFormObjectMultipartRequestMarker.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestFormObjectMultipartRequestMarker {\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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_SIZE,
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_COLOR,
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_ID,
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.JSON_PROPERTY_NAME
|
||||
})
|
||||
@JsonTypeName("test_query_style_deepObject_explode_true_object_allOf_query_object_parameter")
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter {
|
||||
public static final String JSON_PROPERTY_SIZE = "size";
|
||||
private String size;
|
||||
|
||||
public static final String JSON_PROPERTY_COLOR = "color";
|
||||
private String color;
|
||||
|
||||
public static final String JSON_PROPERTY_ID = "id";
|
||||
private Long id;
|
||||
|
||||
public static final String JSON_PROPERTY_NAME = "name";
|
||||
private String name;
|
||||
|
||||
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() {
|
||||
}
|
||||
|
||||
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter size(String size) {
|
||||
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get size
|
||||
* @return size
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_SIZE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SIZE)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setSize(String size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter color(String color) {
|
||||
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color
|
||||
* @return color
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_COLOR)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_COLOR)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter id(Long id) {
|
||||
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_ID)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter name(String name) {
|
||||
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_NAME)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter = (TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) o;
|
||||
return Objects.equals(this.size, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.size) &&
|
||||
Objects.equals(this.color, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.color) &&
|
||||
Objects.equals(this.id, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.id) &&
|
||||
Objects.equals(this.name, testQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(size, color, id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter {\n");
|
||||
sb.append(" size: ").append(toIndentedString(size)).append("\n");
|
||||
sb.append(" color: ").append(toIndentedString(color)).append("\n");
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.JSON_PROPERTY_VALUES
|
||||
})
|
||||
@JsonTypeName("test_query_style_form_explode_true_array_string_query_object_parameter")
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0-SNAPSHOT")
|
||||
public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
|
||||
public static final String JSON_PROPERTY_VALUES = "values";
|
||||
private List<String> values = new ArrayList<>();
|
||||
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
|
||||
}
|
||||
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter values(List<String> values) {
|
||||
|
||||
this.values = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter addValuesItem(String valuesItem) {
|
||||
if (this.values == null) {
|
||||
this.values = new ArrayList<>();
|
||||
}
|
||||
this.values.add(valuesItem);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values
|
||||
* @return values
|
||||
**/
|
||||
@jakarta.annotation.Nullable
|
||||
@JsonProperty(JSON_PROPERTY_VALUES)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public List<String> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_VALUES)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setValues(List<String> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = (TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) o;
|
||||
return Objects.equals(this.values, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {\n");
|
||||
sb.append(" values: ").append(toIndentedString(values)).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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* API tests for AuthApi
|
||||
*/
|
||||
public class AuthApiTest {
|
||||
|
||||
private final AuthApi api = new AuthApi();
|
||||
|
||||
/**
|
||||
* To test HTTP basic authentication
|
||||
*
|
||||
* <p>To test HTTP basic authentication
|
||||
*/
|
||||
@Test
|
||||
public void testAuthHttpBasicTest() {
|
||||
// given
|
||||
api.getApiClient().setUsername("test_user");
|
||||
api.getApiClient().setPassword("test_password");
|
||||
|
||||
// when
|
||||
String response = api.testAuthHttpBasic();
|
||||
|
||||
assertThat(
|
||||
response,
|
||||
containsString("Authorization: Basic dGVzdF91c2VyOnRlc3RfcGFzc3dvcmQ="));
|
||||
}
|
||||
|
||||
/**
|
||||
* To test HTTP bearer authentication
|
||||
*
|
||||
* <p>To test HTTP bearer authentication
|
||||
*/
|
||||
@Test
|
||||
public void testAuthHttpBearerTest() {
|
||||
// given
|
||||
api.getApiClient().setBearerToken("test_token");
|
||||
|
||||
// when
|
||||
String response = api.testAuthHttpBearer();
|
||||
|
||||
assertThat(response, containsString("Authorization: Bearer test_token"));
|
||||
}
|
||||
}
|
@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.GifHttpMessageConverter;
|
||||
import org.openapitools.client.OctetStreamHttpMessageConverter;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.client.model.Tag;
|
||||
|
||||
/** API tests for BodyApi */
|
||||
public class BodyApiTest {
|
||||
|
||||
private final BodyApi api = new BodyApi();
|
||||
|
||||
/**
|
||||
* Test binary (gif) response body
|
||||
*
|
||||
* <p>Test binary (gif) response body
|
||||
*/
|
||||
@Test
|
||||
public void testBinaryGifTest() throws IOException {
|
||||
// given
|
||||
var restClient =
|
||||
ApiClient.buildRestClientBuilder()
|
||||
.messageConverters(converters -> converters.add(new GifHttpMessageConverter()))
|
||||
.build();
|
||||
api.setApiClient(new ApiClient(restClient));
|
||||
|
||||
// when
|
||||
File response = api.testBinaryGif();
|
||||
|
||||
// then
|
||||
assertThat(response, notNullValue());
|
||||
assertThat(response.exists(), is(true));
|
||||
assertThat(Files.probeContentType(response.toPath()), is("image/gif"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* <p>Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testBodyApplicationOctetstreamBinaryTest() throws IOException {
|
||||
// given
|
||||
var restClient =
|
||||
ApiClient.buildRestClientBuilder()
|
||||
.messageConverters(converters -> converters.add(new OctetStreamHttpMessageConverter()))
|
||||
.build();
|
||||
api.setApiClient(new ApiClient(restClient));
|
||||
|
||||
var tempFile = Files.createTempFile("test", ".txt");
|
||||
Files.writeString(tempFile, "test123");
|
||||
|
||||
File body = tempFile.toFile();
|
||||
|
||||
// when
|
||||
String response = api.testBodyApplicationOctetstreamBinary(body);
|
||||
|
||||
// then
|
||||
assertThat(response, containsString("Content-Type: application/octet-stream"));
|
||||
assertThat(response, containsString("test123"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test array of binary in multipart mime
|
||||
*
|
||||
* <p>Test array of binary in multipart mime
|
||||
*/
|
||||
@Test
|
||||
public void testBodyMultipartFormdataArrayOfBinaryTest() throws IOException {
|
||||
// given
|
||||
var firstFile = Files.createTempFile("test", ".txt");
|
||||
String firstFileContent = "Thanks for using OpenAPI generator :)";
|
||||
Files.writeString(firstFile, firstFileContent);
|
||||
|
||||
var secondFile = Files.createTempFile("test2", ".txt");
|
||||
String secondFileContent = "Your ad could be here";
|
||||
Files.writeString(secondFile, secondFileContent);
|
||||
|
||||
List<File> files = List.of(firstFile.toFile(), secondFile.toFile());
|
||||
|
||||
// when
|
||||
String response = api.testBodyMultipartFormdataArrayOfBinary(files);
|
||||
|
||||
// then
|
||||
assertThat(response, containsString("Content-Type: multipart/form-data"));
|
||||
assertThat(response, containsString(firstFileContent));
|
||||
assertThat(response, containsString(secondFileContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test single binary in multipart mime
|
||||
*
|
||||
* <p>Test single binary in multipart mime
|
||||
*/
|
||||
@Test
|
||||
public void testBodyMultipartFormdataSingleBinaryTest() {
|
||||
File myFile = null;
|
||||
String response = api.testBodyMultipartFormdataSingleBinary(myFile);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* <p>Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyAllOfPetTest() {
|
||||
Pet pet = null;
|
||||
Pet response = api.testEchoBodyAllOfPet(pet);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test free form object
|
||||
*
|
||||
* <p>Test free form object
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyFreeFormObjectResponseStringTest() {
|
||||
Object body = null;
|
||||
String response = api.testEchoBodyFreeFormObjectResponseString(body);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* <p>Test body parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetTest() {
|
||||
Pet pet = null;
|
||||
Pet response = api.testEchoBodyPet(pet);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
*
|
||||
* <p>Test empty response body
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetResponseStringTest() {
|
||||
Pet pet = null;
|
||||
String response = api.testEchoBodyPetResponseString(pet);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
*
|
||||
* <p>Test string enum response body
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyStringEnumTest() {
|
||||
String body = null;
|
||||
StringEnumRef response = api.testEchoBodyStringEnum(body);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
*
|
||||
* <p>Test empty json (request body)
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyTagResponseStringTest() {
|
||||
Tag tag = null;
|
||||
String response = api.testEchoBodyTagResponseString(tag);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.model.TestFormObjectMultipartRequestMarker;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API tests for FormApi
|
||||
*/
|
||||
@Ignore
|
||||
public class FormApiTest {
|
||||
|
||||
private final FormApi api = new FormApi();
|
||||
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
*
|
||||
* Test form parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testFormIntegerBooleanStringTest() {
|
||||
Integer integerForm = null;
|
||||
Boolean booleanForm = null;
|
||||
String stringForm = null;
|
||||
String response = api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for multipart schema
|
||||
*
|
||||
* Test form parameter(s) for multipart schema
|
||||
*/
|
||||
@Test
|
||||
public void testFormObjectMultipartTest() {
|
||||
TestFormObjectMultipartRequestMarker marker = null;
|
||||
String response = api.testFormObjectMultipart(marker);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test form parameter(s) for oneOf schema
|
||||
*
|
||||
* Test form parameter(s) for oneOf schema
|
||||
*/
|
||||
@Test
|
||||
public void testFormOneofTest() {
|
||||
String form1 = null;
|
||||
Integer form2 = null;
|
||||
String form3 = null;
|
||||
Boolean form4 = null;
|
||||
Long id = null;
|
||||
String name = null;
|
||||
String response = api.testFormOneof(form1, form2, form3, form4, id, name);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.model.StringEnumRef;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API tests for HeaderApi
|
||||
*/
|
||||
@Ignore
|
||||
public class HeaderApiTest {
|
||||
|
||||
private final HeaderApi api = new HeaderApi();
|
||||
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
*
|
||||
* Test header parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testHeaderIntegerBooleanStringEnumsTest() {
|
||||
Integer integerHeader = null;
|
||||
Boolean booleanHeader = null;
|
||||
String stringHeader = null;
|
||||
String enumNonrefStringHeader = null;
|
||||
StringEnumRef enumRefStringHeader = null;
|
||||
String response = api.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.model.StringEnumRef;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API tests for PathApi
|
||||
*/
|
||||
@Ignore
|
||||
public class PathApiTest {
|
||||
|
||||
private final PathApi api = new PathApi();
|
||||
|
||||
|
||||
/**
|
||||
* Test path parameter(s)
|
||||
*
|
||||
* Test path parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathTest() {
|
||||
String pathString = null;
|
||||
Integer pathInteger = null;
|
||||
String enumNonrefStringPath = null;
|
||||
StringEnumRef enumRefStringPath = null;
|
||||
String response = api.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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.model.DataQuery;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Instant;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.client.model.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter;
|
||||
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* API tests for QueryApi
|
||||
*/
|
||||
@Ignore
|
||||
public class QueryApiTest {
|
||||
|
||||
private final QueryApi api = new QueryApi();
|
||||
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testEnumRefStringTest() {
|
||||
String enumNonrefStringQuery = null;
|
||||
StringEnumRef enumRefStringQuery = null;
|
||||
String response = api.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryDatetimeDateStringTest() {
|
||||
Instant datetimeQuery = null;
|
||||
LocalDate dateQuery = null;
|
||||
String stringQuery = null;
|
||||
String response = api.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryIntegerBooleanStringTest() {
|
||||
Integer integerQuery = null;
|
||||
Boolean booleanQuery = null;
|
||||
String stringQuery = null;
|
||||
String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleDeepObjectExplodeTrueObjectTest() {
|
||||
Pet queryObject = null;
|
||||
String response = api.testQueryStyleDeepObjectExplodeTrueObject(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleDeepObjectExplodeTrueObjectAllOfTest() {
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject = null;
|
||||
String response = api.testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeFalseArrayIntegerTest() {
|
||||
List<Integer> queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeFalseArrayInteger(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeFalseArrayStringTest() {
|
||||
List<String> queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeFalseArrayString(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeTrueArrayStringTest() {
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeTrueArrayString(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeTrueObjectTest() {
|
||||
Pet queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*/
|
||||
@Test
|
||||
public void testQueryStyleFormExplodeTrueObjectAllOfTest() {
|
||||
DataQuery queryObject = null;
|
||||
String response = api.testQueryStyleFormExplodeTrueObjectAllOf(queryObject);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Model tests for Bird
|
||||
*/
|
||||
class BirdTest {
|
||||
private final Bird model = new Bird();
|
||||
|
||||
/**
|
||||
* Model tests for Bird
|
||||
*/
|
||||
@Test
|
||||
void testBird() {
|
||||
// TODO: test Bird
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'size'
|
||||
*/
|
||||
@Test
|
||||
void sizeTest() {
|
||||
// TODO: test size
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'color'
|
||||
*/
|
||||
@Test
|
||||
void colorTest() {
|
||||
// TODO: test color
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Model tests for Category
|
||||
*/
|
||||
class CategoryTest {
|
||||
private final Category model = new Category();
|
||||
|
||||
/**
|
||||
* Model tests for Category
|
||||
*/
|
||||
@Test
|
||||
void testCategory() {
|
||||
// TODO: test Category
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'id'
|
||||
*/
|
||||
@Test
|
||||
void idTest() {
|
||||
// TODO: test id
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'name'
|
||||
*/
|
||||
@Test
|
||||
void nameTest() {
|
||||
// TODO: test name
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.Query;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Model tests for DataQuery
|
||||
*/
|
||||
class DataQueryTest {
|
||||
private final DataQuery model = new DataQuery();
|
||||
|
||||
/**
|
||||
* Model tests for DataQuery
|
||||
*/
|
||||
@Test
|
||||
void testDataQuery() {
|
||||
// TODO: test DataQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'id'
|
||||
*/
|
||||
@Test
|
||||
void idTest() {
|
||||
// TODO: test id
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'outcomes'
|
||||
*/
|
||||
@Test
|
||||
void outcomesTest() {
|
||||
// TODO: test outcomes
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'suffix'
|
||||
*/
|
||||
@Test
|
||||
void suffixTest() {
|
||||
// TODO: test suffix
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'text'
|
||||
*/
|
||||
@Test
|
||||
void textTest() {
|
||||
// TODO: test text
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'date'
|
||||
*/
|
||||
@Test
|
||||
void dateTest() {
|
||||
// TODO: test date
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
import java.util.NoSuchElementException;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Model tests for DefaultValue
|
||||
*/
|
||||
class DefaultValueTest {
|
||||
private final DefaultValue model = new DefaultValue();
|
||||
|
||||
/**
|
||||
* Model tests for DefaultValue
|
||||
*/
|
||||
@Test
|
||||
void testDefaultValue() {
|
||||
// TODO: test DefaultValue
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayStringEnumRefDefault'
|
||||
*/
|
||||
@Test
|
||||
void arrayStringEnumRefDefaultTest() {
|
||||
// TODO: test arrayStringEnumRefDefault
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayStringEnumDefault'
|
||||
*/
|
||||
@Test
|
||||
void arrayStringEnumDefaultTest() {
|
||||
// TODO: test arrayStringEnumDefault
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayStringDefault'
|
||||
*/
|
||||
@Test
|
||||
void arrayStringDefaultTest() {
|
||||
// TODO: test arrayStringDefault
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayIntegerDefault'
|
||||
*/
|
||||
@Test
|
||||
void arrayIntegerDefaultTest() {
|
||||
// TODO: test arrayIntegerDefault
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayString'
|
||||
*/
|
||||
@Test
|
||||
void arrayStringTest() {
|
||||
// TODO: test arrayString
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayStringNullable'
|
||||
*/
|
||||
@Test
|
||||
void arrayStringNullableTest() {
|
||||
// TODO: test arrayStringNullable
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayStringExtensionNullable'
|
||||
*/
|
||||
@Test
|
||||
void arrayStringExtensionNullableTest() {
|
||||
// TODO: test arrayStringExtensionNullable
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'stringNullable'
|
||||
*/
|
||||
@Test
|
||||
void stringNullableTest() {
|
||||
// TODO: test stringNullable
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* 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 com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.math.BigDecimal;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Model tests for NumberPropertiesOnly
|
||||
*/
|
||||
class NumberPropertiesOnlyTest {
|
||||
private final NumberPropertiesOnly model = new NumberPropertiesOnly();
|
||||
|
||||
/**
|
||||
* Model tests for NumberPropertiesOnly
|
||||
*/
|
||||
@Test
|
||||
void testNumberPropertiesOnly() {
|
||||
// TODO: test NumberPropertiesOnly
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'number'
|
||||
*/
|
||||
@Test
|
||||
void numberTest() {
|
||||
// TODO: test number
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property '_float'
|
||||
*/
|
||||
@Test
|
||||
void _floatTest() {
|
||||
// TODO: test _float
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property '_double'
|
||||
*/
|
||||
@Test
|
||||
void _doubleTest() {
|
||||
// TODO: test _double
|
||||
}
|
||||
|
||||
}
|
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