diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiClient.java
index 7229635a0fd1..caaaa6534cd4 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiClient.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiClient.java
@@ -3,7 +3,7 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -12,13 +12,13 @@
package org.openapitools.client;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import org.openapitools.jackson.nullable.JsonNullableModule;
-
import java.io.InputStream;
import java.net.URI;
import java.net.URLEncoder;
@@ -35,422 +35,411 @@ import java.util.List;
import java.util.StringJoiner;
import java.util.function.Consumer;
import java.util.stream.Collectors;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
+import org.openapitools.jackson.nullable.JsonNullableModule;
/**
* Configuration and utility class for API clients.
*
- *
This class can be constructed and modified, then used to instantiate the
- * various API classes. The API classes use the settings in this class to
- * configure themselves, but otherwise do not store a link to this class.
+ * This class can be constructed and modified, then used to instantiate the various API classes.
+ * The API classes use the settings in this class to configure themselves, but otherwise do not
+ * store a link to this class.
*
- *
This class is mutable and not synchronized, so it is not thread-safe.
- * The API classes generated from this are immutable and thread-safe.
+ * This class is mutable and not synchronized, so it is not thread-safe. The API classes
+ * generated from this are immutable and thread-safe.
*
- *
The setter methods of this class return the current object to facilitate
- * a fluent style of configuration.
+ * The setter methods of this class return the current object to facilitate a fluent style of
+ * configuration.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiClient {
- private HttpClient.Builder builder;
- private ObjectMapper mapper;
- private String scheme;
- private String host;
- private int port;
- private String basePath;
- private Consumer interceptor;
- private Consumer> responseInterceptor;
- private Consumer> asyncResponseInterceptor;
- private Duration readTimeout;
- private Duration connectTimeout;
+ private HttpClient.Builder builder;
+ private ObjectMapper mapper;
+ private String scheme;
+ private String host;
+ private int port;
+ private String basePath;
+ private Consumer interceptor;
+ private Consumer> responseInterceptor;
+ private Consumer> asyncResponseInterceptor;
+ private Duration readTimeout;
+ private Duration connectTimeout;
- private static String valueToString(Object value) {
- if (value == null) {
- return "";
- }
- if (value instanceof OffsetDateTime) {
- return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
- }
- return value.toString();
- }
-
- /**
- * URL encode a string in the UTF-8 encoding.
- *
- * @param s String to encode.
- * @return URL-encoded representation of the input string.
- */
- public static String urlEncode(String s) {
- return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20");
- }
-
- /**
- * Convert a URL query name/value parameter to a list of encoded {@link Pair}
- * objects.
- *
- * The value can be null, in which case an empty list is returned.
- *
- * @param name The query name parameter.
- * @param value The query value, which may not be a collection but may be
- * null.
- * @return A singleton list of the {@link Pair} objects representing the input
- * parameters, which is encoded for use in a URL. If the value is null, an
- * empty list is returned.
- */
- public static List parameterToPairs(String name, Object value) {
- if (name == null || name.isEmpty() || value == null) {
- return Collections.emptyList();
- }
- return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value))));
- }
-
- /**
- * Convert a URL query name/collection parameter to a list of encoded
- * {@link Pair} objects.
- *
- * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc).
- * @param name The query name parameter.
- * @param values A collection of values for the given query name, which may be
- * null.
- * @return A list of {@link Pair} objects representing the input parameters,
- * which is encoded for use in a URL. If the values collection is null, an
- * empty list is returned.
- */
- public static List parameterToPairs(
- String collectionFormat, String name, Collection> values) {
- if (name == null || name.isEmpty() || values == null || values.isEmpty()) {
- return Collections.emptyList();
+ private static String valueToString(Object value) {
+ if (value == null) {
+ return "";
+ }
+ if (value instanceof OffsetDateTime) {
+ return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
+ }
+ return value.toString();
}
- // get the collection format (default: csv)
- String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat;
-
- // create the params based on the collection format
- if ("multi".equals(format)) {
- return values.stream()
- .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value))))
- .collect(Collectors.toList());
+ /**
+ * URL encode a string in the UTF-8 encoding.
+ *
+ * @param s String to encode.
+ * @return URL-encoded representation of the input string.
+ */
+ public static String urlEncode(String s) {
+ return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20");
}
- String delimiter;
- switch(format) {
- case "csv":
- delimiter = urlEncode(",");
- break;
- case "ssv":
- delimiter = urlEncode(" ");
- break;
- case "tsv":
- delimiter = urlEncode("\t");
- break;
- case "pipes":
- delimiter = urlEncode("|");
- break;
- default:
- throw new IllegalArgumentException("Illegal collection format: " + collectionFormat);
+ /**
+ * Convert a URL query name/value parameter to a list of encoded {@link Pair} objects.
+ *
+ * The value can be null, in which case an empty list is returned.
+ *
+ * @param name The query name parameter.
+ * @param value The query value, which may not be a collection but may be null.
+ * @return A singleton list of the {@link Pair} objects representing the input parameters, which
+ * is encoded for use in a URL. If the value is null, an empty list is returned.
+ */
+ public static List parameterToPairs(String name, Object value) {
+ if (name == null || name.isEmpty() || value == null) {
+ return Collections.emptyList();
+ }
+ return Collections.singletonList(
+ new Pair(urlEncode(name), urlEncode(valueToString(value))));
}
- StringJoiner joiner = new StringJoiner(delimiter);
- for (Object value : values) {
- joiner.add(urlEncode(valueToString(value)));
+ /**
+ * Convert a URL query name/collection parameter to a list of encoded {@link Pair} objects.
+ *
+ * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc).
+ * @param name The query name parameter.
+ * @param values A collection of values for the given query name, which may be null.
+ * @return A list of {@link Pair} objects representing the input parameters, which is encoded
+ * for use in a URL. If the values collection is null, an empty list is returned.
+ */
+ public static List parameterToPairs(
+ String collectionFormat, String name, Collection> values) {
+ if (name == null || name.isEmpty() || values == null || values.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ // get the collection format (default: csv)
+ String format =
+ collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat;
+
+ // create the params based on the collection format
+ if ("multi".equals(format)) {
+ return values.stream()
+ .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value))))
+ .collect(Collectors.toList());
+ }
+
+ String delimiter;
+ switch (format) {
+ case "csv":
+ delimiter = urlEncode(",");
+ break;
+ case "ssv":
+ delimiter = urlEncode(" ");
+ break;
+ case "tsv":
+ delimiter = urlEncode("\t");
+ break;
+ case "pipes":
+ delimiter = urlEncode("|");
+ break;
+ default:
+ throw new IllegalArgumentException(
+ "Illegal collection format: " + collectionFormat);
+ }
+
+ StringJoiner joiner = new StringJoiner(delimiter);
+ for (Object value : values) {
+ joiner.add(urlEncode(valueToString(value)));
+ }
+
+ return Collections.singletonList(new Pair(urlEncode(name), joiner.toString()));
}
- return Collections.singletonList(new Pair(urlEncode(name), joiner.toString()));
- }
+ /** Create an instance of ApiClient. */
+ public ApiClient() {
+ this.builder = createDefaultHttpClientBuilder();
+ this.mapper = createDefaultObjectMapper();
+ updateBaseUri(getDefaultBaseUri());
+ interceptor = null;
+ readTimeout = null;
+ connectTimeout = null;
+ responseInterceptor = null;
+ asyncResponseInterceptor = null;
+ }
- /**
- * Create an instance of ApiClient.
- */
- public ApiClient() {
- this.builder = createDefaultHttpClientBuilder();
- this.mapper = createDefaultObjectMapper();
- updateBaseUri(getDefaultBaseUri());
- interceptor = null;
- readTimeout = null;
- connectTimeout = null;
- responseInterceptor = null;
- asyncResponseInterceptor = null;
- }
+ /**
+ * Create an instance of ApiClient.
+ *
+ * @param builder Http client builder.
+ * @param mapper Object mapper.
+ * @param baseUri Base URI
+ */
+ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) {
+ this.builder = builder;
+ this.mapper = mapper;
+ updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
+ interceptor = null;
+ readTimeout = null;
+ connectTimeout = null;
+ responseInterceptor = null;
+ asyncResponseInterceptor = null;
+ }
- /**
- * Create an instance of ApiClient.
- *
- * @param builder Http client builder.
- * @param mapper Object mapper.
- * @param baseUri Base URI
- */
- public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) {
- this.builder = builder;
- this.mapper = mapper;
- updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
- interceptor = null;
- readTimeout = null;
- connectTimeout = null;
- responseInterceptor = null;
- asyncResponseInterceptor = null;
- }
+ protected ObjectMapper createDefaultObjectMapper() {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
+ mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
+ mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
+ mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE);
+ mapper.registerModule(new JavaTimeModule());
+ mapper.registerModule(new JsonNullableModule());
+ return mapper;
+ }
- protected ObjectMapper createDefaultObjectMapper() {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
- mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
- mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
- mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
- mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE);
- mapper.registerModule(new JavaTimeModule());
- mapper.registerModule(new JsonNullableModule());
- return mapper;
- }
+ protected String getDefaultBaseUri() {
+ return "http://petstore.swagger.io:80/v2";
+ }
- protected String getDefaultBaseUri() {
- return "http://petstore.swagger.io:80/v2";
- }
+ protected HttpClient.Builder createDefaultHttpClientBuilder() {
+ return HttpClient.newBuilder();
+ }
- protected HttpClient.Builder createDefaultHttpClientBuilder() {
- return HttpClient.newBuilder();
- }
+ public void updateBaseUri(String baseUri) {
+ URI uri = URI.create(baseUri);
+ scheme = uri.getScheme();
+ host = uri.getHost();
+ port = uri.getPort();
+ basePath = uri.getRawPath();
+ }
- public void updateBaseUri(String baseUri) {
- URI uri = URI.create(baseUri);
- scheme = uri.getScheme();
- host = uri.getHost();
- port = uri.getPort();
- basePath = uri.getRawPath();
- }
+ /**
+ * Set a custom {@link HttpClient.Builder} object to use when creating the {@link HttpClient}
+ * that is used by the API client.
+ *
+ * @param builder Custom client builder.
+ * @return This object.
+ */
+ public ApiClient setHttpClientBuilder(HttpClient.Builder builder) {
+ this.builder = builder;
+ return this;
+ }
- /**
- * Set a custom {@link HttpClient.Builder} object to use when creating the
- * {@link HttpClient} that is used by the API client.
- *
- * @param builder Custom client builder.
- * @return This object.
- */
- public ApiClient setHttpClientBuilder(HttpClient.Builder builder) {
- this.builder = builder;
- return this;
- }
+ /**
+ * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}.
+ *
+ * The returned object is immutable and thread-safe.
+ *
+ * @return The HTTP client.
+ */
+ public HttpClient getHttpClient() {
+ return builder.build();
+ }
- /**
- * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}.
- *
- *
The returned object is immutable and thread-safe.
- *
- * @return The HTTP client.
- */
- public HttpClient getHttpClient() {
- return builder.build();
- }
+ /**
+ * Set a custom {@link ObjectMapper} to serialize and deserialize the request and response
+ * bodies.
+ *
+ * @param mapper Custom object mapper.
+ * @return This object.
+ */
+ public ApiClient setObjectMapper(ObjectMapper mapper) {
+ this.mapper = mapper;
+ return this;
+ }
- /**
- * Set a custom {@link ObjectMapper} to serialize and deserialize the request
- * and response bodies.
- *
- * @param mapper Custom object mapper.
- * @return This object.
- */
- public ApiClient setObjectMapper(ObjectMapper mapper) {
- this.mapper = mapper;
- return this;
- }
+ /**
+ * Get a copy of the current {@link ObjectMapper}.
+ *
+ * @return A copy of the current object mapper.
+ */
+ public ObjectMapper getObjectMapper() {
+ return mapper.copy();
+ }
- /**
- * Get a copy of the current {@link ObjectMapper}.
- *
- * @return A copy of the current object mapper.
- */
- public ObjectMapper getObjectMapper() {
- return mapper.copy();
- }
+ /**
+ * Set a custom host name for the target service.
+ *
+ * @param host The host name of the target service.
+ * @return This object.
+ */
+ public ApiClient setHost(String host) {
+ this.host = host;
+ return this;
+ }
- /**
- * Set a custom host name for the target service.
- *
- * @param host The host name of the target service.
- * @return This object.
- */
- public ApiClient setHost(String host) {
- this.host = host;
- return this;
- }
+ /**
+ * Set a custom port number for the target service.
+ *
+ * @param port The port of the target service. Set this to -1 to reset the value to the default
+ * for the scheme.
+ * @return This object.
+ */
+ public ApiClient setPort(int port) {
+ this.port = port;
+ return this;
+ }
- /**
- * Set a custom port number for the target service.
- *
- * @param port The port of the target service. Set this to -1 to reset the
- * value to the default for the scheme.
- * @return This object.
- */
- public ApiClient setPort(int port) {
- this.port = port;
- return this;
- }
+ /**
+ * Set a custom base path for the target service, for example '/v2'.
+ *
+ * @param basePath The base path against which the rest of the path is resolved.
+ * @return This object.
+ */
+ public ApiClient setBasePath(String basePath) {
+ this.basePath = basePath;
+ return this;
+ }
- /**
- * Set a custom base path for the target service, for example '/v2'.
- *
- * @param basePath The base path against which the rest of the path is
- * resolved.
- * @return This object.
- */
- public ApiClient setBasePath(String basePath) {
- this.basePath = basePath;
- return this;
- }
+ /**
+ * Get the base URI to resolve the endpoint paths against.
+ *
+ * @return The complete base URI that the rest of the API parameters are resolved against.
+ */
+ public String getBaseUri() {
+ return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath;
+ }
- /**
- * Get the base URI to resolve the endpoint paths against.
- *
- * @return The complete base URI that the rest of the API parameters are
- * resolved against.
- */
- public String getBaseUri() {
- return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath;
- }
+ /**
+ * Set a custom scheme for the target service, for example 'https'.
+ *
+ * @param scheme The scheme of the target service
+ * @return This object.
+ */
+ public ApiClient setScheme(String scheme) {
+ this.scheme = scheme;
+ return this;
+ }
- /**
- * Set a custom scheme for the target service, for example 'https'.
- *
- * @param scheme The scheme of the target service
- * @return This object.
- */
- public ApiClient setScheme(String scheme){
- this.scheme = scheme;
- return this;
- }
+ /**
+ * Set a custom request interceptor.
+ *
+ * A request interceptor is a mechanism for altering each request before it is sent. After
+ * the request has been fully configured but not yet built, the request builder is passed into
+ * this function for further modification, after which it is sent out.
+ *
+ *
This is useful for altering the requests in a custom manner, such as adding headers. It
+ * could also be used for logging and monitoring.
+ *
+ * @param interceptor A function invoked before creating each request. A value of null resets
+ * the interceptor to a no-op.
+ * @return This object.
+ */
+ public ApiClient setRequestInterceptor(Consumer interceptor) {
+ this.interceptor = interceptor;
+ return this;
+ }
- /**
- * Set a custom request interceptor.
- *
- * A request interceptor is a mechanism for altering each request before it
- * is sent. After the request has been fully configured but not yet built, the
- * request builder is passed into this function for further modification,
- * after which it is sent out.
- *
- * This is useful for altering the requests in a custom manner, such as
- * adding headers. It could also be used for logging and monitoring.
- *
- * @param interceptor A function invoked before creating each request. A value
- * of null resets the interceptor to a no-op.
- * @return This object.
- */
- public ApiClient setRequestInterceptor(Consumer interceptor) {
- this.interceptor = interceptor;
- return this;
- }
+ /**
+ * Get the custom interceptor.
+ *
+ * @return The custom interceptor that was set, or null if there isn't any.
+ */
+ public Consumer getRequestInterceptor() {
+ return interceptor;
+ }
- /**
- * Get the custom interceptor.
- *
- * @return The custom interceptor that was set, or null if there isn't any.
- */
- public Consumer getRequestInterceptor() {
- return interceptor;
- }
+ /**
+ * Set a custom response interceptor.
+ *
+ * This is useful for logging, monitoring or extraction of header variables
+ *
+ * @param interceptor A function invoked before creating each request. A value of null resets
+ * the interceptor to a no-op.
+ * @return This object.
+ */
+ public ApiClient setResponseInterceptor(Consumer> interceptor) {
+ this.responseInterceptor = interceptor;
+ return this;
+ }
- /**
- * Set a custom response interceptor.
- *
- * This is useful for logging, monitoring or extraction of header variables
- *
- * @param interceptor A function invoked before creating each request. A value
- * of null resets the interceptor to a no-op.
- * @return This object.
- */
- public ApiClient setResponseInterceptor(Consumer> interceptor) {
- this.responseInterceptor = interceptor;
- return this;
- }
+ /**
+ * Get the custom response interceptor.
+ *
+ * @return The custom interceptor that was set, or null if there isn't any.
+ */
+ public Consumer> getResponseInterceptor() {
+ return responseInterceptor;
+ }
- /**
- * Get the custom response interceptor.
- *
- * @return The custom interceptor that was set, or null if there isn't any.
- */
- public Consumer> getResponseInterceptor() {
- return responseInterceptor;
- }
+ /**
+ * Set a custom async response interceptor. Use this interceptor when asyncNative is set to
+ * 'true'.
+ *
+ * This is useful for logging, monitoring or extraction of header variables
+ *
+ * @param interceptor A function invoked before creating each request. A value of null resets
+ * the interceptor to a no-op.
+ * @return This object.
+ */
+ public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) {
+ this.asyncResponseInterceptor = interceptor;
+ return this;
+ }
- /**
- * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'.
- *
- * This is useful for logging, monitoring or extraction of header variables
- *
- * @param interceptor A function invoked before creating each request. A value
- * of null resets the interceptor to a no-op.
- * @return This object.
- */
- public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) {
- this.asyncResponseInterceptor = interceptor;
- return this;
- }
+ /**
+ * Get the custom async response interceptor. Use this interceptor when asyncNative is set to
+ * 'true'.
+ *
+ * @return The custom interceptor that was set, or null if there isn't any.
+ */
+ public Consumer> getAsyncResponseInterceptor() {
+ return asyncResponseInterceptor;
+ }
- /**
- * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'.
- *
- * @return The custom interceptor that was set, or null if there isn't any.
- */
- public Consumer> getAsyncResponseInterceptor() {
- return asyncResponseInterceptor;
- }
+ /**
+ * Set the read timeout for the http client.
+ *
+ * This is the value used by default for each request, though it can be overridden on a
+ * per-request basis with a request interceptor.
+ *
+ * @param readTimeout The read timeout used by default by the http client. Setting this value to
+ * null resets the timeout to an effectively infinite value.
+ * @return This object.
+ */
+ public ApiClient setReadTimeout(Duration readTimeout) {
+ this.readTimeout = readTimeout;
+ return this;
+ }
- /**
- * Set the read timeout for the http client.
- *
- *
This is the value used by default for each request, though it can be
- * overridden on a per-request basis with a request interceptor.
- *
- * @param readTimeout The read timeout used by default by the http client.
- * Setting this value to null resets the timeout to an
- * effectively infinite value.
- * @return This object.
- */
- public ApiClient setReadTimeout(Duration readTimeout) {
- this.readTimeout = readTimeout;
- return this;
- }
+ /**
+ * Get the read timeout that was set.
+ *
+ * @return The read timeout, or null if no timeout was set. Null represents an infinite wait
+ * time.
+ */
+ public Duration getReadTimeout() {
+ return readTimeout;
+ }
+ /**
+ * Sets the connect timeout (in milliseconds) for the http client.
+ *
+ * In the case where a new connection needs to be established, if the connection cannot be
+ * established within the given {@code duration}, then {@link
+ * HttpClient#send(HttpRequest,BodyHandler) HttpClient::send} throws an {@link
+ * HttpConnectTimeoutException}, or {@link HttpClient#sendAsync(HttpRequest,BodyHandler)
+ * HttpClient::sendAsync} completes exceptionally with an {@code HttpConnectTimeoutException}.
+ * If a new connection does not need to be established, for example if a connection can be
+ * reused from a previous request, then this timeout duration has no effect.
+ *
+ * @param connectTimeout connection timeout in milliseconds
+ * @return This object.
+ */
+ public ApiClient setConnectTimeout(Duration connectTimeout) {
+ this.connectTimeout = connectTimeout;
+ this.builder.connectTimeout(connectTimeout);
+ return this;
+ }
- /**
- * Get the read timeout that was set.
- *
- * @return The read timeout, or null if no timeout was set. Null represents
- * an infinite wait time.
- */
- public Duration getReadTimeout() {
- return readTimeout;
- }
- /**
- * Sets the connect timeout (in milliseconds) for the http client.
- *
- *
In the case where a new connection needs to be established, if
- * the connection cannot be established within the given {@code
- * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler)
- * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or
- * {@link HttpClient#sendAsync(HttpRequest,BodyHandler)
- * HttpClient::sendAsync} completes exceptionally with an
- * {@code HttpConnectTimeoutException}. If a new connection does not
- * need to be established, for example if a connection can be reused
- * from a previous request, then this timeout duration has no effect.
- *
- * @param connectTimeout connection timeout in milliseconds
- *
- * @return This object.
- */
- public ApiClient setConnectTimeout(Duration connectTimeout) {
- this.connectTimeout = connectTimeout;
- this.builder.connectTimeout(connectTimeout);
- return this;
- }
-
- /**
- * Get connection timeout (in milliseconds).
- *
- * @return Timeout in milliseconds
- */
- public Duration getConnectTimeout() {
- return connectTimeout;
- }
+ /**
+ * Get connection timeout (in milliseconds).
+ *
+ * @return Timeout in milliseconds
+ */
+ public Duration getConnectTimeout() {
+ return connectTimeout;
+ }
}
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiException.java
index 068ba4081360..cfaed4663ebc 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiException.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiException.java
@@ -3,16 +3,16 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package org.openapitools.client;
+
import java.net.http.HttpHeaders;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@@ -31,18 +31,25 @@ public class ApiException extends Exception {
super(message);
}
- public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) {
+ public ApiException(
+ String message,
+ Throwable throwable,
+ int code,
+ HttpHeaders responseHeaders,
+ String responseBody) {
super(message, throwable);
this.code = code;
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
- public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) {
+ public ApiException(
+ String message, int code, HttpHeaders responseHeaders, String responseBody) {
this(message, (Throwable) null, code, responseHeaders, responseBody);
}
- public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) {
+ public ApiException(
+ String message, Throwable throwable, int code, HttpHeaders responseHeaders) {
this(message, throwable, code, responseHeaders, null);
}
@@ -55,7 +62,8 @@ public class ApiException extends Exception {
this.code = code;
}
- public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) {
+ public ApiException(
+ int code, String message, HttpHeaders responseHeaders, String responseBody) {
this(code, message);
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiResponse.java
index 9bb5cac17b41..6722a2be7c70 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiResponse.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ApiResponse.java
@@ -3,16 +3,16 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package org.openapitools.client;
+
import java.util.List;
import java.util.Map;
@@ -22,9 +22,9 @@ import java.util.Map;
* @param The type of data that is deserialized from response body
*/
public class ApiResponse {
- final private int statusCode;
- final private Map> headers;
- final private T data;
+ private final int statusCode;
+ private final Map> headers;
+ private final T data;
/**
* @param statusCode The status code of HTTP response
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Configuration.java
index 476456fd4ed6..451ce97dc86a 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Configuration.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Configuration.java
@@ -3,14 +3,13 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package org.openapitools.client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@@ -18,8 +17,8 @@ public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();
/**
- * Get the default API client, which would be used when creating API
- * instances without providing an API client.
+ * Get the default API client, which would be used when creating API instances without providing
+ * an API client.
*
* @return Default API client
*/
@@ -28,8 +27,8 @@ public class Configuration {
}
/**
- * Set the default API client, which would be used when creating API
- * instances without providing an API client.
+ * Set the default API client, which would be used when creating API instances without providing
+ * an API client.
*
* @param apiClient API client
*/
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java
index 1ce1e47b4fb6..f8605e7350fd 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/JSON.java
@@ -1,248 +1,245 @@
package org.openapitools.client;
+
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
-import org.openapitools.jackson.nullable.JsonNullableModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import org.openapitools.client.model.*;
-
import java.text.DateFormat;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.openapitools.client.model.*;
+import org.openapitools.jackson.nullable.JsonNullableModule;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class JSON {
- private ObjectMapper mapper;
+ private ObjectMapper mapper;
- public JSON() {
- mapper = new ObjectMapper();
- mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
- mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
- mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
- mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
- mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
- mapper.setDateFormat(new RFC3339DateFormat());
- mapper.registerModule(new JavaTimeModule());
- JsonNullableModule jnm = new JsonNullableModule();
- mapper.registerModule(jnm);
- }
-
- /**
- * Set the date format for JSON (de)serialization with Date properties.
- *
- * @param dateFormat Date format
- */
- public void setDateFormat(DateFormat dateFormat) {
- mapper.setDateFormat(dateFormat);
- }
-
- /**
- * Get the object mapper
- *
- * @return object mapper
- */
- public ObjectMapper getMapper() { return mapper; }
-
- /**
- * Returns the target model class that should be used to deserialize the input data.
- * The discriminator mappings are used to determine the target model class.
- *
- * @param node The input data.
- * @param modelClass The class that contains the discriminator mappings.
- *
- * @return the target model class.
- */
- public static Class> getClassForElement(JsonNode node, Class> modelClass) {
- ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
- if (cdm != null) {
- return cdm.getClassForElement(node, new HashSet>());
- }
- return null;
- }
-
- /**
- * Helper class to register the discriminator mappings.
- */
- private static class ClassDiscriminatorMapping {
- // The model class name.
- Class> modelClass;
- // The name of the discriminator property.
- String discriminatorName;
- // The discriminator mappings for a model class.
- Map> discriminatorMappings;
-
- // Constructs a new class discriminator.
- ClassDiscriminatorMapping(Class> cls, String propertyName, Map> mappings) {
- modelClass = cls;
- discriminatorName = propertyName;
- discriminatorMappings = new HashMap>();
- if (mappings != null) {
- discriminatorMappings.putAll(mappings);
- }
- }
-
- // Return the name of the discriminator property for this model class.
- String getDiscriminatorPropertyName() {
- return discriminatorName;
- }
-
- // Return the discriminator value or null if the discriminator is not
- // present in the payload.
- String getDiscriminatorValue(JsonNode node) {
- // Determine the value of the discriminator property in the input data.
- if (discriminatorName != null) {
- // Get the value of the discriminator property, if present in the input payload.
- node = node.get(discriminatorName);
- if (node != null && node.isValueNode()) {
- String discrValue = node.asText();
- if (discrValue != null) {
- return discrValue;
- }
- }
- }
- return null;
+ public JSON() {
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
+ mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
+ mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+ mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
+ mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
+ mapper.setDateFormat(new RFC3339DateFormat());
+ mapper.registerModule(new JavaTimeModule());
+ JsonNullableModule jnm = new JsonNullableModule();
+ mapper.registerModule(jnm);
}
/**
- * Returns the target model class that should be used to deserialize the input data.
- * This function can be invoked for anyOf/oneOf composed models with discriminator mappings.
- * The discriminator mappings are used to determine the target model class.
+ * Set the date format for JSON (de)serialization with Date properties.
+ *
+ * @param dateFormat Date format
+ */
+ public void setDateFormat(DateFormat dateFormat) {
+ mapper.setDateFormat(dateFormat);
+ }
+
+ /**
+ * Get the object mapper
+ *
+ * @return object mapper
+ */
+ public ObjectMapper getMapper() {
+ return mapper;
+ }
+
+ /**
+ * Returns the target model class that should be used to deserialize the input data. The
+ * discriminator mappings are used to determine the target model class.
*
* @param node The input data.
- * @param visitedClasses The set of classes that have already been visited.
- *
+ * @param modelClass The class that contains the discriminator mappings.
* @return the target model class.
*/
- Class> getClassForElement(JsonNode node, Set> visitedClasses) {
- if (visitedClasses.contains(modelClass)) {
- // Class has already been visited.
+ public static Class> getClassForElement(JsonNode node, Class> modelClass) {
+ ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
+ if (cdm != null) {
+ return cdm.getClassForElement(node, new HashSet>());
+ }
return null;
- }
- // Determine the value of the discriminator property in the input data.
- String discrValue = getDiscriminatorValue(node);
- if (discrValue == null) {
- return null;
- }
- Class> cls = discriminatorMappings.get(discrValue);
- // It may not be sufficient to return this cls directly because that target class
- // may itself be a composed schema, possibly with its own discriminator.
- visitedClasses.add(modelClass);
- for (Class> childClass : discriminatorMappings.values()) {
- ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass);
- if (childCdm == null) {
- continue;
- }
- if (!discriminatorName.equals(childCdm.discriminatorName)) {
- discrValue = getDiscriminatorValue(node);
- if (discrValue == null) {
- continue;
- }
- }
- if (childCdm != null) {
- // Recursively traverse the discriminator mappings.
- Class> childDiscr = childCdm.getClassForElement(node, visitedClasses);
- if (childDiscr != null) {
- return childDiscr;
- }
- }
- }
- return cls;
}
- }
- /**
- * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy.
- *
- * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy,
- * so it's not possible to use the instanceof keyword.
- *
- * @param modelClass A OpenAPI model class.
- * @param inst The instance object.
- * @param visitedClasses The set of classes that have already been visited.
- *
- * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy.
- */
- public static boolean isInstanceOf(Class> modelClass, Object inst, Set> visitedClasses) {
- if (modelClass.isInstance(inst)) {
- // This handles the 'allOf' use case with single parent inheritance.
- return true;
- }
- if (visitedClasses.contains(modelClass)) {
- // This is to prevent infinite recursion when the composed schemas have
- // a circular dependency.
- return false;
- }
- visitedClasses.add(modelClass);
+ /** Helper class to register the discriminator mappings. */
+ private static class ClassDiscriminatorMapping {
+ // The model class name.
+ Class> modelClass;
+ // The name of the discriminator property.
+ String discriminatorName;
+ // The discriminator mappings for a model class.
+ Map> discriminatorMappings;
- // Traverse the oneOf/anyOf composed schemas.
- Map> descendants = modelDescendants.get(modelClass);
- if (descendants != null) {
- for (Class> childType : descendants.values()) {
- if (isInstanceOf(childType, inst, visitedClasses)) {
- return true;
+ // Constructs a new class discriminator.
+ ClassDiscriminatorMapping(
+ Class> cls, String propertyName, Map> mappings) {
+ modelClass = cls;
+ discriminatorName = propertyName;
+ discriminatorMappings = new HashMap>();
+ if (mappings != null) {
+ discriminatorMappings.putAll(mappings);
+ }
+ }
+
+ // Return the name of the discriminator property for this model class.
+ String getDiscriminatorPropertyName() {
+ return discriminatorName;
+ }
+
+ // Return the discriminator value or null if the discriminator is not
+ // present in the payload.
+ String getDiscriminatorValue(JsonNode node) {
+ // Determine the value of the discriminator property in the input data.
+ if (discriminatorName != null) {
+ // Get the value of the discriminator property, if present in the input payload.
+ node = node.get(discriminatorName);
+ if (node != null && node.isValueNode()) {
+ String discrValue = node.asText();
+ if (discrValue != null) {
+ return discrValue;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the target model class that should be used to deserialize the input data. This
+ * function can be invoked for anyOf/oneOf composed models with discriminator mappings. The
+ * discriminator mappings are used to determine the target model class.
+ *
+ * @param node The input data.
+ * @param visitedClasses The set of classes that have already been visited.
+ * @return the target model class.
+ */
+ Class> getClassForElement(JsonNode node, Set> visitedClasses) {
+ if (visitedClasses.contains(modelClass)) {
+ // Class has already been visited.
+ return null;
+ }
+ // Determine the value of the discriminator property in the input data.
+ String discrValue = getDiscriminatorValue(node);
+ if (discrValue == null) {
+ return null;
+ }
+ Class> cls = discriminatorMappings.get(discrValue);
+ // It may not be sufficient to return this cls directly because that target class
+ // may itself be a composed schema, possibly with its own discriminator.
+ visitedClasses.add(modelClass);
+ for (Class> childClass : discriminatorMappings.values()) {
+ ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass);
+ if (childCdm == null) {
+ continue;
+ }
+ if (!discriminatorName.equals(childCdm.discriminatorName)) {
+ discrValue = getDiscriminatorValue(node);
+ if (discrValue == null) {
+ continue;
+ }
+ }
+ if (childCdm != null) {
+ // Recursively traverse the discriminator mappings.
+ Class> childDiscr = childCdm.getClassForElement(node, visitedClasses);
+ if (childDiscr != null) {
+ return childDiscr;
+ }
+ }
+ }
+ return cls;
}
- }
}
- return false;
- }
- /**
- * A map of discriminators for all model classes.
- */
- private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>();
+ /**
+ * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy.
+ *
+ * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy,
+ * so it's not possible to use the instanceof keyword.
+ *
+ * @param modelClass A OpenAPI model class.
+ * @param inst The instance object.
+ * @param visitedClasses The set of classes that have already been visited.
+ * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy.
+ */
+ public static boolean isInstanceOf(
+ Class> modelClass, Object inst, Set> visitedClasses) {
+ if (modelClass.isInstance(inst)) {
+ // This handles the 'allOf' use case with single parent inheritance.
+ return true;
+ }
+ if (visitedClasses.contains(modelClass)) {
+ // This is to prevent infinite recursion when the composed schemas have
+ // a circular dependency.
+ return false;
+ }
+ visitedClasses.add(modelClass);
- /**
- * A map of oneOf/anyOf descendants for each model class.
- */
- private static Map, Map>> modelDescendants = new HashMap<>();
+ // Traverse the oneOf/anyOf composed schemas.
+ Map> descendants = modelDescendants.get(modelClass);
+ if (descendants != null) {
+ for (Class> childType : descendants.values()) {
+ if (isInstanceOf(childType, inst, visitedClasses)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
- /**
- * Register a model class discriminator.
- *
- * @param modelClass the model class
- * @param discriminatorPropertyName the name of the discriminator property
- * @param mappings a map with the discriminator mappings.
- */
- public static void registerDiscriminator(Class> modelClass, String discriminatorPropertyName, Map> mappings) {
- ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings);
- modelDiscriminators.put(modelClass, m);
- }
+ /** A map of discriminators for all model classes. */
+ private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>();
- /**
- * Register the oneOf/anyOf descendants of the modelClass.
- *
- * @param modelClass the model class
- * @param descendants a map of oneOf/anyOf descendants.
- */
- public static void registerDescendants(Class> modelClass, Map> descendants) {
- modelDescendants.put(modelClass, descendants);
- }
+ /** A map of oneOf/anyOf descendants for each model class. */
+ private static Map, Map>> modelDescendants = new HashMap<>();
- private static JSON json;
+ /**
+ * Register a model class discriminator.
+ *
+ * @param modelClass the model class
+ * @param discriminatorPropertyName the name of the discriminator property
+ * @param mappings a map with the discriminator mappings.
+ */
+ public static void registerDiscriminator(
+ Class> modelClass, String discriminatorPropertyName, Map> mappings) {
+ ClassDiscriminatorMapping m =
+ new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings);
+ modelDiscriminators.put(modelClass, m);
+ }
- static {
- json = new JSON();
- }
+ /**
+ * Register the oneOf/anyOf descendants of the modelClass.
+ *
+ * @param modelClass the model class
+ * @param descendants a map of oneOf/anyOf descendants.
+ */
+ public static void registerDescendants(Class> modelClass, Map> descendants) {
+ modelDescendants.put(modelClass, descendants);
+ }
- /**
- * Get the default JSON instance.
- *
- * @return the default JSON instance
- */
- public static JSON getDefault() {
- return json;
- }
+ private static JSON json;
- /**
- * Set the default JSON instance.
- *
- * @param json JSON instance to be used
- */
- public static void setDefault(JSON json) {
- JSON.json = json;
- }
+ static {
+ json = new JSON();
+ }
+
+ /**
+ * Get the default JSON instance.
+ *
+ * @return the default JSON instance
+ */
+ public static JSON getDefault() {
+ return json;
+ }
+
+ /**
+ * Set the default JSON instance.
+ *
+ * @param json JSON instance to be used
+ */
+ public static void setDefault(JSON json) {
+ JSON.json = json;
+ }
}
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Pair.java
index 25b5a1b08792..b8774a5d95fe 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Pair.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/Pair.java
@@ -3,14 +3,13 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package org.openapitools.client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@@ -18,7 +17,7 @@ public class Pair {
private String name = "";
private String value = "";
- public Pair (String name, String value) {
+ public Pair(String name, String value) {
setName(name);
setValue(value);
}
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java
index f94cba613ba4..0d37bd979855 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/RFC3339DateFormat.java
@@ -3,7 +3,7 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -12,46 +12,45 @@
package org.openapitools.client;
-import com.fasterxml.jackson.databind.util.StdDateFormat;
+import com.fasterxml.jackson.databind.util.StdDateFormat;
import java.text.DateFormat;
+import java.text.DecimalFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
-import java.text.DecimalFormat;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat {
- private static final long serialVersionUID = 1L;
- private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
+ 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);
+ private final StdDateFormat fmt =
+ new StdDateFormat().withTimeZone(TIMEZONE_Z).withColonInTimeZone(true);
- public RFC3339DateFormat() {
- this.calendar = new GregorianCalendar();
- this.numberFormat = new DecimalFormat();
- }
+ 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) {
+ return parse(source, new ParsePosition(0));
+ }
- @Override
- public Date parse(String source, ParsePosition pos) {
- return fmt.parse(source, pos);
- }
+ @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 StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
+ return fmt.format(date, toAppendTo, fieldPosition);
+ }
- @Override
- public Object clone() {
- return super.clone();
- }
-}
\ No newline at end of file
+ @Override
+ public Object clone() {
+ return super.clone();
+ }
+}
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java
index 59edc528a446..057ae1a2821e 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerConfiguration.java
@@ -1,10 +1,9 @@
package org.openapitools.client;
+
import java.util.Map;
-/**
- * Representing a Server configuration.
- */
+/** Representing a Server configuration. */
public class ServerConfiguration {
public String URL;
public String description;
@@ -13,9 +12,11 @@ public class ServerConfiguration {
/**
* @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.
+ * @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 variables) {
+ public ServerConfiguration(
+ String URL, String description, Map variables) {
this.URL = URL;
this.description = description;
this.variables = variables;
@@ -31,15 +32,21 @@ public class ServerConfiguration {
String url = this.URL;
// go through variables and replace placeholders
- for (Map.Entry variable: this.variables.entrySet()) {
+ for (Map.Entry 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 + ".");
+ 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);
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerVariable.java
index c2f13e216662..b13ae3e3e719 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerVariable.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/ServerVariable.java
@@ -1,10 +1,9 @@
package org.openapitools.client;
+
import java.util.HashSet;
-/**
- * Representing a Server Variable for server URL template substitution.
- */
+/** Representing a Server Variable for server URL template substitution. */
public class ServerVariable {
public String description;
public String defaultValue;
@@ -13,7 +12,8 @@ public class ServerVariable {
/**
* @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.
+ * @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 enumValues) {
this.description = description;
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java
index 6d67e626cc54..c0735ae861aa 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java
@@ -3,7 +3,7 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -12,155 +12,144 @@
package org.openapitools.client.api;
-import org.openapitools.client.ApiClient;
-import org.openapitools.client.ApiException;
-import org.openapitools.client.ApiResponse;
-import org.openapitools.client.Pair;
-
-import org.openapitools.client.model.Client;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.http.HttpEntity;
-import org.apache.http.NameValuePair;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
-import java.net.http.HttpRequest;
-import java.nio.channels.Channels;
-import java.nio.channels.Pipe;
+import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
-
-import java.util.ArrayList;
-import java.util.StringJoiner;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import java.util.function.Consumer;
+import org.openapitools.client.ApiClient;
+import org.openapitools.client.ApiException;
+import org.openapitools.client.ApiResponse;
+import org.openapitools.client.model.Client;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AnotherFakeApi {
- private final HttpClient memberVarHttpClient;
- private final ObjectMapper memberVarObjectMapper;
- private final String memberVarBaseUri;
- private final Consumer memberVarInterceptor;
- private final Duration memberVarReadTimeout;
- private final Consumer> memberVarResponseInterceptor;
- private final Consumer> memberVarAsyncResponseInterceptor;
+ private final HttpClient memberVarHttpClient;
+ private final ObjectMapper memberVarObjectMapper;
+ private final String memberVarBaseUri;
+ private final Consumer memberVarInterceptor;
+ private final Duration memberVarReadTimeout;
+ private final Consumer> memberVarResponseInterceptor;
+ private final Consumer> memberVarAsyncResponseInterceptor;
- public AnotherFakeApi() {
- this(new ApiClient());
- }
-
- public AnotherFakeApi(ApiClient apiClient) {
- memberVarHttpClient = apiClient.getHttpClient();
- memberVarObjectMapper = apiClient.getObjectMapper();
- memberVarBaseUri = apiClient.getBaseUri();
- memberVarInterceptor = apiClient.getRequestInterceptor();
- memberVarReadTimeout = apiClient.getReadTimeout();
- memberVarResponseInterceptor = apiClient.getResponseInterceptor();
- memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
- }
-
- protected ApiException getApiException(String operationId, HttpResponse response) throws IOException {
- String body = response.body() == null ? null : new String(response.body().readAllBytes());
- String message = formatExceptionMessage(operationId, response.statusCode(), body);
- return new ApiException(response.statusCode(), message, response.headers(), body);
- }
-
- private String formatExceptionMessage(String operationId, int statusCode, String body) {
- if (body == null || body.isEmpty()) {
- body = "[no body]";
+ public AnotherFakeApi() {
+ this(new ApiClient());
}
- return operationId + " call failed with: " + statusCode + " - " + body;
- }
- /**
- * To test special tags
- * To test special tags and operation ID starting with number
- * @param client client model (required)
- * @return Client
- * @throws ApiException if fails to make API call
- */
- public Client call123testSpecialTags(Client client) throws ApiException {
- ApiResponse localVarResponse = call123testSpecialTagsWithHttpInfo(client);
- return localVarResponse.getData();
- }
+ public AnotherFakeApi(ApiClient apiClient) {
+ memberVarHttpClient = apiClient.getHttpClient();
+ memberVarObjectMapper = apiClient.getObjectMapper();
+ memberVarBaseUri = apiClient.getBaseUri();
+ memberVarInterceptor = apiClient.getRequestInterceptor();
+ memberVarReadTimeout = apiClient.getReadTimeout();
+ memberVarResponseInterceptor = apiClient.getResponseInterceptor();
+ memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
+ }
- /**
- * To test special tags
- * To test special tags and operation ID starting with number
- * @param client client model (required)
- * @return ApiResponse<Client>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse call123testSpecialTagsWithHttpInfo(Client client) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("call123testSpecialTags", localVarResponse);
+ protected ApiException getApiException(String operationId, HttpResponse response)
+ throws IOException {
+ String body = response.body() == null ? null : new String(response.body().readAllBytes());
+ String message = formatExceptionMessage(operationId, response.statusCode(), body);
+ return new ApiException(response.statusCode(), message, response.headers(), body);
+ }
+
+ private String formatExceptionMessage(String operationId, int statusCode, String body) {
+ if (body == null || body.isEmpty()) {
+ body = "[no body]";
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder call123testSpecialTagsRequestBuilder(Client client) throws ApiException {
- // verify the required parameter 'client' is set
- if (client == null) {
- throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags");
+ return operationId + " call failed with: " + statusCode + " - " + body;
}
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/another-fake/dummy";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "application/json");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(client);
- localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
+ /**
+ * To test special tags To test special tags and operation ID starting with number
+ *
+ * @param client client model (required)
+ * @return Client
+ * @throws ApiException if fails to make API call
+ */
+ public Client call123testSpecialTags(Client client) throws ApiException {
+ ApiResponse localVarResponse = call123testSpecialTagsWithHttpInfo(client);
+ return localVarResponse.getData();
}
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
+
+ /**
+ * To test special tags To test special tags and operation ID starting with number
+ *
+ * @param client client model (required)
+ * @return ApiResponse<Client>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse call123testSpecialTagsWithHttpInfo(Client client)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("call123testSpecialTags", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
+ }
}
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
+
+ private HttpRequest.Builder call123testSpecialTagsRequestBuilder(Client client)
+ throws ApiException {
+ // verify the required parameter 'client' is set
+ if (client == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter 'client' when calling call123testSpecialTags");
+ }
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/another-fake/dummy";
+
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(client);
+ localVarRequestBuilder.method(
+ "PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
+ }
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
+ }
+ return localVarRequestBuilder;
}
- return localVarRequestBuilder;
- }
}
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java
index 45054e60bf93..5cac295102ee 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/DefaultApi.java
@@ -3,7 +3,7 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -12,143 +12,124 @@
package org.openapitools.client.api;
-import org.openapitools.client.ApiClient;
-import org.openapitools.client.ApiException;
-import org.openapitools.client.ApiResponse;
-import org.openapitools.client.Pair;
-
-import org.openapitools.client.model.FooGetDefaultResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.http.HttpEntity;
-import org.apache.http.NameValuePair;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
-import java.net.http.HttpRequest;
-import java.nio.channels.Channels;
-import java.nio.channels.Pipe;
+import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
-
-import java.util.ArrayList;
-import java.util.StringJoiner;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import java.util.function.Consumer;
+import org.openapitools.client.ApiClient;
+import org.openapitools.client.ApiException;
+import org.openapitools.client.ApiResponse;
+import org.openapitools.client.model.FooGetDefaultResponse;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class DefaultApi {
- private final HttpClient memberVarHttpClient;
- private final ObjectMapper memberVarObjectMapper;
- private final String memberVarBaseUri;
- private final Consumer memberVarInterceptor;
- private final Duration memberVarReadTimeout;
- private final Consumer> memberVarResponseInterceptor;
- private final Consumer> memberVarAsyncResponseInterceptor;
+ private final HttpClient memberVarHttpClient;
+ private final ObjectMapper memberVarObjectMapper;
+ private final String memberVarBaseUri;
+ private final Consumer memberVarInterceptor;
+ private final Duration memberVarReadTimeout;
+ private final Consumer> memberVarResponseInterceptor;
+ private final Consumer> memberVarAsyncResponseInterceptor;
- public DefaultApi() {
- this(new ApiClient());
- }
-
- public DefaultApi(ApiClient apiClient) {
- memberVarHttpClient = apiClient.getHttpClient();
- memberVarObjectMapper = apiClient.getObjectMapper();
- memberVarBaseUri = apiClient.getBaseUri();
- memberVarInterceptor = apiClient.getRequestInterceptor();
- memberVarReadTimeout = apiClient.getReadTimeout();
- memberVarResponseInterceptor = apiClient.getResponseInterceptor();
- memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
- }
-
- protected ApiException getApiException(String operationId, HttpResponse response) throws IOException {
- String body = response.body() == null ? null : new String(response.body().readAllBytes());
- String message = formatExceptionMessage(operationId, response.statusCode(), body);
- return new ApiException(response.statusCode(), message, response.headers(), body);
- }
-
- private String formatExceptionMessage(String operationId, int statusCode, String body) {
- if (body == null || body.isEmpty()) {
- body = "[no body]";
+ public DefaultApi() {
+ this(new ApiClient());
}
- return operationId + " call failed with: " + statusCode + " - " + body;
- }
- /**
- *
- *
- * @return FooGetDefaultResponse
- * @throws ApiException if fails to make API call
- */
- public FooGetDefaultResponse fooGet() throws ApiException {
- ApiResponse localVarResponse = fooGetWithHttpInfo();
- return localVarResponse.getData();
- }
+ public DefaultApi(ApiClient apiClient) {
+ memberVarHttpClient = apiClient.getHttpClient();
+ memberVarObjectMapper = apiClient.getObjectMapper();
+ memberVarBaseUri = apiClient.getBaseUri();
+ memberVarInterceptor = apiClient.getRequestInterceptor();
+ memberVarReadTimeout = apiClient.getReadTimeout();
+ memberVarResponseInterceptor = apiClient.getResponseInterceptor();
+ memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
+ }
- /**
- *
- *
- * @return ApiResponse<FooGetDefaultResponse>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse fooGetWithHttpInfo() throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder();
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("fooGet", localVarResponse);
+ protected ApiException getApiException(String operationId, HttpResponse response)
+ throws IOException {
+ String body = response.body() == null ? null : new String(response.body().readAllBytes());
+ String message = formatExceptionMessage(operationId, response.statusCode(), body);
+ return new ApiException(response.statusCode(), message, response.headers(), body);
+ }
+
+ private String formatExceptionMessage(String operationId, int statusCode, String body) {
+ if (body == null || body.isEmpty()) {
+ body = "[no body]";
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
+ return operationId + " call failed with: " + statusCode + " - " + body;
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
+
+ /**
+ * @return FooGetDefaultResponse
+ * @throws ApiException if fails to make API call
+ */
+ public FooGetDefaultResponse fooGet() throws ApiException {
+ ApiResponse localVarResponse = fooGetWithHttpInfo();
+ return localVarResponse.getData();
}
- }
- private HttpRequest.Builder fooGetRequestBuilder() throws ApiException {
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/foo";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Accept", "application/json");
-
- localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
+ /**
+ * @return ApiResponse<FooGetDefaultResponse>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse fooGetWithHttpInfo() throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder();
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("fooGet", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference() {}) // closes the
+ // InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
+ }
}
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
+
+ private HttpRequest.Builder fooGetRequestBuilder() throws ApiException {
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/foo";
+
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
+ }
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
+ }
+ return localVarRequestBuilder;
}
- return localVarRequestBuilder;
- }
}
diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java
index 77eee894334a..44ae65cc8fa7 100644
--- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java
+++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java
@@ -3,7 +3,7 @@
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* The version of the OpenAPI document: 1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -12,1548 +12,1849 @@
package org.openapitools.client.api;
-import org.openapitools.client.ApiClient;
-import org.openapitools.client.ApiException;
-import org.openapitools.client.ApiResponse;
-import org.openapitools.client.Pair;
-
-import java.math.BigDecimal;
-import org.openapitools.client.model.Client;
-import java.io.File;
-import org.openapitools.client.model.FileSchemaTestClass;
-import org.openapitools.client.model.HealthCheckResult;
-import java.time.LocalDate;
-import java.time.OffsetDateTime;
-import org.openapitools.client.model.OuterComposite;
-import org.openapitools.client.model.OuterEnum;
-import org.openapitools.client.model.User;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.http.HttpEntity;
-import org.apache.http.NameValuePair;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-
-import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
-import java.net.http.HttpRequest;
-import java.nio.channels.Channels;
-import java.nio.channels.Pipe;
+import java.io.InputStream;
+import java.math.BigDecimal;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
-
+import java.time.LocalDate;
+import java.time.OffsetDateTime;
import java.util.ArrayList;
-import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
-import java.util.Set;
+import java.util.StringJoiner;
import java.util.function.Consumer;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.message.BasicNameValuePair;
+import org.openapitools.client.ApiClient;
+import org.openapitools.client.ApiException;
+import org.openapitools.client.ApiResponse;
+import org.openapitools.client.Pair;
+import org.openapitools.client.model.Client;
+import org.openapitools.client.model.FileSchemaTestClass;
+import org.openapitools.client.model.HealthCheckResult;
+import org.openapitools.client.model.OuterComposite;
+import org.openapitools.client.model.OuterEnum;
+import org.openapitools.client.model.User;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class FakeApi {
- private final HttpClient memberVarHttpClient;
- private final ObjectMapper memberVarObjectMapper;
- private final String memberVarBaseUri;
- private final Consumer memberVarInterceptor;
- private final Duration memberVarReadTimeout;
- private final Consumer> memberVarResponseInterceptor;
- private final Consumer> memberVarAsyncResponseInterceptor;
+ private final HttpClient memberVarHttpClient;
+ private final ObjectMapper memberVarObjectMapper;
+ private final String memberVarBaseUri;
+ private final Consumer memberVarInterceptor;
+ private final Duration memberVarReadTimeout;
+ private final Consumer> memberVarResponseInterceptor;
+ private final Consumer> memberVarAsyncResponseInterceptor;
- public FakeApi() {
- this(new ApiClient());
- }
-
- public FakeApi(ApiClient apiClient) {
- memberVarHttpClient = apiClient.getHttpClient();
- memberVarObjectMapper = apiClient.getObjectMapper();
- memberVarBaseUri = apiClient.getBaseUri();
- memberVarInterceptor = apiClient.getRequestInterceptor();
- memberVarReadTimeout = apiClient.getReadTimeout();
- memberVarResponseInterceptor = apiClient.getResponseInterceptor();
- memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
- }
-
- protected ApiException getApiException(String operationId, HttpResponse response) throws IOException {
- String body = response.body() == null ? null : new String(response.body().readAllBytes());
- String message = formatExceptionMessage(operationId, response.statusCode(), body);
- return new ApiException(response.statusCode(), message, response.headers(), body);
- }
-
- private String formatExceptionMessage(String operationId, int statusCode, String body) {
- if (body == null || body.isEmpty()) {
- body = "[no body]";
+ public FakeApi() {
+ this(new ApiClient());
}
- return operationId + " call failed with: " + statusCode + " - " + body;
- }
- /**
- * Health check endpoint
- *
- * @return HealthCheckResult
- * @throws ApiException if fails to make API call
- */
- public HealthCheckResult fakeHealthGet() throws ApiException {
- ApiResponse localVarResponse = fakeHealthGetWithHttpInfo();
- return localVarResponse.getData();
- }
+ public FakeApi(ApiClient apiClient) {
+ memberVarHttpClient = apiClient.getHttpClient();
+ memberVarObjectMapper = apiClient.getObjectMapper();
+ memberVarBaseUri = apiClient.getBaseUri();
+ memberVarInterceptor = apiClient.getRequestInterceptor();
+ memberVarReadTimeout = apiClient.getReadTimeout();
+ memberVarResponseInterceptor = apiClient.getResponseInterceptor();
+ memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
+ }
- /**
- * Health check endpoint
- *
- * @return ApiResponse<HealthCheckResult>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder();
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("fakeHealthGet", localVarResponse);
+ protected ApiException getApiException(String operationId, HttpResponse response)
+ throws IOException {
+ String body = response.body() == null ? null : new String(response.body().readAllBytes());
+ String message = formatExceptionMessage(operationId, response.statusCode(), body);
+ return new ApiException(response.statusCode(), message, response.headers(), body);
+ }
+
+ private String formatExceptionMessage(String operationId, int statusCode, String body) {
+ if (body == null || body.isEmpty()) {
+ body = "[no body]";
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
+ return operationId + " call failed with: " + statusCode + " - " + body;
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
+
+ /**
+ * Health check endpoint
+ *
+ * @return HealthCheckResult
+ * @throws ApiException if fails to make API call
+ */
+ public HealthCheckResult fakeHealthGet() throws ApiException {
+ ApiResponse localVarResponse = fakeHealthGetWithHttpInfo();
+ return localVarResponse.getData();
}
- }
- private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException {
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/health";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Accept", "application/json");
-
- localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- * Test serialization of outer boolean types
- * @param body Input boolean as post body (optional)
- * @return Boolean
- * @throws ApiException if fails to make API call
- */
- public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException {
- ApiResponse localVarResponse = fakeOuterBooleanSerializeWithHttpInfo(body);
- return localVarResponse.getData();
- }
-
- /**
- *
- * Test serialization of outer boolean types
- * @param body Input boolean as post body (optional)
- * @return ApiResponse<Boolean>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("fakeOuterBooleanSerialize", localVarResponse);
+ /**
+ * Health check endpoint
+ *
+ * @return ApiResponse<HealthCheckResult>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = fakeHealthGetRequestBuilder();
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("fakeHealthGet", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference<
+ HealthCheckResult>() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
- private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(Boolean body) throws ApiException {
+ private HttpRequest.Builder fakeHealthGetRequestBuilder() throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
- String localVarPath = "/fake/outer/boolean";
+ String localVarPath = "/fake/health";
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "*/*");
+ localVarRequestBuilder.header("Accept", "application/json");
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
- localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- * Test serialization of object with outer number type
- * @param outerComposite Input composite as post body (optional)
- * @return OuterComposite
- * @throws ApiException if fails to make API call
- */
- public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) throws ApiException {
- ApiResponse localVarResponse = fakeOuterCompositeSerializeWithHttpInfo(outerComposite);
- return localVarResponse.getData();
- }
-
- /**
- *
- * Test serialization of object with outer number type
- * @param outerComposite Input composite as post body (optional)
- * @return ApiResponse<OuterComposite>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = fakeOuterCompositeSerializeRequestBuilder(outerComposite);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("fakeOuterCompositeSerialize", localVarResponse);
+ localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(OuterComposite outerComposite) throws ApiException {
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/outer/composite";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "*/*");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(outerComposite);
- localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- * Test serialization of outer number types
- * @param body Input number as post body (optional)
- * @return BigDecimal
- * @throws ApiException if fails to make API call
- */
- public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException {
- ApiResponse localVarResponse = fakeOuterNumberSerializeWithHttpInfo(body);
- return localVarResponse.getData();
- }
-
- /**
- *
- * Test serialization of outer number types
- * @param body Input number as post body (optional)
- * @return ApiResponse<BigDecimal>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("fakeOuterNumberSerialize", localVarResponse);
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
+ return localVarRequestBuilder;
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
+ /**
+ * Test serialization of outer boolean types
+ *
+ * @param body Input boolean as post body (optional)
+ * @return Boolean
+ * @throws ApiException if fails to make API call
+ */
+ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException {
+ ApiResponse localVarResponse = fakeOuterBooleanSerializeWithHttpInfo(body);
+ return localVarResponse.getData();
}
- }
- private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(BigDecimal body) throws ApiException {
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/outer/number";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "*/*");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
- localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- * Test serialization of outer string types
- * @param body Input string as post body (optional)
- * @return String
- * @throws ApiException if fails to make API call
- */
- public String fakeOuterStringSerialize(String body) throws ApiException {
- ApiResponse localVarResponse = fakeOuterStringSerializeWithHttpInfo(body);
- return localVarResponse.getData();
- }
-
- /**
- *
- * Test serialization of outer string types
- * @param body Input string as post body (optional)
- * @return ApiResponse<String>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("fakeOuterStringSerialize", localVarResponse);
+ /**
+ * Test serialization of outer boolean types
+ *
+ * @param body Input boolean as post body (optional)
+ * @return ApiResponse<Boolean>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = fakeOuterBooleanSerializeRequestBuilder(body);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("fakeOuterBooleanSerialize", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
- private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(String body) throws ApiException {
+ private HttpRequest.Builder fakeOuterBooleanSerializeRequestBuilder(Boolean body)
+ throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
- String localVarPath = "/fake/outer/string";
+ String localVarPath = "/fake/outer/boolean";
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "*/*");
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "*/*");
- localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofString(body));
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- * Array of Enums
- *
- * @return List<OuterEnum>
- * @throws ApiException if fails to make API call
- */
- public List getArrayOfEnums() throws ApiException {
- ApiResponse> localVarResponse = getArrayOfEnumsWithHttpInfo();
- return localVarResponse.getData();
- }
-
- /**
- * Array of Enums
- *
- * @return ApiResponse<List<OuterEnum>>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder();
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("getArrayOfEnums", localVarResponse);
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
+ localVarRequestBuilder.method(
+ "POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
}
- return new ApiResponse>(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference>() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException {
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/array-of-enums";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Accept", "application/json");
-
- localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- * For this test, the body for this request much reference a schema named `File`.
- * @param fileSchemaTestClass (required)
- * @throws ApiException if fails to make API call
- */
- public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws ApiException {
- testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass);
- }
-
- /**
- *
- * For this test, the body for this request much reference a schema named `File`.
- * @param fileSchemaTestClass (required)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testBodyWithFileSchema", localVarResponse);
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
+ return localVarRequestBuilder;
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(FileSchemaTestClass fileSchemaTestClass) throws ApiException {
- // verify the required parameter 'fileSchemaTestClass' is set
- if (fileSchemaTestClass == null) {
- throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema");
+ /**
+ * Test serialization of object with outer number type
+ *
+ * @param outerComposite Input composite as post body (optional)
+ * @return OuterComposite
+ * @throws ApiException if fails to make API call
+ */
+ public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite)
+ throws ApiException {
+ ApiResponse localVarResponse =
+ fakeOuterCompositeSerializeWithHttpInfo(outerComposite);
+ return localVarResponse.getData();
}
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/body-with-file-schema";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "application/json");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(fileSchemaTestClass);
- localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- *
- * @param query (required)
- * @param user (required)
- * @throws ApiException if fails to make API call
- */
- public void testBodyWithQueryParams(String query, User user) throws ApiException {
- testBodyWithQueryParamsWithHttpInfo(query, user);
- }
-
- /**
- *
- *
- * @param query (required)
- * @param user (required)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User user) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testBodyWithQueryParamsRequestBuilder(query, user);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testBodyWithQueryParams", localVarResponse);
+ /**
+ * Test serialization of object with outer number type
+ *
+ * @param outerComposite Input composite as post body (optional)
+ * @return ApiResponse<OuterComposite>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(
+ OuterComposite outerComposite) throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder =
+ fakeOuterCompositeSerializeRequestBuilder(outerComposite);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("fakeOuterCompositeSerialize", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference<
+ OuterComposite>() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ }
+
+ private HttpRequest.Builder fakeOuterCompositeSerializeRequestBuilder(
+ OuterComposite outerComposite) throws ApiException {
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/fake/outer/composite";
+
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "*/*");
+
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(outerComposite);
+ localVarRequestBuilder.method(
+ "POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(String query, User user) throws ApiException {
- // verify the required parameter 'query' is set
- if (query == null) {
- throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams");
- }
- // verify the required parameter 'user' is set
- if (user == null) {
- throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams");
- }
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/body-with-query-params";
-
- List localVarQueryParams = new ArrayList<>();
- StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
- String localVarQueryParameterBaseName;
- localVarQueryParameterBaseName = "query";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query));
-
- if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
- StringJoiner queryJoiner = new StringJoiner("&");
- localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
- if (localVarQueryStringJoiner.length() != 0) {
- queryJoiner.add(localVarQueryStringJoiner.toString());
- }
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
- } else {
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- }
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "application/json");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user);
- localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- * To test \"client\" model
- * To test \"client\" model
- * @param client client model (required)
- * @return Client
- * @throws ApiException if fails to make API call
- */
- public Client testClientModel(Client client) throws ApiException {
- ApiResponse localVarResponse = testClientModelWithHttpInfo(client);
- return localVarResponse.getData();
- }
-
- /**
- * To test \"client\" model
- * To test \"client\" model
- * @param client client model (required)
- * @return ApiResponse<Client>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testClientModelWithHttpInfo(Client client) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testClientModel", localVarResponse);
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
- );
- } finally {
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testClientModelRequestBuilder(Client client) throws ApiException {
- // verify the required parameter 'client' is set
- if (client == null) {
- throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel");
- }
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "application/json");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(client);
- localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
- * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
- * @param number None (required)
- * @param _double None (required)
- * @param patternWithoutDelimiter None (required)
- * @param _byte None (required)
- * @param integer None (optional)
- * @param int32 None (optional)
- * @param int64 None (optional)
- * @param _float None (optional)
- * @param string None (optional)
- * @param binary None (optional)
- * @param date None (optional)
- * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
- * @param password None (optional)
- * @param paramCallback None (optional)
- * @throws ApiException if fails to make API call
- */
- public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException {
- testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
- }
-
- /**
- * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
- * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
- * @param number None (required)
- * @param _double None (required)
- * @param patternWithoutDelimiter None (required)
- * @param _byte None (required)
- * @param integer None (optional)
- * @param int32 None (optional)
- * @param int64 None (optional)
- * @param _float None (optional)
- * @param string None (optional)
- * @param binary None (optional)
- * @param date None (optional)
- * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
- * @param password None (optional)
- * @param paramCallback None (optional)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testEndpointParametersRequestBuilder(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testEndpointParameters", localVarResponse);
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ return localVarRequestBuilder;
+ }
+ /**
+ * Test serialization of outer number types
+ *
+ * @param body Input number as post body (optional)
+ * @return BigDecimal
+ * @throws ApiException if fails to make API call
+ */
+ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException {
+ ApiResponse localVarResponse = fakeOuterNumberSerializeWithHttpInfo(body);
+ return localVarResponse.getData();
+ }
+
+ /**
+ * Test serialization of outer number types
+ *
+ * @param body Input number as post body (optional)
+ * @return ApiResponse<BigDecimal>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = fakeOuterNumberSerializeRequestBuilder(body);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("fakeOuterNumberSerialize", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference<
+ BigDecimal>() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testEndpointParametersRequestBuilder(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException {
- // verify the required parameter 'number' is set
- if (number == null) {
- throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters");
- }
- // verify the required parameter '_double' is set
- if (_double == null) {
- throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters");
- }
- // verify the required parameter 'patternWithoutDelimiter' is set
- if (patternWithoutDelimiter == null) {
- throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
- }
- // verify the required parameter '_byte' is set
- if (_byte == null) {
- throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters");
}
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+ private HttpRequest.Builder fakeOuterNumberSerializeRequestBuilder(BigDecimal body)
+ throws ApiException {
- String localVarPath = "/fake";
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+ String localVarPath = "/fake/outer/number";
- localVarRequestBuilder.header("Accept", "application/json");
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- List formValues = new ArrayList<>();
- formValues.add(new BasicNameValuePair("integer", integer.toString()));
- formValues.add(new BasicNameValuePair("int32", int32.toString()));
- formValues.add(new BasicNameValuePair("int64", int64.toString()));
- formValues.add(new BasicNameValuePair("number", number.toString()));
- formValues.add(new BasicNameValuePair("float", _float.toString()));
- formValues.add(new BasicNameValuePair("double", _double.toString()));
- formValues.add(new BasicNameValuePair("string", string.toString()));
- formValues.add(new BasicNameValuePair("pattern_without_delimiter", patternWithoutDelimiter.toString()));
- formValues.add(new BasicNameValuePair("byte", _byte.toString()));
- formValues.add(new BasicNameValuePair("binary", binary.toString()));
- formValues.add(new BasicNameValuePair("date", date.toString()));
- formValues.add(new BasicNameValuePair("dateTime", dateTime.toString()));
- formValues.add(new BasicNameValuePair("password", password.toString()));
- formValues.add(new BasicNameValuePair("callback", paramCallback.toString()));
- HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8);
- ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream();
- try {
- entity.writeTo(formOutputStream);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- localVarRequestBuilder
- .header("Content-Type", entity.getContentType().getValue())
- .method("POST", HttpRequest.BodyPublishers
- .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())));
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- * To test enum parameters
- * To test enum parameters
- * @param enumHeaderStringArray Header parameter enum test (string array) (optional
- * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
- * @param enumQueryStringArray Query parameter enum test (string array) (optional
- * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
- * @param enumQueryInteger Query parameter enum test (double) (optional)
- * @param enumQueryDouble Query parameter enum test (double) (optional)
- * @param enumFormStringArray Form parameter enum test (string array) (optional
- * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
- * @throws ApiException if fails to make API call
- */
- public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException {
- testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
- }
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "*/*");
- /**
- * To test enum parameters
- * To test enum parameters
- * @param enumHeaderStringArray Header parameter enum test (string array) (optional
- * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
- * @param enumQueryStringArray Query parameter enum test (string array) (optional
- * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
- * @param enumQueryInteger Query parameter enum test (double) (optional)
- * @param enumQueryDouble Query parameter enum test (double) (optional)
- * @param enumFormStringArray Form parameter enum test (string array) (optional
- * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testEnumParametersRequestBuilder(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testEnumParameters", localVarResponse);
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body);
+ localVarRequestBuilder.method(
+ "POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testEnumParametersRequestBuilder(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException {
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake";
-
- List localVarQueryParams = new ArrayList<>();
- StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
- String localVarQueryParameterBaseName;
- localVarQueryParameterBaseName = "enum_query_string_array";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray));
- localVarQueryParameterBaseName = "enum_query_string";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_string", enumQueryString));
- localVarQueryParameterBaseName = "enum_query_integer";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_integer", enumQueryInteger));
- localVarQueryParameterBaseName = "enum_query_double";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_double", enumQueryDouble));
-
- if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
- StringJoiner queryJoiner = new StringJoiner("&");
- localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
- if (localVarQueryStringJoiner.length() != 0) {
- queryJoiner.add(localVarQueryStringJoiner.toString());
- }
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
- } else {
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- }
-
- if (enumHeaderStringArray != null) {
- localVarRequestBuilder.header("enum_header_string_array", enumHeaderStringArray.toString());
- }
- if (enumHeaderString != null) {
- localVarRequestBuilder.header("enum_header_string", enumHeaderString.toString());
- }
- localVarRequestBuilder.header("Accept", "application/json");
-
- List formValues = new ArrayList<>();
- for (int i=0; i < enumFormStringArray.size(); i++) {
- formValues.add(new BasicNameValuePair("enum_form_string_array", enumFormStringArray.get(i).toString()));
- }
- formValues.add(new BasicNameValuePair("enum_form_string", enumFormString.toString()));
- HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8);
- ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream();
- try {
- entity.writeTo(formOutputStream);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- localVarRequestBuilder
- .header("Content-Type", entity.getContentType().getValue())
- .method("GET", HttpRequest.BodyPublishers
- .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())));
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- * Fake endpoint to test group parameters (optional)
- * Fake endpoint to test group parameters (optional)
- * @param apiRequest {@link APItestGroupParametersRequest}
- * @throws ApiException if fails to make API call
- */
- public void testGroupParameters(APItestGroupParametersRequest apiRequest) throws ApiException {
- Integer requiredStringGroup = apiRequest.requiredStringGroup();
- Boolean requiredBooleanGroup = apiRequest.requiredBooleanGroup();
- Long requiredInt64Group = apiRequest.requiredInt64Group();
- Integer stringGroup = apiRequest.stringGroup();
- Boolean booleanGroup = apiRequest.booleanGroup();
- Long int64Group = apiRequest.int64Group();
- testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
- }
-
- /**
- * Fake endpoint to test group parameters (optional)
- * Fake endpoint to test group parameters (optional)
- * @param apiRequest {@link APItestGroupParametersRequest}
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testGroupParametersWithHttpInfo(APItestGroupParametersRequest apiRequest) throws ApiException {
- Integer requiredStringGroup = apiRequest.requiredStringGroup();
- Boolean requiredBooleanGroup = apiRequest.requiredBooleanGroup();
- Long requiredInt64Group = apiRequest.requiredInt64Group();
- Integer stringGroup = apiRequest.stringGroup();
- Boolean booleanGroup = apiRequest.booleanGroup();
- Long int64Group = apiRequest.int64Group();
- return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
- }
-
- /**
- * Fake endpoint to test group parameters (optional)
- * Fake endpoint to test group parameters (optional)
- * @param requiredStringGroup Required String in group parameters (required)
- * @param requiredBooleanGroup Required Boolean in group parameters (required)
- * @param requiredInt64Group Required Integer in group parameters (required)
- * @param stringGroup String in group parameters (optional)
- * @param booleanGroup Boolean in group parameters (optional)
- * @param int64Group Integer in group parameters (optional)
- * @throws ApiException if fails to make API call
- */
- public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
- testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
- }
-
- /**
- * Fake endpoint to test group parameters (optional)
- * Fake endpoint to test group parameters (optional)
- * @param requiredStringGroup Required String in group parameters (required)
- * @param requiredBooleanGroup Required Boolean in group parameters (required)
- * @param requiredInt64Group Required Integer in group parameters (required)
- * @param stringGroup String in group parameters (optional)
- * @param booleanGroup Boolean in group parameters (optional)
- * @param int64Group Integer in group parameters (optional)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testGroupParametersRequestBuilder(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testGroupParameters", localVarResponse);
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ return localVarRequestBuilder;
+ }
+ /**
+ * Test serialization of outer string types
+ *
+ * @param body Input string as post body (optional)
+ * @return String
+ * @throws ApiException if fails to make API call
+ */
+ public String fakeOuterStringSerialize(String body) throws ApiException {
+ ApiResponse localVarResponse = fakeOuterStringSerializeWithHttpInfo(body);
+ return localVarResponse.getData();
+ }
+
+ /**
+ * Test serialization of outer string types
+ *
+ * @param body Input string as post body (optional)
+ * @return ApiResponse<String>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = fakeOuterStringSerializeRequestBuilder(body);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("fakeOuterStringSerialize", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testGroupParametersRequestBuilder(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
- // verify the required parameter 'requiredStringGroup' is set
- if (requiredStringGroup == null) {
- throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters");
- }
- // verify the required parameter 'requiredBooleanGroup' is set
- if (requiredBooleanGroup == null) {
- throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters");
- }
- // verify the required parameter 'requiredInt64Group' is set
- if (requiredInt64Group == null) {
- throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters");
}
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+ private HttpRequest.Builder fakeOuterStringSerializeRequestBuilder(String body)
+ throws ApiException {
- String localVarPath = "/fake";
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
- List localVarQueryParams = new ArrayList<>();
- StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
- String localVarQueryParameterBaseName;
- localVarQueryParameterBaseName = "required_string_group";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("required_string_group", requiredStringGroup));
- localVarQueryParameterBaseName = "required_int64_group";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("required_int64_group", requiredInt64Group));
- localVarQueryParameterBaseName = "string_group";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("string_group", stringGroup));
- localVarQueryParameterBaseName = "int64_group";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("int64_group", int64Group));
+ String localVarPath = "/fake/outer/string";
- if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
- StringJoiner queryJoiner = new StringJoiner("&");
- localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
- if (localVarQueryStringJoiner.length() != 0) {
- queryJoiner.add(localVarQueryStringJoiner.toString());
- }
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
- } else {
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- }
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
- if (requiredBooleanGroup != null) {
- localVarRequestBuilder.header("required_boolean_group", requiredBooleanGroup.toString());
- }
- if (booleanGroup != null) {
- localVarRequestBuilder.header("boolean_group", booleanGroup.toString());
- }
- localVarRequestBuilder.header("Accept", "application/json");
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "*/*");
- localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
-
- public static final class APItestGroupParametersRequest {
- private Integer requiredStringGroup; // Required String in group parameters (required)
- private Boolean requiredBooleanGroup; // Required Boolean in group parameters (required)
- private Long requiredInt64Group; // Required Integer in group parameters (required)
- private Integer stringGroup; // String in group parameters (optional)
- private Boolean booleanGroup; // Boolean in group parameters (optional)
- private Long int64Group; // Integer in group parameters (optional)
-
- private APItestGroupParametersRequest(Builder builder) {
- this.requiredStringGroup = builder.requiredStringGroup;
- this.requiredBooleanGroup = builder.requiredBooleanGroup;
- this.requiredInt64Group = builder.requiredInt64Group;
- this.stringGroup = builder.stringGroup;
- this.booleanGroup = builder.booleanGroup;
- this.int64Group = builder.int64Group;
- }
- public Integer requiredStringGroup() {
- return requiredStringGroup;
- }
- public Boolean requiredBooleanGroup() {
- return requiredBooleanGroup;
- }
- public Long requiredInt64Group() {
- return requiredInt64Group;
- }
- public Integer stringGroup() {
- return stringGroup;
- }
- public Boolean booleanGroup() {
- return booleanGroup;
- }
- public Long int64Group() {
- return int64Group;
- }
- public static Builder newBuilder() {
- return new Builder();
- }
-
- public static class Builder {
- private Integer requiredStringGroup;
- private Boolean requiredBooleanGroup;
- private Long requiredInt64Group;
- private Integer stringGroup;
- private Boolean booleanGroup;
- private Long int64Group;
-
- public Builder requiredStringGroup(Integer requiredStringGroup) {
- this.requiredStringGroup = requiredStringGroup;
- return this;
- }
- public Builder requiredBooleanGroup(Boolean requiredBooleanGroup) {
- this.requiredBooleanGroup = requiredBooleanGroup;
- return this;
- }
- public Builder requiredInt64Group(Long requiredInt64Group) {
- this.requiredInt64Group = requiredInt64Group;
- return this;
- }
- public Builder stringGroup(Integer stringGroup) {
- this.stringGroup = stringGroup;
- return this;
- }
- public Builder booleanGroup(Boolean booleanGroup) {
- this.booleanGroup = booleanGroup;
- return this;
- }
- public Builder int64Group(Long int64Group) {
- this.int64Group = int64Group;
- return this;
- }
- public APItestGroupParametersRequest build() {
- return new APItestGroupParametersRequest(this);
- }
- }
- }
-
- /**
- * test inline additionalProperties
- *
- * @param requestBody request body (required)
- * @throws ApiException if fails to make API call
- */
- public void testInlineAdditionalProperties(Map requestBody) throws ApiException {
- testInlineAdditionalPropertiesWithHttpInfo(requestBody);
- }
-
- /**
- * test inline additionalProperties
- *
- * @param requestBody request body (required)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map requestBody) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(requestBody);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testInlineAdditionalProperties", localVarResponse);
+ localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofString(body));
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
+ return localVarRequestBuilder;
}
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testInlineAdditionalPropertiesRequestBuilder(Map requestBody) throws ApiException {
- // verify the required parameter 'requestBody' is set
- if (requestBody == null) {
- throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties");
+ /**
+ * Array of Enums
+ *
+ * @return List<OuterEnum>
+ * @throws ApiException if fails to make API call
+ */
+ public List getArrayOfEnums() throws ApiException {
+ ApiResponse> localVarResponse = getArrayOfEnumsWithHttpInfo();
+ return localVarResponse.getData();
}
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/inline-additionalProperties";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Content-Type", "application/json");
- localVarRequestBuilder.header("Accept", "application/json");
-
- try {
- byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(requestBody);
- localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
- } catch (IOException e) {
- throw new ApiException(e);
- }
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- * test json serialization of form data
- *
- * @param param field1 (required)
- * @param param2 field2 (required)
- * @throws ApiException if fails to make API call
- */
- public void testJsonFormData(String param, String param2) throws ApiException {
- testJsonFormDataWithHttpInfo(param, param2);
- }
-
- /**
- * test json serialization of form data
- *
- * @param param field1 (required)
- * @param param2 field2 (required)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testJsonFormDataRequestBuilder(param, param2);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testJsonFormData", localVarResponse);
+ /**
+ * Array of Enums
+ *
+ * @return ApiResponse<List<OuterEnum>>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse> getArrayOfEnumsWithHttpInfo() throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = getArrayOfEnumsRequestBuilder();
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("getArrayOfEnums", localVarResponse);
+ }
+ return new ApiResponse>(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference<
+ List>() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ }
+
+ private HttpRequest.Builder getArrayOfEnumsRequestBuilder() throws ApiException {
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/fake/array-of-enums";
+
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testJsonFormDataRequestBuilder(String param, String param2) throws ApiException {
- // verify the required parameter 'param' is set
- if (param == null) {
- throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");
- }
- // verify the required parameter 'param2' is set
- if (param2 == null) {
- throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");
- }
-
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
-
- String localVarPath = "/fake/jsonFormData";
-
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
-
- localVarRequestBuilder.header("Accept", "application/json");
-
- List formValues = new ArrayList<>();
- formValues.add(new BasicNameValuePair("param", param.toString()));
- formValues.add(new BasicNameValuePair("param2", param2.toString()));
- HttpEntity entity = new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8);
- ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream();
- try {
- entity.writeTo(formOutputStream);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- localVarRequestBuilder
- .header("Content-Type", entity.getContentType().getValue())
- .method("GET", HttpRequest.BodyPublishers
- .ofInputStream(() -> new ByteArrayInputStream(formOutputStream.toByteArray())));
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
- }
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
- }
- return localVarRequestBuilder;
- }
- /**
- *
- * To test the collection format in query parameters
- * @param pipe (required)
- * @param ioutil (required)
- * @param http (required)
- * @param url (required)
- * @param context (required)
- * @throws ApiException if fails to make API call
- */
- public void testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) throws ApiException {
- testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context);
- }
-
- /**
- *
- * To test the collection format in query parameters
- * @param pipe (required)
- * @param ioutil (required)
- * @param http (required)
- * @param url (required)
- * @param context (required)
- * @return ApiResponse<Void>
- * @throws ApiException if fails to make API call
- */
- public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) throws ApiException {
- HttpRequest.Builder localVarRequestBuilder = testQueryParameterCollectionFormatRequestBuilder(pipe, ioutil, http, url, context);
- try {
- HttpResponse localVarResponse = memberVarHttpClient.send(
- localVarRequestBuilder.build(),
- HttpResponse.BodyHandlers.ofInputStream());
- if (memberVarResponseInterceptor != null) {
- memberVarResponseInterceptor.accept(localVarResponse);
- }
- try {
- if (localVarResponse.statusCode()/ 100 != 2) {
- throw getApiException("testQueryParameterCollectionFormat", localVarResponse);
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
}
- return new ApiResponse(
- localVarResponse.statusCode(),
- localVarResponse.headers().map(),
- null
- );
- } finally {
- // Drain the InputStream
- while (localVarResponse.body().read() != -1) {
- // Ignore
+ return localVarRequestBuilder;
+ }
+ /**
+ * For this test, the body for this request much reference a schema named `File`.
+ *
+ * @param fileSchemaTestClass (required)
+ * @throws ApiException if fails to make API call
+ */
+ public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass)
+ throws ApiException {
+ testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass);
+ }
+
+ /**
+ * For this test, the body for this request much reference a schema named `File`.
+ *
+ * @param fileSchemaTestClass (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse testBodyWithFileSchemaWithHttpInfo(
+ FileSchemaTestClass fileSchemaTestClass) throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder =
+ testBodyWithFileSchemaRequestBuilder(fileSchemaTestClass);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("testBodyWithFileSchema", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(), localVarResponse.headers().map(), null);
+ } finally {
+ // Drain the InputStream
+ while (localVarResponse.body().read() != -1) {
+ // Ignore
+ }
+ localVarResponse.body().close();
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
}
- localVarResponse.body().close();
- }
- } catch (IOException e) {
- throw new ApiException(e);
- }
- catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new ApiException(e);
- }
- }
-
- private HttpRequest.Builder testQueryParameterCollectionFormatRequestBuilder(List pipe, List ioutil, List http, List url, List context) throws ApiException {
- // verify the required parameter 'pipe' is set
- if (pipe == null) {
- throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat");
- }
- // verify the required parameter 'ioutil' is set
- if (ioutil == null) {
- throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat");
- }
- // verify the required parameter 'http' is set
- if (http == null) {
- throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat");
- }
- // verify the required parameter 'url' is set
- if (url == null) {
- throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat");
- }
- // verify the required parameter 'context' is set
- if (context == null) {
- throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat");
}
- HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+ private HttpRequest.Builder testBodyWithFileSchemaRequestBuilder(
+ FileSchemaTestClass fileSchemaTestClass) throws ApiException {
+ // verify the required parameter 'fileSchemaTestClass' is set
+ if (fileSchemaTestClass == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter 'fileSchemaTestClass' when calling"
+ + " testBodyWithFileSchema");
+ }
- String localVarPath = "/fake/test-query-parameters";
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
- List localVarQueryParams = new ArrayList<>();
- StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
- String localVarQueryParameterBaseName;
- localVarQueryParameterBaseName = "pipe";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "pipe", pipe));
- localVarQueryParameterBaseName = "ioutil";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "ioutil", ioutil));
- localVarQueryParameterBaseName = "http";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("ssv", "http", http));
- localVarQueryParameterBaseName = "url";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "url", url));
- localVarQueryParameterBaseName = "context";
- localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "context", context));
+ String localVarPath = "/fake/body-with-file-schema";
- if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
- StringJoiner queryJoiner = new StringJoiner("&");
- localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
- if (localVarQueryStringJoiner.length() != 0) {
- queryJoiner.add(localVarQueryStringJoiner.toString());
- }
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
- } else {
- localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(fileSchemaTestClass);
+ localVarRequestBuilder.method(
+ "PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
+ }
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
+ }
+ return localVarRequestBuilder;
+ }
+ /**
+ * @param query (required)
+ * @param user (required)
+ * @throws ApiException if fails to make API call
+ */
+ public void testBodyWithQueryParams(String query, User user) throws ApiException {
+ testBodyWithQueryParamsWithHttpInfo(query, user);
}
- localVarRequestBuilder.header("Accept", "application/json");
+ /**
+ * @param query (required)
+ * @param user (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User user)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder =
+ testBodyWithQueryParamsRequestBuilder(query, user);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("testBodyWithQueryParams", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(), localVarResponse.headers().map(), null);
+ } finally {
+ // Drain the InputStream
+ while (localVarResponse.body().read() != -1) {
+ // Ignore
+ }
+ localVarResponse.body().close();
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
+ }
+ }
- localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.noBody());
- if (memberVarReadTimeout != null) {
- localVarRequestBuilder.timeout(memberVarReadTimeout);
+ private HttpRequest.Builder testBodyWithQueryParamsRequestBuilder(String query, User user)
+ throws ApiException {
+ // verify the required parameter 'query' is set
+ if (query == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter 'query' when calling testBodyWithQueryParams");
+ }
+ // verify the required parameter 'user' is set
+ if (user == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter 'user' when calling testBodyWithQueryParams");
+ }
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/fake/body-with-query-params";
+
+ List localVarQueryParams = new ArrayList<>();
+ StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
+ String localVarQueryParameterBaseName;
+ localVarQueryParameterBaseName = "query";
+ localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query));
+
+ if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
+ StringJoiner queryJoiner = new StringJoiner("&");
+ localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
+ if (localVarQueryStringJoiner.length() != 0) {
+ queryJoiner.add(localVarQueryStringJoiner.toString());
+ }
+ localVarRequestBuilder.uri(
+ URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
+ } else {
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+ }
+
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user);
+ localVarRequestBuilder.method(
+ "PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
+ }
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
+ }
+ return localVarRequestBuilder;
}
- if (memberVarInterceptor != null) {
- memberVarInterceptor.accept(localVarRequestBuilder);
+ /**
+ * To test \"client\" model To test \"client\" model
+ *
+ * @param client client model (required)
+ * @return Client
+ * @throws ApiException if fails to make API call
+ */
+ public Client testClientModel(Client client) throws ApiException {
+ ApiResponse localVarResponse = testClientModelWithHttpInfo(client);
+ return localVarResponse.getData();
+ }
+
+ /**
+ * To test \"client\" model To test \"client\" model
+ *
+ * @param client client model (required)
+ * @return ApiResponse<Client>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse testClientModelWithHttpInfo(Client client) throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder = testClientModelRequestBuilder(client);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("testClientModel", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(),
+ localVarResponse.headers().map(),
+ localVarResponse.body() == null
+ ? null
+ : memberVarObjectMapper.readValue(
+ localVarResponse.body(),
+ new TypeReference() {}) // closes the InputStream
+ );
+ } finally {
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
+ }
+ }
+
+ private HttpRequest.Builder testClientModelRequestBuilder(Client client) throws ApiException {
+ // verify the required parameter 'client' is set
+ if (client == null) {
+ throw new ApiException(
+ 400, "Missing the required parameter 'client' when calling testClientModel");
+ }
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/fake";
+
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Content-Type", "application/json");
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ try {
+ byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(client);
+ localVarRequestBuilder.method(
+ "PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
+ } catch (IOException e) {
+ throw new ApiException(e);
+ }
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
+ }
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
+ }
+ return localVarRequestBuilder;
+ }
+ /**
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for
+ * testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ *
+ * @param number None (required)
+ * @param _double None (required)
+ * @param patternWithoutDelimiter None (required)
+ * @param _byte None (required)
+ * @param integer None (optional)
+ * @param int32 None (optional)
+ * @param int64 None (optional)
+ * @param _float None (optional)
+ * @param string None (optional)
+ * @param binary None (optional)
+ * @param date None (optional)
+ * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
+ * @param password None (optional)
+ * @param paramCallback None (optional)
+ * @throws ApiException if fails to make API call
+ */
+ public void testEndpointParameters(
+ BigDecimal number,
+ Double _double,
+ String patternWithoutDelimiter,
+ byte[] _byte,
+ Integer integer,
+ Integer int32,
+ Long int64,
+ Float _float,
+ String string,
+ File binary,
+ LocalDate date,
+ OffsetDateTime dateTime,
+ String password,
+ String paramCallback)
+ throws ApiException {
+ testEndpointParametersWithHttpInfo(
+ number,
+ _double,
+ patternWithoutDelimiter,
+ _byte,
+ integer,
+ int32,
+ int64,
+ _float,
+ string,
+ binary,
+ date,
+ dateTime,
+ password,
+ paramCallback);
+ }
+
+ /**
+ * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for
+ * testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ *
+ * @param number None (required)
+ * @param _double None (required)
+ * @param patternWithoutDelimiter None (required)
+ * @param _byte None (required)
+ * @param integer None (optional)
+ * @param int32 None (optional)
+ * @param int64 None (optional)
+ * @param _float None (optional)
+ * @param string None (optional)
+ * @param binary None (optional)
+ * @param date None (optional)
+ * @param dateTime None (optional, default to 2010-02-01T10:20:10.111110+01:00)
+ * @param password None (optional)
+ * @param paramCallback None (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse testEndpointParametersWithHttpInfo(
+ BigDecimal number,
+ Double _double,
+ String patternWithoutDelimiter,
+ byte[] _byte,
+ Integer integer,
+ Integer int32,
+ Long int64,
+ Float _float,
+ String string,
+ File binary,
+ LocalDate date,
+ OffsetDateTime dateTime,
+ String password,
+ String paramCallback)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder =
+ testEndpointParametersRequestBuilder(
+ number,
+ _double,
+ patternWithoutDelimiter,
+ _byte,
+ integer,
+ int32,
+ int64,
+ _float,
+ string,
+ binary,
+ date,
+ dateTime,
+ password,
+ paramCallback);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("testEndpointParameters", localVarResponse);
+ }
+ return new ApiResponse(
+ localVarResponse.statusCode(), localVarResponse.headers().map(), null);
+ } finally {
+ // Drain the InputStream
+ while (localVarResponse.body().read() != -1) {
+ // Ignore
+ }
+ localVarResponse.body().close();
+ }
+ } catch (IOException e) {
+ throw new ApiException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new ApiException(e);
+ }
+ }
+
+ private HttpRequest.Builder testEndpointParametersRequestBuilder(
+ BigDecimal number,
+ Double _double,
+ String patternWithoutDelimiter,
+ byte[] _byte,
+ Integer integer,
+ Integer int32,
+ Long int64,
+ Float _float,
+ String string,
+ File binary,
+ LocalDate date,
+ OffsetDateTime dateTime,
+ String password,
+ String paramCallback)
+ throws ApiException {
+ // verify the required parameter 'number' is set
+ if (number == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter 'number' when calling testEndpointParameters");
+ }
+ // verify the required parameter '_double' is set
+ if (_double == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter '_double' when calling testEndpointParameters");
+ }
+ // verify the required parameter 'patternWithoutDelimiter' is set
+ if (patternWithoutDelimiter == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter 'patternWithoutDelimiter' when calling"
+ + " testEndpointParameters");
+ }
+ // verify the required parameter '_byte' is set
+ if (_byte == null) {
+ throw new ApiException(
+ 400,
+ "Missing the required parameter '_byte' when calling testEndpointParameters");
+ }
+
+ HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
+
+ String localVarPath = "/fake";
+
+ localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
+
+ localVarRequestBuilder.header("Accept", "application/json");
+
+ List formValues = new ArrayList<>();
+ formValues.add(new BasicNameValuePair("integer", integer.toString()));
+ formValues.add(new BasicNameValuePair("int32", int32.toString()));
+ formValues.add(new BasicNameValuePair("int64", int64.toString()));
+ formValues.add(new BasicNameValuePair("number", number.toString()));
+ formValues.add(new BasicNameValuePair("float", _float.toString()));
+ formValues.add(new BasicNameValuePair("double", _double.toString()));
+ formValues.add(new BasicNameValuePair("string", string.toString()));
+ formValues.add(
+ new BasicNameValuePair(
+ "pattern_without_delimiter", patternWithoutDelimiter.toString()));
+ formValues.add(new BasicNameValuePair("byte", _byte.toString()));
+ formValues.add(new BasicNameValuePair("binary", binary.toString()));
+ formValues.add(new BasicNameValuePair("date", date.toString()));
+ formValues.add(new BasicNameValuePair("dateTime", dateTime.toString()));
+ formValues.add(new BasicNameValuePair("password", password.toString()));
+ formValues.add(new BasicNameValuePair("callback", paramCallback.toString()));
+ HttpEntity entity =
+ new UrlEncodedFormEntity(formValues, java.nio.charset.StandardCharsets.UTF_8);
+ ByteArrayOutputStream formOutputStream = new ByteArrayOutputStream();
+ try {
+ entity.writeTo(formOutputStream);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ localVarRequestBuilder
+ .header("Content-Type", entity.getContentType().getValue())
+ .method(
+ "POST",
+ HttpRequest.BodyPublishers.ofInputStream(
+ () -> new ByteArrayInputStream(formOutputStream.toByteArray())));
+ if (memberVarReadTimeout != null) {
+ localVarRequestBuilder.timeout(memberVarReadTimeout);
+ }
+ if (memberVarInterceptor != null) {
+ memberVarInterceptor.accept(localVarRequestBuilder);
+ }
+ return localVarRequestBuilder;
+ }
+ /**
+ * To test enum parameters To test enum parameters
+ *
+ * @param enumHeaderStringArray Header parameter enum test (string array) (optional
+ * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryStringArray Query parameter enum test (string array) (optional
+ * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryInteger Query parameter enum test (double) (optional)
+ * @param enumQueryDouble Query parameter enum test (double) (optional)
+ * @param enumFormStringArray Form parameter enum test (string array) (optional
+ * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
+ * @throws ApiException if fails to make API call
+ */
+ public void testEnumParameters(
+ List enumHeaderStringArray,
+ String enumHeaderString,
+ List enumQueryStringArray,
+ String enumQueryString,
+ Integer enumQueryInteger,
+ Double enumQueryDouble,
+ List enumFormStringArray,
+ String enumFormString)
+ throws ApiException {
+ testEnumParametersWithHttpInfo(
+ enumHeaderStringArray,
+ enumHeaderString,
+ enumQueryStringArray,
+ enumQueryString,
+ enumQueryInteger,
+ enumQueryDouble,
+ enumFormStringArray,
+ enumFormString);
+ }
+
+ /**
+ * To test enum parameters To test enum parameters
+ *
+ * @param enumHeaderStringArray Header parameter enum test (string array) (optional
+ * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryStringArray Query parameter enum test (string array) (optional
+ * @param enumQueryString Query parameter enum test (string) (optional, default to -efg)
+ * @param enumQueryInteger Query parameter enum test (double) (optional)
+ * @param enumQueryDouble Query parameter enum test (double) (optional)
+ * @param enumFormStringArray Form parameter enum test (string array) (optional
+ * @param enumFormString Form parameter enum test (string) (optional, default to -efg)
+ * @return ApiResponse<Void>
+ * @throws ApiException if fails to make API call
+ */
+ public ApiResponse testEnumParametersWithHttpInfo(
+ List enumHeaderStringArray,
+ String enumHeaderString,
+ List enumQueryStringArray,
+ String enumQueryString,
+ Integer enumQueryInteger,
+ Double enumQueryDouble,
+ List enumFormStringArray,
+ String enumFormString)
+ throws ApiException {
+ HttpRequest.Builder localVarRequestBuilder =
+ testEnumParametersRequestBuilder(
+ enumHeaderStringArray,
+ enumHeaderString,
+ enumQueryStringArray,
+ enumQueryString,
+ enumQueryInteger,
+ enumQueryDouble,
+ enumFormStringArray,
+ enumFormString);
+ try {
+ HttpResponse localVarResponse =
+ memberVarHttpClient.send(
+ localVarRequestBuilder.build(),
+ HttpResponse.BodyHandlers.ofInputStream());
+ if (memberVarResponseInterceptor != null) {
+ memberVarResponseInterceptor.accept(localVarResponse);
+ }
+ try {
+ if (localVarResponse.statusCode() / 100 != 2) {
+ throw getApiException("testEnumParameters", localVarResponse);
+ }
+ return new ApiResponse