[Java][native] Add ability to add header to specific calls (#21495)

* add bearer capability

* avoid using shared state

* revert needless change

* Revert authentication changes from unused root Java/api.mustache template

* applied change to correct lib type

* updated test files

* made security method more generic for flexibility

* regenerated samples

* further cleanup

* code style

* regenerated samples

* made header assignment more explicit, per each method

* fixed extra comma

* fixed commas, regenerated samples

* moved header population to utility method

* moved static class inside main class

* regenerated samples

* added comments, fixed indentation

* regenerated samples

---------

Co-authored-by: Ilya Nemtsev <ilyanemtsev@192.168.1.34>
This commit is contained in:
Ilya Nemtsev
2025-07-27 10:18:39 +07:00
committed by GitHub
parent f1a093537d
commit ef22749345
256 changed files with 52032 additions and 416 deletions

View File

@@ -57,6 +57,26 @@ import java.util.concurrent.CompletableFuture;
{{#operations}} {{#operations}}
public class {{classname}} { public class {{classname}} {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -78,6 +98,7 @@ public class {{classname}} {
memberVarResponseInterceptor = apiClient.getResponseInterceptor(); memberVarResponseInterceptor = apiClient.getResponseInterceptor();
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
{{#asyncNative}} {{#asyncNative}}
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
@@ -177,11 +198,40 @@ public class {{classname}} {
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException {
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}(apiRequest, null);
}
/**
* {{summary}}
* {{notes}}
* @param apiRequest {@link API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request}
* @param headers Optional headers to include in the request
{{#returnType}}
* @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}{{returnType}}{{#asyncNative}}&gt;{{/asyncNative}}
{{/returnType}}
{{^returnType}}
{{#asyncNative}}
* @return CompletableFuture&lt;Void&gt;
{{/asyncNative}}
{{/returnType}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest, Map<String, String> headers) throws ApiException {
{{#allParams}} {{#allParams}}
{{>nullable_var_annotations}}{{! prevent indent}} {{>nullable_var_annotations}}{{! prevent indent}}
{{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); {{{dataType}}} {{paramName}} = apiRequest.{{paramName}}();
{{/allParams}} {{/allParams}}
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
} }
/** /**
@@ -202,10 +252,32 @@ public class {{classname}} {
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException { public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest) throws ApiException {
return {{operationId}}WithHttpInfo(apiRequest, null);
}
/**
* {{summary}}
* {{notes}}
* @param apiRequest {@link API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request}
* @param headers Optional headers to include in the request
* @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}ApiResponse&lt;{{returnType}}{{^returnType}}Void{{/returnType}}&gt;{{#asyncNative}}&gt;{{/asyncNative}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo(API{{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request apiRequest, Map<String, String> headers) throws ApiException {
{{#allParams}} {{#allParams}}
{{{dataType}}} {{paramName}} = apiRequest.{{paramName}}(); {{{dataType}}} {{paramName}} = apiRequest.{{paramName}}();
{{/allParams}} {{/allParams}}
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
} }
{{/hasParams}} {{/hasParams}}
@@ -237,15 +309,46 @@ public class {{classname}} {
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
{{#returnType}}return {{/returnType}}{{^returnType}}{{#asyncNative}}return {{/asyncNative}}{{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}null);
}
/**
* {{summary}}
* {{notes}}
{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
{{/allParams}}
* @param headers Optional headers to include in the request
{{#returnType}}
* @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}{{returnType}}{{#asyncNative}}&gt;{{/asyncNative}}
{{/returnType}}
{{^returnType}}
{{#asyncNative}}
* @return CompletableFuture&lt;Void&gt;
{{/asyncNative}}
{{/returnType}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}}({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Map<String, String> headers) throws ApiException {
{{^asyncNative}} {{^asyncNative}}
{{#returnType}}ApiResponse<{{{.}}}> localVarResponse = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#returnType}}ApiResponse<{{{.}}}> localVarResponse = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
{{#returnType}} {{#returnType}}
return localVarResponse.getData(); return localVarResponse.getData();
{{/returnType}} {{/returnType}}
{{/asyncNative}} {{/asyncNative}}
{{#asyncNative}} {{#asyncNative}}
try { try {
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -293,8 +396,32 @@ public class {{classname}} {
@Deprecated @Deprecated
{{/isDeprecated}} {{/isDeprecated}}
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}null);
}
/**
* {{summary}}
* {{notes}}
{{#allParams}}
* @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
{{/allParams}}
* @param headers Optional headers to include in the request
* @return {{#asyncNative}}CompletableFuture&lt;{{/asyncNative}}ApiResponse&lt;{{returnType}}{{^returnType}}Void{{/returnType}}&gt;{{#asyncNative}}&gt;{{/asyncNative}}
* @throws ApiException if fails to make API call
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
{{#externalDocs}}
* {{description}}
* @see <a href="{{url}}">{{summary}} Documentation</a>
{{/externalDocs}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public {{#asyncNative}}CompletableFuture<{{/asyncNative}}ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>{{#asyncNative}}>{{/asyncNative}} {{operationId}}WithHttpInfo({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Map<String, String> headers) throws ApiException {
{{^asyncNative}} {{^asyncNative}}
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -386,7 +513,7 @@ public class {{classname}} {
{{/asyncNative}} {{/asyncNative}}
{{#asyncNative}} {{#asyncNative}}
try { try {
HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); HttpRequest.Builder localVarRequestBuilder = {{operationId}}RequestBuilder({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -423,7 +550,7 @@ public class {{classname}} {
{{/asyncNative}} {{/asyncNative}}
} }
private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { private HttpRequest.Builder {{operationId}}RequestBuilder({{#allParams}}{{>nullable_var_annotations}} {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#hasParams}}, {{/hasParams}}Map<String, String> headers) throws ApiException {
{{#allParams}} {{#allParams}}
{{#required}} {{#required}}
// verify the required parameter '{{paramName}}' is set // verify the required parameter '{{paramName}}' is set
@@ -628,6 +755,8 @@ public class {{classname}} {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -46,6 +46,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class AuthApi { public class AuthApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -68,6 +88,7 @@ public class AuthApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -136,7 +157,18 @@ public class AuthApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testAuthHttpBasic() throws ApiException { public String testAuthHttpBasic() throws ApiException {
ApiResponse<String> localVarResponse = testAuthHttpBasicWithHttpInfo(); return testAuthHttpBasic(null);
}
/**
* To test HTTP basic authentication
* To test HTTP basic authentication
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testAuthHttpBasic(Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testAuthHttpBasicWithHttpInfo(headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -147,7 +179,18 @@ public class AuthApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testAuthHttpBasicWithHttpInfo() throws ApiException { public ApiResponse<String> testAuthHttpBasicWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBasicRequestBuilder(); return testAuthHttpBasicWithHttpInfo(null);
}
/**
* To test HTTP basic authentication
* To test HTTP basic authentication
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testAuthHttpBasicWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBasicRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -183,7 +226,7 @@ public class AuthApi {
} }
} }
private HttpRequest.Builder testAuthHttpBasicRequestBuilder() throws ApiException { private HttpRequest.Builder testAuthHttpBasicRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -197,6 +240,8 @@ public class AuthApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -210,7 +255,18 @@ public class AuthApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testAuthHttpBearer() throws ApiException { public String testAuthHttpBearer() throws ApiException {
ApiResponse<String> localVarResponse = testAuthHttpBearerWithHttpInfo(); return testAuthHttpBearer(null);
}
/**
* To test HTTP bearer authentication
* To test HTTP bearer authentication
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testAuthHttpBearer(Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testAuthHttpBearerWithHttpInfo(headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -221,7 +277,18 @@ public class AuthApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testAuthHttpBearerWithHttpInfo() throws ApiException { public ApiResponse<String> testAuthHttpBearerWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBearerRequestBuilder(); return testAuthHttpBearerWithHttpInfo(null);
}
/**
* To test HTTP bearer authentication
* To test HTTP bearer authentication
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testAuthHttpBearerWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testAuthHttpBearerRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -257,7 +324,7 @@ public class AuthApi {
} }
} }
private HttpRequest.Builder testAuthHttpBearerRequestBuilder() throws ApiException { private HttpRequest.Builder testAuthHttpBearerRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -271,6 +338,8 @@ public class AuthApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -56,6 +56,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class BodyApi { public class BodyApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -78,6 +98,7 @@ public class BodyApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -146,7 +167,18 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public File testBinaryGif() throws ApiException { public File testBinaryGif() throws ApiException {
ApiResponse<File> localVarResponse = testBinaryGifWithHttpInfo(); return testBinaryGif(null);
}
/**
* Test binary (gif) response body
* Test binary (gif) response body
* @param headers Optional headers to include in the request
* @return File
* @throws ApiException if fails to make API call
*/
public File testBinaryGif(Map<String, String> headers) throws ApiException {
ApiResponse<File> localVarResponse = testBinaryGifWithHttpInfo(headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -157,7 +189,18 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<File> testBinaryGifWithHttpInfo() throws ApiException { public ApiResponse<File> testBinaryGifWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBinaryGifRequestBuilder(); return testBinaryGifWithHttpInfo(null);
}
/**
* Test binary (gif) response body
* Test binary (gif) response body
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;File&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<File> testBinaryGifWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBinaryGifRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -199,7 +242,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testBinaryGifRequestBuilder() throws ApiException { private HttpRequest.Builder testBinaryGifRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -213,6 +256,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -227,7 +272,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body) throws ApiException { public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body) throws ApiException {
ApiResponse<String> localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body); return testBodyApplicationOctetstreamBinary(body, null);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param body (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testBodyApplicationOctetstreamBinaryWithHttpInfo(body, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -239,7 +296,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(@javax.annotation.Nullable File body) throws ApiException { public ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(@javax.annotation.Nullable File body) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBodyApplicationOctetstreamBinaryRequestBuilder(body); return testBodyApplicationOctetstreamBinaryWithHttpInfo(body, null);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param body (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testBodyApplicationOctetstreamBinaryWithHttpInfo(@javax.annotation.Nullable File body, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBodyApplicationOctetstreamBinaryRequestBuilder(body, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -275,7 +344,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@javax.annotation.Nullable File body) throws ApiException { private HttpRequest.Builder testBodyApplicationOctetstreamBinaryRequestBuilder(@javax.annotation.Nullable File body, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -295,6 +364,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -309,7 +380,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List<File> files) throws ApiException { public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List<File> files) throws ApiException {
ApiResponse<String> localVarResponse = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files); return testBodyMultipartFormdataArrayOfBinary(files, null);
}
/**
* Test array of binary in multipart mime
* Test array of binary in multipart mime
* @param files (required)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List<File> files, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -321,7 +404,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@javax.annotation.Nonnull List<File> files) throws ApiException { public ApiResponse<String> testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@javax.annotation.Nonnull List<File> files) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataArrayOfBinaryRequestBuilder(files); return testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, null);
}
/**
* Test array of binary in multipart mime
* Test array of binary in multipart mime
* @param files (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(@javax.annotation.Nonnull List<File> files, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataArrayOfBinaryRequestBuilder(files, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -357,7 +452,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder(@javax.annotation.Nonnull List<File> files) throws ApiException { private HttpRequest.Builder testBodyMultipartFormdataArrayOfBinaryRequestBuilder(@javax.annotation.Nonnull List<File> files, Map<String, String> headers) throws ApiException {
// verify the required parameter 'files' is set // verify the required parameter 'files' is set
if (files == null) { if (files == null) {
throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary"); throw new ApiException(400, "Missing the required parameter 'files' when calling testBodyMultipartFormdataArrayOfBinary");
@@ -410,6 +505,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -424,7 +521,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile) throws ApiException { public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile) throws ApiException {
ApiResponse<String> localVarResponse = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile); return testBodyMultipartFormdataSingleBinary(myFile, null);
}
/**
* Test single binary in multipart mime
* Test single binary in multipart mime
* @param myFile (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -436,7 +545,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testBodyMultipartFormdataSingleBinaryWithHttpInfo(@javax.annotation.Nullable File myFile) throws ApiException { public ApiResponse<String> testBodyMultipartFormdataSingleBinaryWithHttpInfo(@javax.annotation.Nullable File myFile) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataSingleBinaryRequestBuilder(myFile); return testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile, null);
}
/**
* Test single binary in multipart mime
* Test single binary in multipart mime
* @param myFile (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testBodyMultipartFormdataSingleBinaryWithHttpInfo(@javax.annotation.Nullable File myFile, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testBodyMultipartFormdataSingleBinaryRequestBuilder(myFile, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -472,7 +593,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder(@javax.annotation.Nullable File myFile) throws ApiException { private HttpRequest.Builder testBodyMultipartFormdataSingleBinaryRequestBuilder(@javax.annotation.Nullable File myFile, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -519,6 +640,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -533,7 +656,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet) throws ApiException { public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet) throws ApiException {
ApiResponse<Pet> localVarResponse = testEchoBodyAllOfPetWithHttpInfo(pet); return testEchoBodyAllOfPet(pet, null);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @param headers Optional headers to include in the request
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
ApiResponse<Pet> localVarResponse = testEchoBodyAllOfPetWithHttpInfo(pet, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -545,7 +680,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Pet> testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { public ApiResponse<Pet> testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyAllOfPetRequestBuilder(pet); return testEchoBodyAllOfPetWithHttpInfo(pet, null);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Pet> testEchoBodyAllOfPetWithHttpInfo(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyAllOfPetRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -588,7 +735,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation.Nullable Pet pet) throws ApiException { private HttpRequest.Builder testEchoBodyAllOfPetRequestBuilder(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -608,6 +755,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -622,7 +771,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body) throws ApiException { public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body) throws ApiException {
ApiResponse<String> localVarResponse = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body); return testEchoBodyFreeFormObjectResponseString(body, null);
}
/**
* Test free form object
* Test free form object
* @param body Free form object (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -634,7 +795,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testEchoBodyFreeFormObjectResponseStringWithHttpInfo(@javax.annotation.Nullable Object body) throws ApiException { public ApiResponse<String> testEchoBodyFreeFormObjectResponseStringWithHttpInfo(@javax.annotation.Nullable Object body) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyFreeFormObjectResponseStringRequestBuilder(body); return testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, null);
}
/**
* Test free form object
* Test free form object
* @param body Free form object (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testEchoBodyFreeFormObjectResponseStringWithHttpInfo(@javax.annotation.Nullable Object body, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyFreeFormObjectResponseStringRequestBuilder(body, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -670,7 +843,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuilder(@javax.annotation.Nullable Object body) throws ApiException { private HttpRequest.Builder testEchoBodyFreeFormObjectResponseStringRequestBuilder(@javax.annotation.Nullable Object body, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -690,6 +863,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -704,7 +879,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet) throws ApiException { public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet) throws ApiException {
ApiResponse<Pet> localVarResponse = testEchoBodyPetWithHttpInfo(pet); return testEchoBodyPet(pet, null);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @param headers Optional headers to include in the request
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
ApiResponse<Pet> localVarResponse = testEchoBodyPetWithHttpInfo(pet, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -716,7 +903,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Pet> testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { public ApiResponse<Pet> testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetRequestBuilder(pet); return testEchoBodyPetWithHttpInfo(pet, null);
}
/**
* Test body parameter(s)
* Test body parameter(s)
* @param pet Pet object that needs to be added to the store (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Pet> testEchoBodyPetWithHttpInfo(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -759,7 +958,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Nullable Pet pet) throws ApiException { private HttpRequest.Builder testEchoBodyPetRequestBuilder(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -779,6 +978,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -793,7 +994,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet) throws ApiException { public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet) throws ApiException {
ApiResponse<String> localVarResponse = testEchoBodyPetResponseStringWithHttpInfo(pet); return testEchoBodyPetResponseString(pet, null);
}
/**
* Test empty response body
* Test empty response body
* @param pet Pet object that needs to be added to the store (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testEchoBodyPetResponseStringWithHttpInfo(pet, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -805,7 +1018,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testEchoBodyPetResponseStringWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException { public ApiResponse<String> testEchoBodyPetResponseStringWithHttpInfo(@javax.annotation.Nullable Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetResponseStringRequestBuilder(pet); return testEchoBodyPetResponseStringWithHttpInfo(pet, null);
}
/**
* Test empty response body
* Test empty response body
* @param pet Pet object that needs to be added to the store (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testEchoBodyPetResponseStringWithHttpInfo(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetResponseStringRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -841,7 +1066,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.annotation.Nullable Pet pet) throws ApiException { private HttpRequest.Builder testEchoBodyPetResponseStringRequestBuilder(@javax.annotation.Nullable Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -861,6 +1086,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -875,7 +1102,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body) throws ApiException { public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body) throws ApiException {
ApiResponse<StringEnumRef> localVarResponse = testEchoBodyStringEnumWithHttpInfo(body); return testEchoBodyStringEnum(body, null);
}
/**
* Test string enum response body
* Test string enum response body
* @param body String enum (optional)
* @param headers Optional headers to include in the request
* @return StringEnumRef
* @throws ApiException if fails to make API call
*/
public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body, Map<String, String> headers) throws ApiException {
ApiResponse<StringEnumRef> localVarResponse = testEchoBodyStringEnumWithHttpInfo(body, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -887,7 +1126,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<StringEnumRef> testEchoBodyStringEnumWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException { public ApiResponse<StringEnumRef> testEchoBodyStringEnumWithHttpInfo(@javax.annotation.Nullable String body) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyStringEnumRequestBuilder(body); return testEchoBodyStringEnumWithHttpInfo(body, null);
}
/**
* Test string enum response body
* Test string enum response body
* @param body String enum (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;StringEnumRef&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<StringEnumRef> testEchoBodyStringEnumWithHttpInfo(@javax.annotation.Nullable String body, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyStringEnumRequestBuilder(body, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -930,7 +1181,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotation.Nullable String body) throws ApiException { private HttpRequest.Builder testEchoBodyStringEnumRequestBuilder(@javax.annotation.Nullable String body, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -950,6 +1201,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -964,7 +1217,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag) throws ApiException { public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag) throws ApiException {
ApiResponse<String> localVarResponse = testEchoBodyTagResponseStringWithHttpInfo(tag); return testEchoBodyTagResponseString(tag, null);
}
/**
* Test empty json (request body)
* Test empty json (request body)
* @param tag Tag object (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testEchoBodyTagResponseStringWithHttpInfo(tag, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -976,7 +1241,19 @@ public class BodyApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testEchoBodyTagResponseStringWithHttpInfo(@javax.annotation.Nullable Tag tag) throws ApiException { public ApiResponse<String> testEchoBodyTagResponseStringWithHttpInfo(@javax.annotation.Nullable Tag tag) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyTagResponseStringRequestBuilder(tag); return testEchoBodyTagResponseStringWithHttpInfo(tag, null);
}
/**
* Test empty json (request body)
* Test empty json (request body)
* @param tag Tag object (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testEchoBodyTagResponseStringWithHttpInfo(@javax.annotation.Nullable Tag tag, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEchoBodyTagResponseStringRequestBuilder(tag, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -1012,7 +1289,7 @@ public class BodyApi {
} }
} }
private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.annotation.Nullable Tag tag) throws ApiException { private HttpRequest.Builder testEchoBodyTagResponseStringRequestBuilder(@javax.annotation.Nullable Tag tag, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -1032,6 +1309,8 @@ public class BodyApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -53,6 +53,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class FormApi { public class FormApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -75,6 +95,7 @@ public class FormApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -146,7 +167,21 @@ public class FormApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException {
ApiResponse<String> localVarResponse = testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm); return testFormIntegerBooleanString(integerForm, booleanForm, stringForm, null);
}
/**
* Test form parameter(s)
* Test form parameter(s)
* @param integerForm (optional)
* @param booleanForm (optional)
* @param stringForm (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -160,7 +195,21 @@ public class FormApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testFormIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { public ApiResponse<String> testFormIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormIntegerBooleanStringRequestBuilder(integerForm, booleanForm, stringForm); return testFormIntegerBooleanStringWithHttpInfo(integerForm, booleanForm, stringForm, null);
}
/**
* Test form parameter(s)
* Test form parameter(s)
* @param integerForm (optional)
* @param booleanForm (optional)
* @param stringForm (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testFormIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormIntegerBooleanStringRequestBuilder(integerForm, booleanForm, stringForm, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -196,7 +245,7 @@ public class FormApi {
} }
} }
private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException { private HttpRequest.Builder testFormIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -230,6 +279,8 @@ public class FormApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -244,7 +295,19 @@ public class FormApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException {
ApiResponse<String> localVarResponse = testFormObjectMultipartWithHttpInfo(marker); return testFormObjectMultipart(marker, null);
}
/**
* Test form parameter(s) for multipart schema
* Test form parameter(s) for multipart schema
* @param marker (required)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testFormObjectMultipartWithHttpInfo(marker, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -256,7 +319,19 @@ public class FormApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testFormObjectMultipartWithHttpInfo(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { public ApiResponse<String> testFormObjectMultipartWithHttpInfo(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormObjectMultipartRequestBuilder(marker); return testFormObjectMultipartWithHttpInfo(marker, null);
}
/**
* Test form parameter(s) for multipart schema
* Test form parameter(s) for multipart schema
* @param marker (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testFormObjectMultipartWithHttpInfo(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormObjectMultipartRequestBuilder(marker, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -292,7 +367,7 @@ public class FormApi {
} }
} }
private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException { private HttpRequest.Builder testFormObjectMultipartRequestBuilder(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map<String, String> headers) throws ApiException {
// verify the required parameter 'marker' is set // verify the required parameter 'marker' is set
if (marker == null) { if (marker == null) {
throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart"); throw new ApiException(400, "Missing the required parameter 'marker' when calling testFormObjectMultipart");
@@ -344,6 +419,8 @@ public class FormApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -363,7 +440,24 @@ public class FormApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException {
ApiResponse<String> localVarResponse = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name); return testFormOneof(form1, form2, form3, form4, id, name, null);
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -380,7 +474,24 @@ public class FormApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testFormOneofWithHttpInfo(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { public ApiResponse<String> testFormOneofWithHttpInfo(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormOneofRequestBuilder(form1, form2, form3, form4, id, name); return testFormOneofWithHttpInfo(form1, form2, form3, form4, id, name, null);
}
/**
* Test form parameter(s) for oneOf schema
* Test form parameter(s) for oneOf schema
* @param form1 (optional)
* @param form2 (optional)
* @param form3 (optional)
* @param form4 (optional)
* @param id (optional)
* @param name (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testFormOneofWithHttpInfo(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testFormOneofRequestBuilder(form1, form2, form3, form4, id, name, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -416,7 +527,7 @@ public class FormApi {
} }
} }
private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException { private HttpRequest.Builder testFormOneofRequestBuilder(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -459,6 +570,8 @@ public class FormApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -53,6 +53,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class HeaderApi { public class HeaderApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -75,6 +95,7 @@ public class HeaderApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -148,7 +169,23 @@ public class HeaderApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException {
ApiResponse<String> localVarResponse = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); return testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, null);
}
/**
* Test header parameter(s)
* Test header parameter(s)
* @param integerHeader (optional)
* @param booleanHeader (optional)
* @param stringHeader (optional)
* @param enumNonrefStringHeader (optional)
* @param enumRefStringHeader (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -164,7 +201,23 @@ public class HeaderApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testHeaderIntegerBooleanStringEnumsWithHttpInfo(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { public ApiResponse<String> testHeaderIntegerBooleanStringEnumsWithHttpInfo(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testHeaderIntegerBooleanStringEnumsRequestBuilder(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); return testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, null);
}
/**
* Test header parameter(s)
* Test header parameter(s)
* @param integerHeader (optional)
* @param booleanHeader (optional)
* @param stringHeader (optional)
* @param enumNonrefStringHeader (optional)
* @param enumRefStringHeader (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testHeaderIntegerBooleanStringEnumsWithHttpInfo(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testHeaderIntegerBooleanStringEnumsRequestBuilder(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -200,7 +253,7 @@ public class HeaderApi {
} }
} }
private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException { private HttpRequest.Builder testHeaderIntegerBooleanStringEnumsRequestBuilder(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -229,6 +282,8 @@ public class HeaderApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -53,6 +53,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class PathApi { public class PathApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -75,6 +95,7 @@ public class PathApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -147,7 +168,22 @@ public class PathApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException {
ApiResponse<String> localVarResponse = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, null);
}
/**
* Test path parameter(s)
* Test path parameter(s)
* @param pathString (required)
* @param pathInteger (required)
* @param enumNonrefStringPath (required)
* @param enumRefStringPath (required)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -162,7 +198,22 @@ public class PathApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { public ApiResponse<String> testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); return testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, null);
}
/**
* Test path parameter(s)
* Test path parameter(s)
* @param pathString (required)
* @param pathInteger (required)
* @param enumNonrefStringPath (required)
* @param enumRefStringPath (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -198,7 +249,7 @@ public class PathApi {
} }
} }
private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException { private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestBuilder(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pathString' is set // verify the required parameter 'pathString' is set
if (pathString == null) { if (pathString == null) {
throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"); throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath");
@@ -232,6 +283,8 @@ public class PathApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -59,6 +59,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class QueryApi { public class QueryApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -81,6 +101,7 @@ public class QueryApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -151,7 +172,20 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException {
ApiResponse<String> localVarResponse = testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery); return testEnumRefString(enumNonrefStringQuery, enumRefStringQuery, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param enumNonrefStringQuery (optional)
* @param enumRefStringQuery (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testEnumRefString(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -164,7 +198,20 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testEnumRefStringWithHttpInfo(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { public ApiResponse<String> testEnumRefStringWithHttpInfo(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEnumRefStringRequestBuilder(enumNonrefStringQuery, enumRefStringQuery); return testEnumRefStringWithHttpInfo(enumNonrefStringQuery, enumRefStringQuery, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param enumNonrefStringQuery (optional)
* @param enumRefStringQuery (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testEnumRefStringWithHttpInfo(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testEnumRefStringRequestBuilder(enumNonrefStringQuery, enumRefStringQuery, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -200,7 +247,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery) throws ApiException { private HttpRequest.Builder testEnumRefStringRequestBuilder(@javax.annotation.Nullable String enumNonrefStringQuery, @javax.annotation.Nullable StringEnumRef enumRefStringQuery, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -231,6 +278,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -247,7 +296,21 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryDatetimeDateString(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { public String testQueryDatetimeDateString(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException {
ApiResponse<String> localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery); return testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param datetimeQuery (optional)
* @param dateQuery (optional)
* @param stringQuery (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryDatetimeDateString(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -261,7 +324,21 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryDatetimeDateStringWithHttpInfo(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { public ApiResponse<String> testQueryDatetimeDateStringWithHttpInfo(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryDatetimeDateStringRequestBuilder(datetimeQuery, dateQuery, stringQuery); return testQueryDatetimeDateStringWithHttpInfo(datetimeQuery, dateQuery, stringQuery, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param datetimeQuery (optional)
* @param dateQuery (optional)
* @param stringQuery (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryDatetimeDateStringWithHttpInfo(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryDatetimeDateStringRequestBuilder(datetimeQuery, dateQuery, stringQuery, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -297,7 +374,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { private HttpRequest.Builder testQueryDatetimeDateStringRequestBuilder(@javax.annotation.Nullable Instant datetimeQuery, @javax.annotation.Nullable LocalDate dateQuery, @javax.annotation.Nullable String stringQuery, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -330,6 +407,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -346,7 +425,21 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException {
ApiResponse<String> localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery); return testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param integerQuery (optional)
* @param booleanQuery (optional)
* @param stringQuery (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryIntegerBooleanString(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -360,7 +453,21 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { public ApiResponse<String> testQueryIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryIntegerBooleanStringRequestBuilder(integerQuery, booleanQuery, stringQuery); return testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param integerQuery (optional)
* @param booleanQuery (optional)
* @param stringQuery (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryIntegerBooleanStringWithHttpInfo(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryIntegerBooleanStringRequestBuilder(integerQuery, booleanQuery, stringQuery, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -396,7 +503,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery) throws ApiException { private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(@javax.annotation.Nullable Integer integerQuery, @javax.annotation.Nullable Boolean booleanQuery, @javax.annotation.Nullable String stringQuery, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -429,6 +536,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -443,7 +552,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException { public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject); return testQueryStyleDeepObjectExplodeTrueObject(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleDeepObjectExplodeTrueObject(@javax.annotation.Nullable Pet queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -455,7 +576,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException { public ApiResponse<String> testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(queryObject); return testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -491,7 +624,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -525,6 +658,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -539,7 +674,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject); return testQueryStyleDeepObjectExplodeTrueObjectAllOf(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleDeepObjectExplodeTrueObjectAllOf(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -551,7 +698,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { public ApiResponse<String> testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(queryObject); return testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleDeepObjectExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -587,7 +746,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleDeepObjectExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -621,6 +780,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -635,7 +796,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nullable List<Integer> queryObject) throws ApiException { public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nullable List<Integer> queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject); return testQueryStyleFormExplodeFalseArrayInteger(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleFormExplodeFalseArrayInteger(@javax.annotation.Nullable List<Integer> queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -647,7 +820,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(@javax.annotation.Nullable List<Integer> queryObject) throws ApiException { public ApiResponse<String> testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(@javax.annotation.Nullable List<Integer> queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(queryObject); return testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(@javax.annotation.Nullable List<Integer> queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -683,7 +868,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(@javax.annotation.Nullable List<Integer> queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayIntegerRequestBuilder(@javax.annotation.Nullable List<Integer> queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -712,6 +897,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -726,7 +913,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullable List<String> queryObject) throws ApiException { public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullable List<String> queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject); return testQueryStyleFormExplodeFalseArrayString(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleFormExplodeFalseArrayString(@javax.annotation.Nullable List<String> queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -738,7 +937,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(@javax.annotation.Nullable List<String> queryObject) throws ApiException { public ApiResponse<String> testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(@javax.annotation.Nullable List<String> queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayStringRequestBuilder(queryObject); return testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleFormExplodeFalseArrayStringWithHttpInfo(@javax.annotation.Nullable List<String> queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeFalseArrayStringRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -774,7 +985,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuilder(@javax.annotation.Nullable List<String> queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleFormExplodeFalseArrayStringRequestBuilder(@javax.annotation.Nullable List<String> queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -803,6 +1014,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -817,7 +1030,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject); return testQueryStyleFormExplodeTrueArrayString(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleFormExplodeTrueArrayString(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -829,7 +1054,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { public ApiResponse<String> testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueArrayStringRequestBuilder(queryObject); return testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueArrayStringRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -865,7 +1102,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuilder(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleFormExplodeTrueArrayStringRequestBuilder(@javax.annotation.Nullable TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -894,6 +1131,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -908,7 +1147,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException { public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject); return testQueryStyleFormExplodeTrueObject(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleFormExplodeTrueObject(@javax.annotation.Nullable Pet queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -920,7 +1171,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleFormExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException { public ApiResponse<String> testQueryStyleFormExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectRequestBuilder(queryObject); return testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleFormExplodeTrueObjectWithHttpInfo(@javax.annotation.Nullable Pet queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -956,7 +1219,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectRequestBuilder(@javax.annotation.Nullable Pet queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -990,6 +1253,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -1004,7 +1269,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullable DataQuery queryObject) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject); return testQueryStyleFormExplodeTrueObjectAllOf(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String testQueryStyleFormExplodeTrueObjectAllOf(@javax.annotation.Nullable DataQuery queryObject, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -1016,7 +1293,19 @@ public class QueryApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { public ApiResponse<String> testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable DataQuery queryObject) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(queryObject); return testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(queryObject, null);
}
/**
* Test query parameter(s)
* Test query parameter(s)
* @param queryObject (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> testQueryStyleFormExplodeTrueObjectAllOfWithHttpInfo(@javax.annotation.Nullable DataQuery queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(queryObject, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -1052,7 +1341,7 @@ public class QueryApi {
} }
} }
private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable DataQuery queryObject) throws ApiException { private HttpRequest.Builder testQueryStyleFormExplodeTrueObjectAllOfRequestBuilder(@javax.annotation.Nullable DataQuery queryObject, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -1081,6 +1370,8 @@ public class QueryApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -49,6 +49,26 @@ import java.util.concurrent.CompletableFuture;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class AnotherFakeApi { public class AnotherFakeApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -71,6 +91,7 @@ public class AnotherFakeApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body());
@@ -139,8 +160,20 @@ public class AnotherFakeApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Client> call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { public CompletableFuture<Client> call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException {
return call123testSpecialTags(client, null);
}
/**
* To test special tags
* To test special tags and operation ID starting with number
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Client&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Client> call123testSpecialTags(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client); HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -170,8 +203,20 @@ public class AnotherFakeApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Client>> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { public CompletableFuture<ApiResponse<Client>> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException {
return call123testSpecialTagsWithHttpInfo(client, null);
}
/**
* To test special tags
* To test special tags and operation ID starting with number
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Client&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Client>> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client); HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -200,7 +245,7 @@ public class AnotherFakeApi {
} }
} }
private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
// verify the required parameter 'client' is set // verify the required parameter 'client' is set
if (client == null) { if (client == null) {
throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags");
@@ -224,6 +269,8 @@ public class AnotherFakeApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -49,6 +49,26 @@ import java.util.concurrent.CompletableFuture;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class DefaultApi { public class DefaultApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -71,6 +91,7 @@ public class DefaultApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body());
@@ -138,8 +159,19 @@ public class DefaultApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<FooGetDefaultResponse> fooGet() throws ApiException { public CompletableFuture<FooGetDefaultResponse> fooGet() throws ApiException {
return fooGet(null);
}
/**
*
*
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;FooGetDefaultResponse&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<FooGetDefaultResponse> fooGet(Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(); HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -168,8 +200,19 @@ public class DefaultApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<FooGetDefaultResponse>> fooGetWithHttpInfo() throws ApiException { public CompletableFuture<ApiResponse<FooGetDefaultResponse>> fooGetWithHttpInfo() throws ApiException {
return fooGetWithHttpInfo(null);
}
/**
*
*
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;FooGetDefaultResponse&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<FooGetDefaultResponse>> fooGetWithHttpInfo(Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(); HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -198,7 +241,7 @@ public class DefaultApi {
} }
} }
private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { private HttpRequest.Builder fooGetRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -212,6 +255,8 @@ public class DefaultApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -55,6 +55,26 @@ import java.util.concurrent.CompletableFuture;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class FakeClassnameTags123Api { public class FakeClassnameTags123Api {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -77,6 +97,7 @@ public class FakeClassnameTags123Api {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body());
@@ -145,8 +166,20 @@ public class FakeClassnameTags123Api {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Client> testClassname(@javax.annotation.Nonnull Client client) throws ApiException { public CompletableFuture<Client> testClassname(@javax.annotation.Nonnull Client client) throws ApiException {
return testClassname(client, null);
}
/**
* To test class name in snake case
* To test class name in snake case
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Client&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Client> testClassname(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client); HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -176,8 +209,20 @@ public class FakeClassnameTags123Api {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Client>> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { public CompletableFuture<ApiResponse<Client>> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException {
return testClassnameWithHttpInfo(client, null);
}
/**
* To test class name in snake case
* To test class name in snake case
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Client&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Client>> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client); HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -206,7 +251,7 @@ public class FakeClassnameTags123Api {
} }
} }
private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
// verify the required parameter 'client' is set // verify the required parameter 'client' is set
if (client == null) { if (client == null) {
throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname");
@@ -230,6 +275,8 @@ public class FakeClassnameTags123Api {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -57,6 +57,26 @@ import java.util.concurrent.CompletableFuture;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class PetApi { public class PetApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -79,6 +99,7 @@ public class PetApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body());
@@ -147,8 +168,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { public CompletableFuture<Void> addPet(@javax.annotation.Nonnull Pet pet) throws ApiException {
return addPet(pet, null);
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> addPet(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -171,8 +204,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { public CompletableFuture<ApiResponse<Void>> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException {
return addPetWithHttpInfo(pet, null);
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -193,7 +238,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pet' is set // verify the required parameter 'pet' is set
if (pet == null) { if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet");
@@ -217,6 +262,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -232,8 +279,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { public CompletableFuture<Void> deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException {
return deletePet(petId, apiKey, null);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -257,8 +317,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { public CompletableFuture<ApiResponse<Void>> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException {
return deletePetWithHttpInfo(petId, apiKey, null);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -279,7 +352,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
@@ -301,6 +374,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -315,8 +390,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<List<Pet>> findPetsByStatus(@javax.annotation.Nonnull List<String> status) throws ApiException { public CompletableFuture<List<Pet>> findPetsByStatus(@javax.annotation.Nonnull List<String> status) throws ApiException {
return findPetsByStatus(status, null);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<List<Pet>> findPetsByStatus(@javax.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -346,8 +433,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<List<Pet>>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status) throws ApiException { public CompletableFuture<ApiResponse<List<Pet>>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status) throws ApiException {
return findPetsByStatusWithHttpInfo(status, null);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;Pet&gt;&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<List<Pet>>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -376,7 +475,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List<String> status) throws ApiException { private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == null) { if (status == null) {
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
@@ -409,6 +508,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -425,8 +526,22 @@ public class PetApi {
*/ */
@Deprecated @Deprecated
public CompletableFuture<List<Pet>> findPetsByTags(@javax.annotation.Nonnull List<String> tags) throws ApiException { public CompletableFuture<List<Pet>> findPetsByTags(@javax.annotation.Nonnull List<String> tags) throws ApiException {
return findPetsByTags(tags, null);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture<List<Pet>> findPetsByTags(@javax.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -458,8 +573,22 @@ public class PetApi {
*/ */
@Deprecated @Deprecated
public CompletableFuture<ApiResponse<List<Pet>>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags) throws ApiException { public CompletableFuture<ApiResponse<List<Pet>>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags) throws ApiException {
return findPetsByTagsWithHttpInfo(tags, null);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;List&lt;Pet&gt;&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public CompletableFuture<ApiResponse<List<Pet>>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -488,7 +617,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List<String> tags) throws ApiException { private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == null) { if (tags == null) {
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
@@ -521,6 +650,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -535,8 +666,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Pet> getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { public CompletableFuture<Pet> getPetById(@javax.annotation.Nonnull Long petId) throws ApiException {
return getPetById(petId, null);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Pet> getPetById(@javax.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -566,8 +709,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Pet>> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { public CompletableFuture<ApiResponse<Pet>> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException {
return getPetByIdWithHttpInfo(petId, null);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Pet>> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -596,7 +751,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
@@ -615,6 +770,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -629,8 +786,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { public CompletableFuture<Void> updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException {
return updatePet(pet, null);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> updatePet(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -653,8 +822,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { public CompletableFuture<ApiResponse<Void>> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException {
return updatePetWithHttpInfo(pet, null);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -675,7 +856,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pet' is set // verify the required parameter 'pet' is set
if (pet == null) { if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet");
@@ -699,6 +880,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -715,8 +898,22 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { public CompletableFuture<Void> updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException {
return updatePetWithForm(petId, name, status, null);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -741,8 +938,22 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { public CompletableFuture<ApiResponse<Void>> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException {
return updatePetWithFormWithHttpInfo(petId, name, status, null);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -763,7 +974,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
@@ -799,6 +1010,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -815,8 +1028,22 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ModelApiResponse> uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { public CompletableFuture<ModelApiResponse> uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException {
return uploadFile(petId, additionalMetadata, _file, null);
}
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _file file to upload (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ModelApiResponse&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ModelApiResponse> uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -848,8 +1075,22 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<ModelApiResponse>> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { public CompletableFuture<ApiResponse<ModelApiResponse>> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException {
return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null);
}
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _file file to upload (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;ModelApiResponse&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<ModelApiResponse>> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -878,7 +1119,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
@@ -933,6 +1174,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -949,8 +1192,22 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ModelApiResponse> uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { public CompletableFuture<ModelApiResponse> uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException {
return uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, null);
}
/**
* uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ModelApiResponse&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ModelApiResponse> uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata); HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -982,8 +1239,22 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<ModelApiResponse>> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { public CompletableFuture<ApiResponse<ModelApiResponse>> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException {
return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, null);
}
/**
* uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;ModelApiResponse&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<ModelApiResponse>> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata); HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -1012,7 +1283,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
@@ -1071,6 +1342,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -55,6 +55,26 @@ import java.util.concurrent.CompletableFuture;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class StoreApi { public class StoreApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -77,6 +97,7 @@ public class StoreApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body());
@@ -145,8 +166,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { public CompletableFuture<Void> deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException {
return deleteOrder(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> deleteOrder(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -169,8 +202,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { public CompletableFuture<ApiResponse<Void>> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException {
return deleteOrderWithHttpInfo(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -191,7 +236,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
@@ -210,6 +255,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -223,8 +270,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Map<String, Integer>> getInventory() throws ApiException { public CompletableFuture<Map<String, Integer>> getInventory() throws ApiException {
return getInventory(null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Map&lt;String, Integer&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Map<String, Integer>> getInventory(Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -253,8 +311,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Map<String, Integer>>> getInventoryWithHttpInfo() throws ApiException { public CompletableFuture<ApiResponse<Map<String, Integer>>> getInventoryWithHttpInfo() throws ApiException {
return getInventoryWithHttpInfo(null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Map&lt;String, Integer&gt;&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Map<String, Integer>>> getInventoryWithHttpInfo(Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -283,7 +352,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { private HttpRequest.Builder getInventoryRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -297,6 +366,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -311,8 +382,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Order> getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { public CompletableFuture<Order> getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException {
return getOrderById(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Order> getOrderById(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -342,8 +425,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Order>> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { public CompletableFuture<ApiResponse<Order>> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException {
return getOrderByIdWithHttpInfo(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Order&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Order>> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -372,7 +467,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
@@ -391,6 +486,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -405,8 +502,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Order> placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { public CompletableFuture<Order> placeOrder(@javax.annotation.Nonnull Order order) throws ApiException {
return placeOrder(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Order> placeOrder(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -436,8 +545,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Order>> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { public CompletableFuture<ApiResponse<Order>> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException {
return placeOrderWithHttpInfo(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Order&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Order>> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -466,7 +587,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
// verify the required parameter 'order' is set // verify the required parameter 'order' is set
if (order == null) { if (order == null) {
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
@@ -490,6 +611,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -56,6 +56,26 @@ import java.util.concurrent.CompletableFuture;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class UserApi { public class UserApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -78,6 +98,7 @@ public class UserApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
private ApiException getApiException(String operationId, HttpResponse<String> response) { private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body()); String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body()); return new ApiException(response.statusCode(), message, response.headers(), response.body());
@@ -146,8 +167,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> createUser(@javax.annotation.Nonnull User user) throws ApiException { public CompletableFuture<Void> createUser(@javax.annotation.Nonnull User user) throws ApiException {
return createUser(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> createUser(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -170,8 +203,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { public CompletableFuture<ApiResponse<Void>> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException {
return createUserWithHttpInfo(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -192,7 +237,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUser");
@@ -216,6 +261,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -230,8 +277,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user) throws ApiException { public CompletableFuture<Void> createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithArrayInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -254,8 +313,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException { public CompletableFuture<ApiResponse<Void>> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithArrayInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -276,7 +347,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List<User> user) throws ApiException { private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
@@ -300,6 +371,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -314,8 +387,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> createUsersWithListInput(@javax.annotation.Nonnull List<User> user) throws ApiException { public CompletableFuture<Void> createUsersWithListInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithListInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> createUsersWithListInput(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -338,8 +423,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException { public CompletableFuture<ApiResponse<Void>> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithListInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -360,7 +457,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List<User> user) throws ApiException { private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput");
@@ -384,6 +481,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -398,8 +497,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> deleteUser(@javax.annotation.Nonnull String username) throws ApiException { public CompletableFuture<Void> deleteUser(@javax.annotation.Nonnull String username) throws ApiException {
return deleteUser(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> deleteUser(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -422,8 +533,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { public CompletableFuture<ApiResponse<Void>> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
return deleteUserWithHttpInfo(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -444,7 +567,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
@@ -463,6 +586,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -477,8 +602,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<User> getUserByName(@javax.annotation.Nonnull String username) throws ApiException { public CompletableFuture<User> getUserByName(@javax.annotation.Nonnull String username) throws ApiException {
return getUserByName(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;User&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<User> getUserByName(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -508,8 +645,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<User>> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { public CompletableFuture<ApiResponse<User>> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
return getUserByNameWithHttpInfo(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;User&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<User>> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -538,7 +687,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
@@ -557,6 +706,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -572,8 +723,21 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<String> loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { public CompletableFuture<String> loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
return loginUser(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<String> loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -604,8 +768,21 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<String>> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { public CompletableFuture<ApiResponse<String>> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
return loginUserWithHttpInfo(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;String&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<String>> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -634,7 +811,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
@@ -673,6 +850,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -686,8 +865,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> logoutUser() throws ApiException { public CompletableFuture<Void> logoutUser() throws ApiException {
return logoutUser(null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> logoutUser(Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -709,8 +899,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> logoutUserWithHttpInfo() throws ApiException { public CompletableFuture<ApiResponse<Void>> logoutUserWithHttpInfo() throws ApiException {
return logoutUserWithHttpInfo(null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> logoutUserWithHttpInfo(Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -731,7 +932,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { private HttpRequest.Builder logoutUserRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -745,6 +946,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -760,8 +963,21 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<Void> updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { public CompletableFuture<Void> updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
return updateUser(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<Void> updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -785,8 +1001,21 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public CompletableFuture<ApiResponse<Void>> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { public CompletableFuture<ApiResponse<Void>> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
return updateUserWithHttpInfo(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
* @throws ApiException if fails to make API call
*/
public CompletableFuture<ApiResponse<Void>> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
try { try {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
return memberVarHttpClient.sendAsync( return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -807,7 +1036,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
@@ -836,6 +1065,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -55,6 +55,26 @@ import java.util.function.Consumer;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class PetApi { public class PetApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -77,6 +97,7 @@ public class PetApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -146,7 +167,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Pet addPet(@jakarta.annotation.Nonnull Pet pet) throws ApiException { public Pet addPet(@jakarta.annotation.Nonnull Pet pet) throws ApiException {
ApiResponse<Pet> localVarResponse = addPetWithHttpInfo(pet); return addPet(pet, null);
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet addPet(@jakarta.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
ApiResponse<Pet> localVarResponse = addPetWithHttpInfo(pet, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -158,7 +191,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Pet> addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException { public ApiResponse<Pet> addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); return addPetWithHttpInfo(pet, null);
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Pet> addPetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -201,7 +246,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { private HttpRequest.Builder addPetRequestBuilder(@jakarta.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pet' is set // verify the required parameter 'pet' is set
if (pet == null) { if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet");
@@ -225,6 +270,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -239,7 +286,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException {
deletePetWithHttpInfo(petId, apiKey); deletePet(petId, apiKey, null);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deletePet(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
deletePetWithHttpInfo(petId, apiKey, headers);
} }
/** /**
@@ -251,7 +310,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { public ApiResponse<Void> deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); return deletePetWithHttpInfo(petId, apiKey, null);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deletePetWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -284,7 +356,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey) throws ApiException { private HttpRequest.Builder deletePetRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
@@ -306,6 +378,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -320,7 +394,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public List<Pet> findPetsByStatus(@jakarta.annotation.Nonnull List<String> status) throws ApiException { public List<Pet> findPetsByStatus(@jakarta.annotation.Nonnull List<String> status) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByStatusWithHttpInfo(status); return findPetsByStatus(status, null);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param headers Optional headers to include in the request
* @return List&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public List<Pet> findPetsByStatus(@jakarta.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByStatusWithHttpInfo(status, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -332,7 +418,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@jakarta.annotation.Nonnull List<String> status) throws ApiException { public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@jakarta.annotation.Nonnull List<String> status) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); return findPetsByStatusWithHttpInfo(status, null);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@jakarta.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -375,7 +473,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.Nonnull List<String> status) throws ApiException { private HttpRequest.Builder findPetsByStatusRequestBuilder(@jakarta.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == null) { if (status == null) {
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
@@ -408,6 +506,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -424,7 +524,21 @@ public class PetApi {
*/ */
@Deprecated @Deprecated
public List<Pet> findPetsByTags(@jakarta.annotation.Nonnull List<String> tags) throws ApiException { public List<Pet> findPetsByTags(@jakarta.annotation.Nonnull List<String> tags) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByTagsWithHttpInfo(tags); return findPetsByTags(tags, null);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param headers Optional headers to include in the request
* @return List&lt;Pet&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public List<Pet> findPetsByTags(@jakarta.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -438,7 +552,21 @@ public class PetApi {
*/ */
@Deprecated @Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull List<String> tags) throws ApiException { public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull List<String> tags) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); return findPetsByTagsWithHttpInfo(tags, null);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@jakarta.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -481,7 +609,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Nonnull List<String> tags) throws ApiException { private HttpRequest.Builder findPetsByTagsRequestBuilder(@jakarta.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == null) { if (tags == null) {
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
@@ -514,6 +642,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -528,7 +658,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Pet getPetById(@jakarta.annotation.Nonnull Long petId) throws ApiException { public Pet getPetById(@jakarta.annotation.Nonnull Long petId) throws ApiException {
ApiResponse<Pet> localVarResponse = getPetByIdWithHttpInfo(petId); return getPetById(petId, null);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param headers Optional headers to include in the request
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet getPetById(@jakarta.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
ApiResponse<Pet> localVarResponse = getPetByIdWithHttpInfo(petId, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -540,7 +682,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Pet> getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws ApiException { public ApiResponse<Pet> getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long petId) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); return getPetByIdWithHttpInfo(petId, null);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(@jakarta.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -583,7 +737,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull Long petId) throws ApiException { private HttpRequest.Builder getPetByIdRequestBuilder(@jakarta.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
@@ -602,6 +756,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -618,7 +774,21 @@ public class PetApi {
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a> * @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
*/ */
public Pet updatePet(@jakarta.annotation.Nonnull Pet pet) throws ApiException { public Pet updatePet(@jakarta.annotation.Nonnull Pet pet) throws ApiException {
ApiResponse<Pet> localVarResponse = updatePetWithHttpInfo(pet); return updatePet(pet, null);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return Pet
* @throws ApiException if fails to make API call
* API documentation for the updatePet operation
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
*/
public Pet updatePet(@jakarta.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
ApiResponse<Pet> localVarResponse = updatePetWithHttpInfo(pet, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -632,7 +802,21 @@ public class PetApi {
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a> * @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
*/ */
public ApiResponse<Pet> updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException { public ApiResponse<Pet> updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); return updatePetWithHttpInfo(pet, null);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
* API documentation for the updatePet operation
* @see <a href="http://petstore.swagger.io/v2/doc/updatePet">Update an existing pet Documentation</a>
*/
public ApiResponse<Pet> updatePetWithHttpInfo(@jakarta.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -675,7 +859,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull Pet pet) throws ApiException { private HttpRequest.Builder updatePetRequestBuilder(@jakarta.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pet' is set // verify the required parameter 'pet' is set
if (pet == null) { if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet");
@@ -699,6 +883,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -714,7 +900,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException {
updatePetWithFormWithHttpInfo(petId, name, status); updatePetWithForm(petId, name, status, null);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void updatePetWithForm(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
updatePetWithFormWithHttpInfo(petId, name, status, headers);
} }
/** /**
@@ -727,7 +926,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { public ApiResponse<Void> updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); return updatePetWithFormWithHttpInfo(petId, name, status, null);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -760,7 +973,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status) throws ApiException { private HttpRequest.Builder updatePetWithFormRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String name, @jakarta.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
@@ -796,6 +1009,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -812,7 +1027,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException {
ApiResponse<ModelApiResponse> localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file); return uploadFile(petId, additionalMetadata, _file, null);
}
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _file file to upload (optional)
* @param headers Optional headers to include in the request
* @return ModelApiResponse
* @throws ApiException if fails to make API call
*/
public ModelApiResponse uploadFile(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
ApiResponse<ModelApiResponse> localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -826,7 +1055,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null);
}
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _file file to upload (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;ModelApiResponse&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -869,7 +1112,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file) throws ApiException { private HttpRequest.Builder uploadFileRequestBuilder(@jakarta.annotation.Nonnull Long petId, @jakarta.annotation.Nullable String additionalMetadata, @jakarta.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
@@ -924,6 +1167,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -53,6 +53,26 @@ import java.util.function.Consumer;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class StoreApi { public class StoreApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -75,6 +95,7 @@ public class StoreApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -143,7 +164,18 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void deleteOrder(@jakarta.annotation.Nonnull String orderId) throws ApiException { public void deleteOrder(@jakarta.annotation.Nonnull String orderId) throws ApiException {
deleteOrderWithHttpInfo(orderId); deleteOrder(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deleteOrder(@jakarta.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
deleteOrderWithHttpInfo(orderId, headers);
} }
/** /**
@@ -154,7 +186,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull String orderId) throws ApiException { public ApiResponse<Void> deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull String orderId) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); return deleteOrderWithHttpInfo(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(@jakarta.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -187,7 +231,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnull String orderId) throws ApiException { private HttpRequest.Builder deleteOrderRequestBuilder(@jakarta.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
@@ -206,6 +250,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -219,7 +265,18 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Map<String, Integer> getInventory() throws ApiException { public Map<String, Integer> getInventory() throws ApiException {
ApiResponse<Map<String, Integer>> localVarResponse = getInventoryWithHttpInfo(); return getInventory(null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return Map&lt;String, Integer&gt;
* @throws ApiException if fails to make API call
*/
public Map<String, Integer> getInventory(Map<String, String> headers) throws ApiException {
ApiResponse<Map<String, Integer>> localVarResponse = getInventoryWithHttpInfo(headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -230,7 +287,18 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException { public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); return getInventoryWithHttpInfo(null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Map&lt;String, Integer&gt;&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -273,7 +341,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { private HttpRequest.Builder getInventoryRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -287,6 +355,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -301,7 +371,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Order getOrderById(@jakarta.annotation.Nonnull Long orderId) throws ApiException { public Order getOrderById(@jakarta.annotation.Nonnull Long orderId) throws ApiException {
ApiResponse<Order> localVarResponse = getOrderByIdWithHttpInfo(orderId); return getOrderById(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return Order
* @throws ApiException if fails to make API call
*/
public Order getOrderById(@jakarta.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
ApiResponse<Order> localVarResponse = getOrderByIdWithHttpInfo(orderId, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -313,7 +395,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Order> getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull Long orderId) throws ApiException { public ApiResponse<Order> getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull Long orderId) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); return getOrderByIdWithHttpInfo(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(@jakarta.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -356,7 +450,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnull Long orderId) throws ApiException { private HttpRequest.Builder getOrderByIdRequestBuilder(@jakarta.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
@@ -375,6 +469,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -389,7 +485,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Order placeOrder(@jakarta.annotation.Nonnull Order order) throws ApiException { public Order placeOrder(@jakarta.annotation.Nonnull Order order) throws ApiException {
ApiResponse<Order> localVarResponse = placeOrderWithHttpInfo(order); return placeOrder(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return Order
* @throws ApiException if fails to make API call
*/
public Order placeOrder(@jakarta.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
ApiResponse<Order> localVarResponse = placeOrderWithHttpInfo(order, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -401,7 +509,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Order> placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Order order) throws ApiException { public ApiResponse<Order> placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Order order) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); return placeOrderWithHttpInfo(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> placeOrderWithHttpInfo(@jakarta.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -444,7 +564,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull Order order) throws ApiException { private HttpRequest.Builder placeOrderRequestBuilder(@jakarta.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
// verify the required parameter 'order' is set // verify the required parameter 'order' is set
if (order == null) { if (order == null) {
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
@@ -468,6 +588,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -54,6 +54,26 @@ import java.util.function.Consumer;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class UserApi { public class UserApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -76,6 +96,7 @@ public class UserApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -144,7 +165,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void createUser(@jakarta.annotation.Nonnull User user) throws ApiException { public void createUser(@jakarta.annotation.Nonnull User user) throws ApiException {
createUserWithHttpInfo(user); createUser(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUser(@jakarta.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
createUserWithHttpInfo(user, headers);
} }
/** /**
@@ -155,7 +187,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> createUserWithHttpInfo(@jakarta.annotation.Nonnull User user) throws ApiException { public ApiResponse<Void> createUserWithHttpInfo(@jakarta.annotation.Nonnull User user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); return createUserWithHttpInfo(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUserWithHttpInfo(@jakarta.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -188,7 +232,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull User user) throws ApiException { private HttpRequest.Builder createUserRequestBuilder(@jakarta.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUser");
@@ -212,6 +256,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -225,7 +271,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List<User> user) throws ApiException { public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List<User> user) throws ApiException {
createUsersWithArrayInputWithHttpInfo(user); createUsersWithArrayInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUsersWithArrayInput(@jakarta.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
createUsersWithArrayInputWithHttpInfo(user, headers);
} }
/** /**
@@ -236,7 +293,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List<User> user) throws ApiException { public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List<User> user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); return createUsersWithArrayInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@jakarta.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -269,7 +338,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.annotation.Nonnull List<User> user) throws ApiException { private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@jakarta.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
@@ -293,6 +362,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -306,7 +377,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void createUsersWithListInput(@jakarta.annotation.Nonnull List<User> user) throws ApiException { public void createUsersWithListInput(@jakarta.annotation.Nonnull List<User> user) throws ApiException {
createUsersWithListInputWithHttpInfo(user); createUsersWithListInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUsersWithListInput(@jakarta.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
createUsersWithListInputWithHttpInfo(user, headers);
} }
/** /**
@@ -317,7 +399,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List<User> user) throws ApiException { public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List<User> user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); return createUsersWithListInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@jakarta.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -350,7 +444,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.annotation.Nonnull List<User> user) throws ApiException { private HttpRequest.Builder createUsersWithListInputRequestBuilder(@jakarta.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput");
@@ -374,6 +468,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -387,7 +483,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void deleteUser(@jakarta.annotation.Nonnull String username) throws ApiException { public void deleteUser(@jakarta.annotation.Nonnull String username) throws ApiException {
deleteUserWithHttpInfo(username); deleteUser(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deleteUser(@jakarta.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
deleteUserWithHttpInfo(username, headers);
} }
/** /**
@@ -398,7 +505,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> deleteUserWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException { public ApiResponse<Void> deleteUserWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); return deleteUserWithHttpInfo(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteUserWithHttpInfo(@jakarta.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -431,7 +550,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { private HttpRequest.Builder deleteUserRequestBuilder(@jakarta.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
@@ -450,6 +569,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -464,7 +585,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public User getUserByName(@jakarta.annotation.Nonnull String username) throws ApiException { public User getUserByName(@jakarta.annotation.Nonnull String username) throws ApiException {
ApiResponse<User> localVarResponse = getUserByNameWithHttpInfo(username); return getUserByName(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return User
* @throws ApiException if fails to make API call
*/
public User getUserByName(@jakarta.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
ApiResponse<User> localVarResponse = getUserByNameWithHttpInfo(username, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -476,7 +609,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<User> getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException { public ApiResponse<User> getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull String username) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); return getUserByNameWithHttpInfo(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;User&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<User> getUserByNameWithHttpInfo(@jakarta.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -519,7 +664,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonnull String username) throws ApiException { private HttpRequest.Builder getUserByNameRequestBuilder(@jakarta.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
@@ -538,6 +683,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -553,7 +700,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String loginUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { public String loginUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException {
ApiResponse<String> localVarResponse = loginUserWithHttpInfo(username, password); return loginUser(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String loginUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = loginUserWithHttpInfo(username, password, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -566,7 +726,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> loginUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { public ApiResponse<String> loginUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); return loginUserWithHttpInfo(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> loginUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -609,7 +782,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password) throws ApiException { private HttpRequest.Builder loginUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
@@ -648,6 +821,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -660,7 +835,17 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void logoutUser() throws ApiException { public void logoutUser() throws ApiException {
logoutUserWithHttpInfo(); logoutUser(null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void logoutUser(Map<String, String> headers) throws ApiException {
logoutUserWithHttpInfo(headers);
} }
/** /**
@@ -670,7 +855,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); return logoutUserWithHttpInfo(null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> logoutUserWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -703,7 +899,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { private HttpRequest.Builder logoutUserRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -717,6 +913,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -731,7 +929,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException {
updateUserWithHttpInfo(username, user); updateUser(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void updateUser(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
updateUserWithHttpInfo(username, user, headers);
} }
/** /**
@@ -743,7 +953,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> updateUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { public ApiResponse<Void> updateUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); return updateUserWithHttpInfo(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updateUserWithHttpInfo(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -776,7 +999,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user) throws ApiException { private HttpRequest.Builder updateUserRequestBuilder(@jakarta.annotation.Nonnull String username, @jakarta.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
@@ -805,6 +1028,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -47,6 +47,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class AnotherFakeApi { public class AnotherFakeApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -69,6 +89,7 @@ public class AnotherFakeApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -138,7 +159,19 @@ public class AnotherFakeApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException { public Client call123testSpecialTags(@javax.annotation.Nonnull Client client) throws ApiException {
ApiResponse<Client> localVarResponse = call123testSpecialTagsWithHttpInfo(client); return call123testSpecialTags(client, null);
}
/**
* To test special tags
* To test special tags and operation ID starting with number
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return Client
* @throws ApiException if fails to make API call
*/
public Client call123testSpecialTags(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
ApiResponse<Client> localVarResponse = call123testSpecialTagsWithHttpInfo(client, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -150,7 +183,19 @@ public class AnotherFakeApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client); return call123testSpecialTagsWithHttpInfo(client, null);
}
/**
* To test special tags
* To test special tags and operation ID starting with number
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Client&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -193,7 +238,7 @@ public class AnotherFakeApi {
} }
} }
private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { private HttpRequest.Builder call123testSpecialTagsRequestBuilder(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
// verify the required parameter 'client' is set // verify the required parameter 'client' is set
if (client == null) { if (client == null) {
throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags");
@@ -217,6 +262,8 @@ public class AnotherFakeApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -47,6 +47,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class DefaultApi { public class DefaultApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -69,6 +89,7 @@ public class DefaultApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -137,7 +158,18 @@ public class DefaultApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public FooGetDefaultResponse fooGet() throws ApiException { public FooGetDefaultResponse fooGet() throws ApiException {
ApiResponse<FooGetDefaultResponse> localVarResponse = fooGetWithHttpInfo(); return fooGet(null);
}
/**
*
*
* @param headers Optional headers to include in the request
* @return FooGetDefaultResponse
* @throws ApiException if fails to make API call
*/
public FooGetDefaultResponse fooGet(Map<String, String> headers) throws ApiException {
ApiResponse<FooGetDefaultResponse> localVarResponse = fooGetWithHttpInfo(headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -148,7 +180,18 @@ public class DefaultApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<FooGetDefaultResponse> fooGetWithHttpInfo() throws ApiException { public ApiResponse<FooGetDefaultResponse> fooGetWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(); return fooGetWithHttpInfo(null);
}
/**
*
*
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;FooGetDefaultResponse&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<FooGetDefaultResponse> fooGetWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -191,7 +234,7 @@ public class DefaultApi {
} }
} }
private HttpRequest.Builder fooGetRequestBuilder() throws ApiException { private HttpRequest.Builder fooGetRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -205,6 +248,8 @@ public class DefaultApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -53,6 +53,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class FakeClassnameTags123Api { public class FakeClassnameTags123Api {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -75,6 +95,7 @@ public class FakeClassnameTags123Api {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -144,7 +165,19 @@ public class FakeClassnameTags123Api {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiException { public Client testClassname(@javax.annotation.Nonnull Client client) throws ApiException {
ApiResponse<Client> localVarResponse = testClassnameWithHttpInfo(client); return testClassname(client, null);
}
/**
* To test class name in snake case
* To test class name in snake case
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return Client
* @throws ApiException if fails to make API call
*/
public Client testClassname(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
ApiResponse<Client> localVarResponse = testClassnameWithHttpInfo(client, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -156,7 +189,19 @@ public class FakeClassnameTags123Api {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Client> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException { public ApiResponse<Client> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client); return testClassnameWithHttpInfo(client, null);
}
/**
* To test class name in snake case
* To test class name in snake case
* @param client client model (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Client&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Client> testClassnameWithHttpInfo(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -199,7 +244,7 @@ public class FakeClassnameTags123Api {
} }
} }
private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client) throws ApiException { private HttpRequest.Builder testClassnameRequestBuilder(@javax.annotation.Nonnull Client client, Map<String, String> headers) throws ApiException {
// verify the required parameter 'client' is set // verify the required parameter 'client' is set
if (client == null) { if (client == null) {
throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname");
@@ -223,6 +268,8 @@ public class FakeClassnameTags123Api {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -55,6 +55,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class PetApi { public class PetApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -77,6 +97,7 @@ public class PetApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -145,7 +166,18 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void addPet(@javax.annotation.Nonnull Pet pet) throws ApiException { public void addPet(@javax.annotation.Nonnull Pet pet) throws ApiException {
addPetWithHttpInfo(pet); addPet(pet, null);
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void addPet(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
addPetWithHttpInfo(pet, headers);
} }
/** /**
@@ -156,7 +188,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { public ApiResponse<Void> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet); return addPetWithHttpInfo(pet, null);
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> addPetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -189,7 +233,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { private HttpRequest.Builder addPetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pet' is set // verify the required parameter 'pet' is set
if (pet == null) { if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet");
@@ -213,6 +257,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -227,7 +273,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException {
deletePetWithHttpInfo(petId, apiKey); deletePet(petId, apiKey, null);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deletePet(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
deletePetWithHttpInfo(petId, apiKey, headers);
} }
/** /**
@@ -239,7 +297,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { public ApiResponse<Void> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey); return deletePetWithHttpInfo(petId, apiKey, null);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete (required)
* @param apiKey (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deletePetWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -272,7 +343,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey) throws ApiException { private HttpRequest.Builder deletePetRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String apiKey, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
@@ -294,6 +365,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -308,7 +381,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public List<Pet> findPetsByStatus(@javax.annotation.Nonnull List<String> status) throws ApiException { public List<Pet> findPetsByStatus(@javax.annotation.Nonnull List<String> status) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByStatusWithHttpInfo(status); return findPetsByStatus(status, null);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param headers Optional headers to include in the request
* @return List&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public List<Pet> findPetsByStatus(@javax.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByStatusWithHttpInfo(status, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -320,7 +405,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status) throws ApiException { public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status); return findPetsByStatusWithHttpInfo(status, null);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(@javax.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -363,7 +460,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List<String> status) throws ApiException { private HttpRequest.Builder findPetsByStatusRequestBuilder(@javax.annotation.Nonnull List<String> status, Map<String, String> headers) throws ApiException {
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == null) { if (status == null) {
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
@@ -396,6 +493,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -412,7 +511,21 @@ public class PetApi {
*/ */
@Deprecated @Deprecated
public List<Pet> findPetsByTags(@javax.annotation.Nonnull List<String> tags) throws ApiException { public List<Pet> findPetsByTags(@javax.annotation.Nonnull List<String> tags) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByTagsWithHttpInfo(tags); return findPetsByTags(tags, null);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param headers Optional headers to include in the request
* @return List&lt;Pet&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public List<Pet> findPetsByTags(@javax.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
ApiResponse<List<Pet>> localVarResponse = findPetsByTagsWithHttpInfo(tags, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -426,7 +539,21 @@ public class PetApi {
*/ */
@Deprecated @Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags) throws ApiException { public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags); return findPetsByTagsWithHttpInfo(tags, null);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;List&lt;Pet&gt;&gt;
* @throws ApiException if fails to make API call
* @deprecated
*/
@Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(@javax.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -469,7 +596,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List<String> tags) throws ApiException { private HttpRequest.Builder findPetsByTagsRequestBuilder(@javax.annotation.Nonnull List<String> tags, Map<String, String> headers) throws ApiException {
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == null) { if (tags == null) {
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
@@ -502,6 +629,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -516,7 +645,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException { public Pet getPetById(@javax.annotation.Nonnull Long petId) throws ApiException {
ApiResponse<Pet> localVarResponse = getPetByIdWithHttpInfo(petId); return getPetById(petId, null);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param headers Optional headers to include in the request
* @return Pet
* @throws ApiException if fails to make API call
*/
public Pet getPetById(@javax.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
ApiResponse<Pet> localVarResponse = getPetByIdWithHttpInfo(petId, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -528,7 +669,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Pet> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException { public ApiResponse<Pet> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId); return getPetByIdWithHttpInfo(petId, null);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Pet&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(@javax.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -571,7 +724,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId) throws ApiException { private HttpRequest.Builder getPetByIdRequestBuilder(@javax.annotation.Nonnull Long petId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
@@ -590,6 +743,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -603,7 +758,18 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException { public void updatePet(@javax.annotation.Nonnull Pet pet) throws ApiException {
updatePetWithHttpInfo(pet); updatePet(pet, null);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void updatePet(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
updatePetWithHttpInfo(pet, headers);
} }
/** /**
@@ -614,7 +780,19 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException { public ApiResponse<Void> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet); return updatePetWithHttpInfo(pet, null);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updatePetWithHttpInfo(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -647,7 +825,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet) throws ApiException { private HttpRequest.Builder updatePetRequestBuilder(@javax.annotation.Nonnull Pet pet, Map<String, String> headers) throws ApiException {
// verify the required parameter 'pet' is set // verify the required parameter 'pet' is set
if (pet == null) { if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet");
@@ -671,6 +849,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -686,7 +866,20 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException {
updatePetWithFormWithHttpInfo(petId, name, status); updatePetWithForm(petId, name, status, null);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void updatePetWithForm(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
updatePetWithFormWithHttpInfo(petId, name, status, headers);
} }
/** /**
@@ -699,7 +892,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { public ApiResponse<Void> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status); return updatePetWithFormWithHttpInfo(petId, name, status, null);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated (required)
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -732,7 +939,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) throws ApiException { private HttpRequest.Builder updatePetWithFormRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
@@ -768,6 +975,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -784,7 +993,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException {
ApiResponse<ModelApiResponse> localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file); return uploadFile(petId, additionalMetadata, _file, null);
}
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _file file to upload (optional)
* @param headers Optional headers to include in the request
* @return ModelApiResponse
* @throws ApiException if fails to make API call
*/
public ModelApiResponse uploadFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
ApiResponse<ModelApiResponse> localVarResponse = uploadFileWithHttpInfo(petId, additionalMetadata, _file, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -798,7 +1021,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file); return uploadFileWithHttpInfo(petId, additionalMetadata, _file, null);
}
/**
* uploads an image
*
* @param petId ID of pet to update (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param _file file to upload (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;ModelApiResponse&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -841,7 +1078,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file) throws ApiException { private HttpRequest.Builder uploadFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable File _file, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
@@ -896,6 +1133,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -912,7 +1151,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException {
ApiResponse<ModelApiResponse> localVarResponse = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); return uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, null);
}
/**
* uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param headers Optional headers to include in the request
* @return ModelApiResponse
* @throws ApiException if fails to make API call
*/
public ModelApiResponse uploadFileWithRequiredFile(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map<String, String> headers) throws ApiException {
ApiResponse<ModelApiResponse> localVarResponse = uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -926,7 +1179,21 @@ public class PetApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata); return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, null);
}
/**
* uploads an image (required)
*
* @param petId ID of pet to update (required)
* @param requiredFile file to upload (required)
* @param additionalMetadata Additional data to pass to server (optional)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;ModelApiResponse&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -969,7 +1236,7 @@ public class PetApi {
} }
} }
private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata) throws ApiException { private HttpRequest.Builder uploadFileWithRequiredFileRequestBuilder(@javax.annotation.Nonnull Long petId, @javax.annotation.Nonnull File requiredFile, @javax.annotation.Nullable String additionalMetadata, Map<String, String> headers) throws ApiException {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
@@ -1028,6 +1295,8 @@ public class PetApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -53,6 +53,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class StoreApi { public class StoreApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -75,6 +95,7 @@ public class StoreApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -143,7 +164,18 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException {
deleteOrderWithHttpInfo(orderId); deleteOrder(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deleteOrder(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
deleteOrderWithHttpInfo(orderId, headers);
} }
/** /**
@@ -154,7 +186,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { public ApiResponse<Void> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId); return deleteOrderWithHttpInfo(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -187,7 +231,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId) throws ApiException { private HttpRequest.Builder deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
@@ -206,6 +250,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -219,7 +265,18 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Map<String, Integer> getInventory() throws ApiException { public Map<String, Integer> getInventory() throws ApiException {
ApiResponse<Map<String, Integer>> localVarResponse = getInventoryWithHttpInfo(); return getInventory(null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return Map&lt;String, Integer&gt;
* @throws ApiException if fails to make API call
*/
public Map<String, Integer> getInventory(Map<String, String> headers) throws ApiException {
ApiResponse<Map<String, Integer>> localVarResponse = getInventoryWithHttpInfo(headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -230,7 +287,18 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException { public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(); return getInventoryWithHttpInfo(null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Map&lt;String, Integer&gt;&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -273,7 +341,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder getInventoryRequestBuilder() throws ApiException { private HttpRequest.Builder getInventoryRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -287,6 +355,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -301,7 +371,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException {
ApiResponse<Order> localVarResponse = getOrderByIdWithHttpInfo(orderId); return getOrderById(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return Order
* @throws ApiException if fails to make API call
*/
public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
ApiResponse<Order> localVarResponse = getOrderByIdWithHttpInfo(orderId, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -313,7 +395,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Order> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { public ApiResponse<Order> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId); return getOrderByIdWithHttpInfo(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -356,7 +450,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId) throws ApiException { private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
@@ -375,6 +469,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -389,7 +485,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException {
ApiResponse<Order> localVarResponse = placeOrderWithHttpInfo(order); return placeOrder(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return Order
* @throws ApiException if fails to make API call
*/
public Order placeOrder(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
ApiResponse<Order> localVarResponse = placeOrderWithHttpInfo(order, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -401,7 +509,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Order> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { public ApiResponse<Order> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order); return placeOrderWithHttpInfo(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -444,7 +564,7 @@ public class StoreApi {
} }
} }
private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order) throws ApiException { private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
// verify the required parameter 'order' is set // verify the required parameter 'order' is set
if (order == null) { if (order == null) {
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
@@ -468,6 +588,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -54,6 +54,26 @@ import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
public class UserApi { public class UserApi {
/**
* Utility class for extending HttpRequest.Builder functionality.
*/
private static class HttpRequestBuilderExtensions {
/**
* Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers.
*
* @param builder the HttpRequest.Builder to which headers will be added
* @param headers a map of header names and values to add; may be null
* @return the same HttpRequest.Builder instance with the additional headers set
*/
static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
return builder;
}
}
private final HttpClient memberVarHttpClient; private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper; private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri; private final String memberVarBaseUri;
@@ -76,6 +96,7 @@ public class UserApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
} }
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException { protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes()); String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body); String message = formatExceptionMessage(operationId, response.statusCode(), body);
@@ -144,7 +165,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void createUser(@javax.annotation.Nonnull User user) throws ApiException { public void createUser(@javax.annotation.Nonnull User user) throws ApiException {
createUserWithHttpInfo(user); createUser(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUser(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
createUserWithHttpInfo(user, headers);
} }
/** /**
@@ -155,7 +187,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { public ApiResponse<Void> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user); return createUserWithHttpInfo(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -188,7 +232,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user) throws ApiException { private HttpRequest.Builder createUserRequestBuilder(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUser");
@@ -212,6 +256,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -225,7 +271,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user) throws ApiException { public void createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
createUsersWithArrayInputWithHttpInfo(user); createUsersWithArrayInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
createUsersWithArrayInputWithHttpInfo(user, headers);
} }
/** /**
@@ -236,7 +293,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException { public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user); return createUsersWithArrayInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -269,7 +338,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List<User> user) throws ApiException { private HttpRequest.Builder createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
@@ -293,6 +362,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -306,7 +377,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void createUsersWithListInput(@javax.annotation.Nonnull List<User> user) throws ApiException { public void createUsersWithListInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
createUsersWithListInputWithHttpInfo(user); createUsersWithListInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUsersWithListInput(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
createUsersWithListInputWithHttpInfo(user, headers);
} }
/** /**
@@ -317,7 +399,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException { public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user); return createUsersWithListInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -350,7 +444,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List<User> user) throws ApiException { private HttpRequest.Builder createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set // verify the required parameter 'user' is set
if (user == null) { if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput");
@@ -374,6 +468,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -387,7 +483,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException {
deleteUserWithHttpInfo(username); deleteUser(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deleteUser(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
deleteUserWithHttpInfo(username, headers);
} }
/** /**
@@ -398,7 +505,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { public ApiResponse<Void> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username); return deleteUserWithHttpInfo(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -431,7 +550,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { private HttpRequest.Builder deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
@@ -450,6 +569,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -464,7 +585,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException {
ApiResponse<User> localVarResponse = getUserByNameWithHttpInfo(username); return getUserByName(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return User
* @throws ApiException if fails to make API call
*/
public User getUserByName(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
ApiResponse<User> localVarResponse = getUserByNameWithHttpInfo(username, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -476,7 +609,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<User> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { public ApiResponse<User> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username); return getUserByNameWithHttpInfo(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;User&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<User> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -519,7 +664,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username) throws ApiException { private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
@@ -538,6 +683,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -553,7 +700,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
ApiResponse<String> localVarResponse = loginUserWithHttpInfo(username, password); return loginUser(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = loginUserWithHttpInfo(username, password, headers);
return localVarResponse.getData(); return localVarResponse.getData();
} }
@@ -566,7 +726,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<String> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { public ApiResponse<String> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password); return loginUserWithHttpInfo(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -609,7 +782,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
@@ -648,6 +821,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -660,7 +835,17 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void logoutUser() throws ApiException { public void logoutUser() throws ApiException {
logoutUserWithHttpInfo(); logoutUser(null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void logoutUser(Map<String, String> headers) throws ApiException {
logoutUserWithHttpInfo(headers);
} }
/** /**
@@ -670,7 +855,18 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(); return logoutUserWithHttpInfo(null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> logoutUserWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -703,7 +899,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder logoutUserRequestBuilder() throws ApiException { private HttpRequest.Builder logoutUserRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
@@ -717,6 +913,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }
@@ -731,7 +929,19 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
updateUserWithHttpInfo(username, user); updateUser(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
updateUserWithHttpInfo(username, user, headers);
} }
/** /**
@@ -743,7 +953,20 @@ public class UserApi {
* @throws ApiException if fails to make API call * @throws ApiException if fails to make API call
*/ */
public ApiResponse<Void> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { public ApiResponse<Void> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user); return updateUserWithHttpInfo(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
try { try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(), localVarRequestBuilder.build(),
@@ -776,7 +999,7 @@ public class UserApi {
} }
} }
private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { private HttpRequest.Builder updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
@@ -805,6 +1028,8 @@ public class UserApi {
if (memberVarReadTimeout != null) { if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout); localVarRequestBuilder.timeout(memberVarReadTimeout);
} }
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) { if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder); memberVarInterceptor.accept(localVarRequestBuilder);
} }

View File

@@ -0,0 +1,30 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
#
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
name: Java CI with Maven
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build:
name: Build OpenAPI Petstore
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17, 21 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml

View File

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

View File

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

View File

@@ -0,0 +1,56 @@
.github/workflows/maven.yml
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
api/openapi.yaml
build.gradle
build.sbt
docs/Category.md
docs/ModelApiResponse.md
docs/Order.md
docs/Pet.md
docs/PetApi.md
docs/StoreApi.md
docs/Tag.md
docs/User.md
docs/UserApi.md
git_push.sh
gradle.properties
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
gradlew
gradlew.bat
pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiException.java
src/main/java/org/openapitools/client/ApiResponse.java
src/main/java/org/openapitools/client/Configuration.java
src/main/java/org/openapitools/client/JSON.java
src/main/java/org/openapitools/client/Pair.java
src/main/java/org/openapitools/client/RFC3339DateFormat.java
src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java
src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java
src/main/java/org/openapitools/client/ServerConfiguration.java
src/main/java/org/openapitools/client/ServerVariable.java
src/main/java/org/openapitools/client/api/PetApi.java
src/main/java/org/openapitools/client/api/StoreApi.java
src/main/java/org/openapitools/client/api/UserApi.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/Category.java
src/main/java/org/openapitools/client/model/ModelApiResponse.java
src/main/java/org/openapitools/client/model/Order.java
src/main/java/org/openapitools/client/model/Pet.java
src/main/java/org/openapitools/client/model/Tag.java
src/main/java/org/openapitools/client/model/User.java
src/test/java/org/openapitools/client/api/PetApiTest.java
src/test/java/org/openapitools/client/api/StoreApiTest.java
src/test/java/org/openapitools/client/api/UserApiTest.java
src/test/java/org/openapitools/client/model/CategoryTest.java
src/test/java/org/openapitools/client/model/ModelApiResponseTest.java
src/test/java/org/openapitools/client/model/OrderTest.java
src/test/java/org/openapitools/client/model/PetTest.java
src/test/java/org/openapitools/client/model/TagTest.java
src/test/java/org/openapitools/client/model/UserTest.java

View File

@@ -0,0 +1 @@
7.15.0-SNAPSHOT

View File

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

View File

@@ -0,0 +1,197 @@
# openapi-java-client
OpenAPI Petstore
- API version: 1.0.0
- Build date: 2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]
- Generator version: 7.15.0-SNAPSHOT
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
## Requirements
Building the API client library requires:
1. Java 11+
2. Maven/Gradle
## Installation
To install the API client library to your local Maven repository, simply execute:
```shell
mvn clean install
```
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
```shell
mvn clean deploy
```
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```
### Gradle users
Add this dependency to your project's build file:
```groovy
compile "org.openapitools:openapi-java-client:1.0.0"
```
### Others
At first generate the JAR by executing:
```shell
mvn clean package
```
Then manually install the following JARs:
- `target/openapi-java-client-1.0.0.jar`
- `target/lib/*.jar`
## Getting Started
Please follow the [installation](#installation) instruction and execute the following Java code:
```java
import org.openapitools.client.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.PetApi;
public class PetApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure clients using the `defaultClient` object, such as
// overriding the host and port, timeout, etc.
PetApi apiInstance = new PetApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Pet result = apiInstance.addPet(pet);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#addPet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user
## Documentation for Models
- [Category](docs/Category.md)
- [ModelApiResponse](docs/ModelApiResponse.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Authentication schemes defined for the API:
<a id="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets
<a id="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Recommendation
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used.
## Author

View File

@@ -0,0 +1,865 @@
openapi: 3.0.0
info:
description: "This is a sample server Petstore server. For this sample, you can\
\ use the api key `special-key` to test the authorization filters."
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore
version: 1.0.0
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://petstore.swagger.io/v2
tags:
- description: Everything about your Pets
name: pet
- description: Access to Petstore orders
name: store
- description: Operations about user
name: user
paths:
/pet:
post:
description: ""
operationId: addPet
requestBody:
$ref: "#/components/requestBodies/Pet"
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Pet"
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: successful operation
"405":
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Add a new pet to the store
tags:
- pet
x-content-type: application/json
x-accepts:
- application/json
- application/xml
put:
description: ""
operationId: updatePet
requestBody:
$ref: "#/components/requestBodies/Pet"
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Pet"
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
"405":
description: Validation exception
security:
- petstore_auth:
- write:pets
- read:pets
summary: Update an existing pet
tags:
- pet
x-content-type: application/json
x-accepts:
- application/json
- application/xml
/pet/findByStatus:
get:
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- description: Status values that need to be considered for filter
explode: false
in: query
name: status
required: true
schema:
items:
default: available
enum:
- available
- pending
- sold
type: string
type: array
style: form
responses:
"200":
content:
application/xml:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
application/json:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
description: successful operation
"400":
description: Invalid status value
security:
- petstore_auth:
- read:pets
summary: Finds Pets by status
tags:
- pet
x-accepts:
- application/json
- application/xml
/pet/findByTags:
get:
deprecated: true
description: "Multiple tags can be provided with comma separated strings. Use\
\ tag1, tag2, tag3 for testing."
operationId: findPetsByTags
parameters:
- description: Tags to filter by
explode: false
in: query
name: tags
required: true
schema:
items:
type: string
type: array
style: form
responses:
"200":
content:
application/xml:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
application/json:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
description: successful operation
"400":
description: Invalid tag value
security:
- petstore_auth:
- read:pets
summary: Finds Pets by tags
tags:
- pet
x-accepts:
- application/json
- application/xml
/pet/{petId}:
delete:
description: ""
operationId: deletePet
parameters:
- explode: false
in: header
name: api_key
required: false
schema:
type: string
style: simple
- description: Pet id to delete
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"400":
description: Invalid pet value
security:
- petstore_auth:
- write:pets
- read:pets
summary: Deletes a pet
tags:
- pet
x-accepts:
- application/json
get:
description: Returns a single pet
operationId: getPetById
parameters:
- description: ID of pet to return
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Pet"
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
security:
- api_key: []
summary: Find pet by ID
tags:
- pet
x-accepts:
- application/json
- application/xml
post:
description: ""
operationId: updatePetWithForm
parameters:
- description: ID of pet that needs to be updated
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/updatePetWithForm_request"
responses:
"405":
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Updates a pet in the store with form data
tags:
- pet
x-content-type: application/x-www-form-urlencoded
x-accepts:
- application/json
/pet/{petId}/uploadImage:
post:
description: ""
operationId: uploadFile
parameters:
- description: ID of pet to update
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/uploadFile_request"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
description: successful operation
security:
- petstore_auth:
- write:pets
- read:pets
summary: uploads an image
tags:
- pet
x-content-type: multipart/form-data
x-accepts:
- application/json
/store/inventory:
get:
description: Returns a map of status codes to quantities
operationId: getInventory
responses:
"200":
content:
application/json:
schema:
additionalProperties:
format: int32
type: integer
type: object
description: successful operation
security:
- api_key: []
summary: Returns pet inventories by status
tags:
- store
x-accepts:
- application/json
/store/order:
post:
description: ""
operationId: placeOrder
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Order"
description: order placed for purchasing the pet
required: true
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Order"
application/json:
schema:
$ref: "#/components/schemas/Order"
description: successful operation
"400":
description: Invalid Order
summary: Place an order for a pet
tags:
- store
x-content-type: application/json
x-accepts:
- application/json
- application/xml
/store/order/{orderId}:
delete:
description: For valid response try integer IDs with value < 1000. Anything
above 1000 or nonintegers will generate API errors
operationId: deleteOrder
parameters:
- description: ID of the order that needs to be deleted
explode: false
in: path
name: orderId
required: true
schema:
type: string
style: simple
responses:
"400":
description: Invalid ID supplied
"404":
description: Order not found
summary: Delete purchase order by ID
tags:
- store
x-accepts:
- application/json
get:
description: For valid response try integer IDs with value <= 5 or > 10. Other
values will generate exceptions
operationId: getOrderById
parameters:
- description: ID of pet that needs to be fetched
explode: false
in: path
name: orderId
required: true
schema:
format: int64
maximum: 5
minimum: 1
type: integer
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Order"
application/json:
schema:
$ref: "#/components/schemas/Order"
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Order not found
summary: Find purchase order by ID
tags:
- store
x-accepts:
- application/json
- application/xml
/user:
post:
description: This can only be done by the logged in user.
operationId: createUser
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/User"
description: Created user object
required: true
responses:
default:
description: successful operation
security:
- api_key: []
summary: Create user
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
/user/createWithArray:
post:
description: ""
operationId: createUsersWithArrayInput
requestBody:
$ref: "#/components/requestBodies/UserArray"
responses:
default:
description: successful operation
security:
- api_key: []
summary: Creates list of users with given input array
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
/user/createWithList:
post:
description: ""
operationId: createUsersWithListInput
requestBody:
$ref: "#/components/requestBodies/UserArray"
responses:
default:
description: successful operation
security:
- api_key: []
summary: Creates list of users with given input array
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
/user/login:
get:
description: ""
operationId: loginUser
parameters:
- description: The user name for login
explode: true
in: query
name: username
required: true
schema:
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
type: string
style: form
- description: The password for login in clear text
explode: true
in: query
name: password
required: true
schema:
type: string
style: form
responses:
"200":
content:
application/xml:
schema:
type: string
application/json:
schema:
type: string
description: successful operation
headers:
Set-Cookie:
description: Cookie authentication key for use with the `api_key` apiKey
authentication.
explode: false
schema:
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
type: string
style: simple
X-Rate-Limit:
description: calls per hour allowed by the user
explode: false
schema:
format: int32
type: integer
style: simple
X-Expires-After:
description: date in UTC when token expires
explode: false
schema:
format: date-time
type: string
style: simple
"400":
description: Invalid username/password supplied
summary: Logs user into the system
tags:
- user
x-accepts:
- application/json
- application/xml
/user/logout:
get:
description: ""
operationId: logoutUser
responses:
default:
description: successful operation
security:
- api_key: []
summary: Logs out current logged in user session
tags:
- user
x-accepts:
- application/json
/user/{username}:
delete:
description: This can only be done by the logged in user.
operationId: deleteUser
parameters:
- description: The name that needs to be deleted
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
responses:
"400":
description: Invalid username supplied
"404":
description: User not found
security:
- api_key: []
summary: Delete user
tags:
- user
x-accepts:
- application/json
get:
description: ""
operationId: getUserByName
parameters:
- description: The name that needs to be fetched. Use user1 for testing.
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/User"
application/json:
schema:
$ref: "#/components/schemas/User"
description: successful operation
"400":
description: Invalid username supplied
"404":
description: User not found
summary: Get user by user name
tags:
- user
x-accepts:
- application/json
- application/xml
put:
description: This can only be done by the logged in user.
operationId: updateUser
parameters:
- description: name that need to be deleted
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/User"
description: Updated user object
required: true
responses:
"400":
description: Invalid user supplied
"404":
description: User not found
security:
- api_key: []
summary: Updated user
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
components:
requestBodies:
UserArray:
content:
application/json:
schema:
items:
$ref: "#/components/schemas/User"
type: array
description: List of user object
required: true
Pet:
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
application/xml:
schema:
$ref: "#/components/schemas/Pet"
description: Pet object that needs to be added to the store
required: true
schemas:
ApiResponse:
description: Describes the result of uploading an image resource
example:
code: 0
type: type
message: message
properties:
code:
format: int32
type: integer
type:
type: string
message:
type: string
title: An uploaded response
type: object
Pet:
description: A pet for sale in the pet store
example:
photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
properties:
id:
format: int64
type: integer
category:
$ref: "#/components/schemas/Category"
name:
example: doggie
type: string
photoUrls:
items:
type: string
type: array
xml:
name: photoUrl
wrapped: true
tags:
items:
$ref: "#/components/schemas/Tag"
type: array
xml:
name: tag
wrapped: true
status:
description: pet status in the store
enum:
- available
- pending
- sold
type: string
required:
- name
- photoUrls
title: a Pet
type: object
xml:
name: Pet
Order:
description: An order for a pets from the pet store
example:
petId: 6
quantity: 1
id: 0
shipDate: 2000-01-23T04:56:07.000+00:00
complete: false
status: placed
properties:
id:
format: int64
type: integer
petId:
format: int64
type: integer
quantity:
format: int32
type: integer
shipDate:
format: date-time
type: string
status:
description: Order Status
enum:
- placed
- approved
- delivered
type: string
complete:
default: false
type: boolean
title: Pet Order
type: object
xml:
name: Order
User:
description: A User who is purchasing from the pet store
example:
firstName: firstName
lastName: lastName
password: password
userStatus: 6
phone: phone
id: 0
email: email
username: username
properties:
id:
format: int64
type: integer
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
description: User Status
format: int32
type: integer
title: a User
type: object
xml:
name: User
Category:
description: A category for a pet
example:
name: name
id: 6
properties:
id:
format: int64
type: integer
name:
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
type: string
title: Pet category
type: object
xml:
name: Category
Tag:
description: A tag for a pet
example:
name: name
id: 1
properties:
id:
format: int64
type: integer
name:
type: string
title: Pet Tag
type: object
xml:
name: Tag
updatePetWithForm_request:
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
type: object
uploadFile_request:
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
format: binary
type: string
type: object
securitySchemes:
petstore_auth:
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
scopes:
write:pets: modify pets in your account
read:pets: read your pets
type: oauth2
api_key:
in: header
name: api_key
type: apiKey

View File

@@ -0,0 +1,109 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.diffplug.spotless'
group = 'org.openapitools'
version = '1.0.0'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
// Some text from the schema is copy pasted into the source files as UTF-8
// but the default still seems to be to use platform encoding
tasks.withType(JavaCompile) {
configure(options) {
options.encoding = 'UTF-8'
}
}
javadoc {
options.encoding = 'UTF-8'
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'openapi-java-client'
from components.java
}
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
ext {
jackson_version = "2.17.1"
jakarta_annotation_version = "1.3.5"
beanvalidation_version = "2.0.2"
junit_version = "5.10.2"
httpmime_version = "4.5.13"
}
dependencies {
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}
// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
// comment out below to run spotless as part of the `check` task
enforceCheck false
format 'misc', {
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
target '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat('1.8').aosp().reflowLongStrings()
removeUnusedImports()
importOrder()
}
}

View File

@@ -0,0 +1 @@
# TODO

View File

@@ -0,0 +1,15 @@
# Category
A category for a pet
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**name** | **String** | | [optional] |

View File

@@ -0,0 +1,16 @@
# ModelApiResponse
Describes the result of uploading an image resource
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**code** | **Integer** | | [optional] |
|**type** | **String** | | [optional] |
|**message** | **String** | | [optional] |

View File

@@ -0,0 +1,29 @@
# Order
An order for a pets from the pet store
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**petId** | **Long** | | [optional] |
|**quantity** | **Integer** | | [optional] |
|**shipDate** | **OffsetDateTime** | | [optional] |
|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] |
|**complete** | **Boolean** | | [optional] |
## Enum: StatusEnum
| Name | Value |
|---- | -----|
| PLACED | &quot;placed&quot; |
| APPROVED | &quot;approved&quot; |
| DELIVERED | &quot;delivered&quot; |

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,15 @@
# Tag
A tag for a pet
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**name** | **String** | | [optional] |

View File

@@ -0,0 +1,21 @@
# User
A User who is purchasing from the pet store
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**username** | **String** | | [optional] |
|**firstName** | **String** | | [optional] |
|**lastName** | **String** | | [optional] |
|**email** | **String** | | [optional] |
|**password** | **String** | | [optional] |
|**phone** | **String** | | [optional] |
|**userStatus** | **Integer** | User Status | [optional] |

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,6 @@
# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator).
# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option.
#
# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
# For example, uncomment below to build for Android
#target = android

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -0,0 +1,249 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

@@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,264 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<packaging>jar</packaging>
<name>openapi-java-client</name>
<version>1.0.0</version>
<url>https://github.com/openapitools/openapi-generator</url>
<description>OpenAPI Java</description>
<scm>
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
<url>https://github.com/openapitools/openapi-generator</url>
</scm>
<licenses>
<license>
<name>Unlicense</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>OpenAPI-Generator Contributors</name>
<email>team@openapitools.org</email>
<organization>OpenAPITools.org</organization>
<organizationUrl>http://openapitools.org</organizationUrl>
</developer>
</developers>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3</version>
</requireMavenVersion>
<requireJavaVersion>
<version>11</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<systemPropertyVariables>
<loggerPath>conf/log4j.properties</loggerPath>
</systemPropertyVariables>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Use spotless plugin to automatically format code, remove unused import, etc
To apply changes directly to the file, run `mvn spotless:apply`
Ref: https://github.com/diffplug/spotless/tree/main/plugin-maven
-->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>
<formats>
<!-- you can define as many formats as you want, each is independent -->
<format>
<!-- define the files to apply to -->
<includes>
<include>.gitignore</include>
</includes>
<!-- define the steps to apply to those files -->
<trimTrailingWhitespace/>
<endWithNewline/>
<indent>
<spaces>true</spaces> <!-- or <tabs>true</tabs> -->
<spacesPerTab>4</spacesPerTab> <!-- optional, default is 4 -->
</indent>
</format>
</formats>
<!-- define a language-specific format -->
<java>
<!-- no need to specify files, inferred automatically, but you can if you want -->
<!-- apply a specific flavor of google-java-format and reflow long strings -->
<googleJavaFormat>
<version>1.8</version>
<style>AOSP</style>
<reflowLongStrings>true</reflowLongStrings>
</googleJavaFormat>
<removeUnusedImports/>
<importOrder/>
</java>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>sign-artifacts</id>
<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- JSON processing: jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson-databind-nullable-version}</version>
</dependency>
<!-- @Nullable annotation -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>${jakarta-annotation-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpmime-version}</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<jackson-version>2.17.1</jackson-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<beanvalidation-version>2.0.2</beanvalidation-version>
<httpmime-version>4.5.14</httpmime-version>
<junit-version>5.10.2</junit-version>
<spotless.version>2.27.2</spotless.version>
</properties>
</project>

View File

@@ -0,0 +1 @@
rootProject.name = "openapi-java-client"

View File

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

View File

@@ -0,0 +1,457 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.openapitools.jackson.nullable.JsonNullableModule;
import java.io.InputStream;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpConnectTimeoutException;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.StringJoiner;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Configuration and utility class for API clients.
*
* <p>This class can be constructed and modified, then used to instantiate the
* various API classes. The API classes use the settings in this class to
* configure themselves, but otherwise do not store a link to this class.</p>
*
* <p>This class is mutable and not synchronized, so it is not thread-safe.
* The API classes generated from this are immutable and thread-safe.</p>
*
* <p>The setter methods of this class return the current object to facilitate
* a fluent style of configuration.</p>
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class ApiClient {
protected HttpClient.Builder builder;
protected ObjectMapper mapper;
protected String scheme;
protected String host;
protected int port;
protected String basePath;
protected Consumer<HttpRequest.Builder> interceptor;
protected Consumer<HttpResponse<InputStream>> responseInterceptor;
protected Consumer<HttpResponse<String>> asyncResponseInterceptor;
protected Duration readTimeout;
protected Duration connectTimeout;
public 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.
*
* <p>The value can be null, in which case an empty list is returned.</p>
*
* @param name The query name parameter.
* @param value The query value, which may not be a collection but may be
* null.
* @return A singleton list of the {@link Pair} objects representing the input
* parameters, which is encoded for use in a URL. If the value is null, an
* empty list is returned.
*/
public static List<Pair> parameterToPairs(String name, Object value) {
if (name == null || name.isEmpty() || value == null) {
return Collections.emptyList();
}
return Collections.singletonList(new Pair(urlEncode(name), urlEncode(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<Pair> parameterToPairs(
String collectionFormat, String name, Collection<?> values) {
if (name == null || name.isEmpty() || values == null || values.isEmpty()) {
return Collections.emptyList();
}
// get the collection format (default: csv)
String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat;
// create the params based on the collection format
if ("multi".equals(format)) {
return values.stream()
.map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value))))
.collect(Collectors.toList());
}
String delimiter;
switch(format) {
case "csv":
delimiter = urlEncode(",");
break;
case "ssv":
delimiter = urlEncode(" ");
break;
case "tsv":
delimiter = urlEncode("\t");
break;
case "pipes":
delimiter = urlEncode("|");
break;
default:
throw new IllegalArgumentException("Illegal collection format: " + collectionFormat);
}
StringJoiner joiner = new StringJoiner(delimiter);
for (Object value : values) {
joiner.add(urlEncode(valueToString(value)));
}
return Collections.singletonList(new Pair(urlEncode(name), joiner.toString()));
}
/**
* 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;
}
public static 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());
mapper.registerModule(new RFC3339JavaTimeModule());
return mapper;
}
protected String getDefaultBaseUri() {
return "http://petstore.swagger.io/v2";
}
public static HttpClient.Builder createDefaultHttpClientBuilder() {
return HttpClient.newBuilder();
}
public final 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;
}
/**
* Get an {@link HttpClient} based on the current {@link HttpClient.Builder}.
*
* <p>The returned object is immutable and thread-safe.</p>
*
* @return The HTTP client.
*/
public HttpClient getHttpClient() {
return builder.build();
}
/**
* Set a custom {@link ObjectMapper} to serialize and deserialize the request
* and response bodies.
*
* @param mapper Custom object mapper.
* @return This object.
*/
public ApiClient setObjectMapper(ObjectMapper mapper) {
this.mapper = mapper;
return this;
}
/**
* Get a copy of the current {@link ObjectMapper}.
*
* @return A copy of the current object mapper.
*/
public ObjectMapper getObjectMapper() {
return mapper.copy();
}
/**
* Set a custom host name for the target service.
*
* @param host The host name of the target service.
* @return This object.
*/
public ApiClient setHost(String host) {
this.host = host;
return this;
}
/**
* Set a custom port number for the target service.
*
* @param port The port of the target service. Set this to -1 to reset the
* value to the default for the scheme.
* @return This object.
*/
public ApiClient setPort(int port) {
this.port = port;
return this;
}
/**
* Set a custom base path for the target service, for example '/v2'.
*
* @param basePath The base path against which the rest of the path is
* resolved.
* @return This object.
*/
public ApiClient setBasePath(String basePath) {
this.basePath = basePath;
return this;
}
/**
* Get the base URI to resolve the endpoint paths against.
*
* @return The complete base URI that the rest of the API parameters are
* resolved against.
*/
public String getBaseUri() {
return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath;
}
/**
* Set a custom 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.
*
* <p>A request interceptor is a mechanism for altering each request before it
* is sent. After the request has been fully configured but not yet built, the
* request builder is passed into this function for further modification,
* after which it is sent out.</p>
*
* <p>This is useful for altering the requests in a custom manner, such as
* adding headers. It could also be used for logging and monitoring.</p>
*
* @param interceptor A function invoked before creating each request. A value
* of null resets the interceptor to a no-op.
* @return This object.
*/
public ApiClient setRequestInterceptor(Consumer<HttpRequest.Builder> interceptor) {
this.interceptor = interceptor;
return this;
}
/**
* Get the custom interceptor.
*
* @return The custom interceptor that was set, or null if there isn't any.
*/
public Consumer<HttpRequest.Builder> getRequestInterceptor() {
return interceptor;
}
/**
* Set a custom response interceptor.
*
* <p>This is useful for logging, monitoring or extraction of header variables</p>
*
* @param interceptor A function invoked before creating each request. A value
* of null resets the interceptor to a no-op.
* @return This object.
*/
public ApiClient setResponseInterceptor(Consumer<HttpResponse<InputStream>> 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<HttpResponse<InputStream>> getResponseInterceptor() {
return responseInterceptor;
}
/**
* Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'.
*
* <p>This is useful for logging, monitoring or extraction of header variables</p>
*
* @param interceptor A function invoked before creating each request. A value
* of null resets the interceptor to a no-op.
* @return This object.
*/
public ApiClient setAsyncResponseInterceptor(Consumer<HttpResponse<String>> 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<HttpResponse<String>> getAsyncResponseInterceptor() {
return asyncResponseInterceptor;
}
/**
* Set the read timeout for the http client.
*
* <p>This is the value used by default for each request, though it can be
* overridden on a per-request basis with a request interceptor.</p>
*
* @param readTimeout The read timeout used by default by the http client.
* Setting this value to null resets the timeout to an
* effectively infinite value.
* @return This object.
*/
public ApiClient setReadTimeout(Duration readTimeout) {
this.readTimeout = readTimeout;
return this;
}
/**
* Get the read timeout that was set.
*
* @return The read timeout, or null if no timeout was set. Null represents
* an infinite wait time.
*/
public Duration getReadTimeout() {
return readTimeout;
}
/**
* Sets the connect timeout (in milliseconds) for the http client.
*
* <p> 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;
}
}

View File

@@ -0,0 +1,92 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class ApiException extends Exception {
private static final long serialVersionUID = 1L;
private int code = 0;
private HttpHeaders responseHeaders = null;
private String responseBody = null;
public ApiException() {}
public ApiException(Throwable throwable) {
super(throwable);
}
public ApiException(String message) {
super(message);
}
public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) {
super(message, throwable);
this.code = code;
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) {
this(message, (Throwable) null, code, responseHeaders, responseBody);
}
public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) {
this(message, throwable, code, responseHeaders, null);
}
public ApiException(int code, HttpHeaders responseHeaders, String responseBody) {
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
}
public ApiException(int code, String message) {
super(message);
this.code = code;
}
public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) {
this(code, message);
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
}
/**
* Get the HTTP status code.
*
* @return HTTP status code
*/
public int getCode() {
return code;
}
/**
* Get the HTTP response headers.
*
* @return Headers as an HttpHeaders object
*/
public HttpHeaders getResponseHeaders() {
return responseHeaders;
}
/**
* Get the HTTP response body.
*
* @return Response body in the form of string
*/
public String getResponseBody() {
return responseBody;
}
}

View File

@@ -0,0 +1,60 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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;
/**
* API response returned by API call.
*
* @param <T> The type of data that is deserialized from response body
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class ApiResponse<T> {
final private int statusCode;
final private Map<String, List<String>> headers;
final private T data;
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
this(statusCode, headers, null);
}
/**
* @param statusCode The status code of HTTP response
* @param headers The headers of HTTP response
* @param data The object deserialized from response bod
*/
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
this.statusCode = statusCode;
this.headers = headers;
this.data = data;
}
public int getStatusCode() {
return statusCode;
}
public Map<String, List<String>> getHeaders() {
return headers;
}
public T getData() {
return data;
}
}

View File

@@ -0,0 +1,63 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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.Objects;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class Configuration {
public static final String VERSION = "1.0.0";
private static final AtomicReference<ApiClient> defaultApiClient = new AtomicReference<>();
private static volatile Supplier<ApiClient> apiClientFactory = ApiClient::new;
/**
* Get the default API client, which would be used when creating API instances without providing an API client.
*
* @return Default API client
*/
public static ApiClient getDefaultApiClient() {
ApiClient client = defaultApiClient.get();
if (client == null) {
client = defaultApiClient.updateAndGet(val -> {
if (val != null) { // changed by another thread
return val;
}
return apiClientFactory.get();
});
}
return client;
}
/**
* Set the default API client, which would be used when creating API instances without providing an API client.
*
* @param apiClient API client
*/
public static void setDefaultApiClient(ApiClient apiClient) {
defaultApiClient.set(apiClient);
}
/**
* set the callback used to create new ApiClient objects
*/
public static void setApiClientFactory(Supplier<ApiClient> factory) {
apiClientFactory = Objects.requireNonNull(factory);
}
private Configuration() {
}
}

View File

@@ -0,0 +1,264 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
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;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class JSON {
private ObjectMapper mapper;
public JSON() {
mapper = JsonMapper.builder()
.serializationInclusion(JsonInclude.Include.NON_NULL)
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
.defaultDateFormat(new RFC3339DateFormat())
.addModule(new JavaTimeModule())
.build();
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<Class<?>>());
}
return null;
}
/**
* Helper class to register the discriminator mappings.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
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<String, Class<?>> discriminatorMappings;
// Constructs a new class discriminator.
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
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<Class<?>> 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;
}
}
/**
* 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<Class<?>> 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);
// Traverse the oneOf/anyOf composed schemas.
Map<String, Class<?>> descendants = modelDescendants.get(modelClass);
if (descendants != null) {
for (Class<?> childType : descendants.values()) {
if (isInstanceOf(childType, inst, visitedClasses)) {
return true;
}
}
}
return false;
}
/**
* A map of discriminators for all model classes.
*/
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>();
/**
* A map of oneOf/anyOf descendants for each model class.
*/
private static Map<Class<?>, Map<String, Class<?>>> modelDescendants = new HashMap<>();
/**
* 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<String, Class<?>> mappings) {
ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings);
modelDiscriminators.put(modelClass, m);
}
/**
* 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<String, Class<?>> descendants) {
modelDescendants.put(modelClass, descendants);
}
private static 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;
}
}

View File

@@ -0,0 +1,37 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class Pair {
private final String name;
private final String value;
public Pair(String name, String value) {
this.name = isValidString(name) ? name : "";
this.value = isValidString(value) ? value : "";
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
private static boolean isValidString(String arg) {
return arg != null;
}
}

View File

@@ -0,0 +1,58 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
import java.text.DecimalFormat;
import java.util.GregorianCalendar;
import java.util.TimeZone;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat()
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
this.numberFormat = new DecimalFormat();
}
@Override
public Date parse(String source) {
return parse(source, new ParsePosition(0));
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition);
}
@Override
public Object clone() {
return super.clone();
}
}

View File

@@ -0,0 +1,100 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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.io.IOException;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAccessor;
import java.util.function.BiFunction;
import java.util.function.Function;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature;
import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class RFC3339InstantDeserializer<T extends Temporal> extends InstantDeserializer<T> {
private static final long serialVersionUID = 1L;
private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault();
private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
= JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault();
public static final RFC3339InstantDeserializer<Instant> INSTANT = new RFC3339InstantDeserializer<>(
Instant.class, DateTimeFormatter.ISO_INSTANT,
Instant::from,
a -> Instant.ofEpochMilli( a.value ),
a -> Instant.ofEpochSecond( a.integer, a.fraction ),
null,
true, // yes, replace zero offset with Z
DEFAULT_NORMALIZE_ZONE_ID,
DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
);
public static final RFC3339InstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>(
OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME,
OffsetDateTime::from,
a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ),
a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ),
(d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ?
d :
d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ),
true, // yes, replace zero offset with Z
DEFAULT_NORMALIZE_ZONE_ID,
DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
);
public static final RFC3339InstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new RFC3339InstantDeserializer<>(
ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME,
ZonedDateTime::from,
a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ),
a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ),
ZonedDateTime::withZoneSameInstant,
false, // keep zero offset and Z separate since zones explicitly supported
DEFAULT_NORMALIZE_ZONE_ID,
DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
);
protected RFC3339InstantDeserializer(
Class<T> supportedType,
DateTimeFormatter formatter,
Function<TemporalAccessor, T> parsedToValue,
Function<FromIntegerArguments, T> fromMilliseconds,
Function<FromDecimalArguments, T> fromNanoseconds,
BiFunction<T, ZoneId, T> adjust,
boolean replaceZeroOffsetAsZ,
boolean normalizeZoneId,
boolean readNumericStringsAsTimestamp) {
super(
supportedType,
formatter,
parsedToValue,
fromMilliseconds,
fromNanoseconds,
adjust,
replaceZeroOffsetAsZ,
normalizeZoneId,
readNumericStringsAsTimestamp
);
}
@Override
protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException {
return super._fromString(p, ctxt, string0.replace( ' ', 'T' ));
}
}

View File

@@ -0,0 +1,32 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZonedDateTime;
import com.fasterxml.jackson.databind.module.SimpleModule;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class RFC3339JavaTimeModule extends SimpleModule {
private static final long serialVersionUID = 1L;
public RFC3339JavaTimeModule() {
super("RFC3339JavaTimeModule");
addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT);
addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME);
addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME);
}
}

View File

@@ -0,0 +1,72 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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.Map;
/**
* Representing a Server configuration.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class ServerConfiguration {
public String URL;
public String description;
public Map<String, ServerVariable> variables;
/**
* @param URL A URL to the target host.
* @param description A description of the host designated by the URL.
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
*/
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
this.URL = URL;
this.description = description;
this.variables = variables;
}
/**
* Format URL template using given variables.
*
* @param variables A map between a variable name and its value.
* @return Formatted URL.
*/
public String URL(Map<String, String> variables) {
String url = this.URL;
// go through variables and replace placeholders
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
String name = variable.getKey();
ServerVariable serverVariable = variable.getValue();
String value = serverVariable.defaultValue;
if (variables != null && variables.containsKey(name)) {
value = variables.get(name);
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replace("{" + name + "}", value);
}
return url;
}
/**
* Format URL template using default server variables.
*
* @return Formatted URL.
*/
public String URL() {
return URL(null);
}
}

View File

@@ -0,0 +1,37 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* 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.HashSet;
/**
* Representing a Server Variable for server URL template substitution.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class ServerVariable {
public String description;
public String defaultValue;
public HashSet<String> enumValues = null;
/**
* @param description A description for the server variable.
* @param defaultValue The default value to use for substitution.
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
*/
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
this.description = description;
this.defaultValue = defaultValue;
this.enumValues = enumValues;
}
}

View File

@@ -0,0 +1,535 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import org.openapitools.client.model.Order;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import 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.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;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class StoreApi {
private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
private final Duration memberVarReadTimeout;
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
private final Consumer<HttpResponse<String>> memberVarAsyncResponseInterceptor;
public StoreApi() {
this(Configuration.getDefaultApiClient());
}
public StoreApi(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<InputStream> 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 operationId + " call failed with: " + statusCode + " - " + body;
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @throws ApiException if fails to make API call
*/
public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException {
return deleteOrder(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deleteOrder(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
deleteOrderWithHttpInfo(orderId, headers);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException {
return deleteOrderWithHttpInfo(orderId, null);
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("deleteOrder", 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 deleteOrderRequestBuilder(@javax.annotation.Nonnull String orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/store/order/{orderId}"
.replace("{orderId}", ApiClient.urlEncode(orderId.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return Map&lt;String, Integer&gt;
* @throws ApiException if fails to make API call
*/
public Map<String, Integer> getInventory() throws ApiException {
return getInventory(, null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return Map&lt;String, Integer&gt;
* @throws ApiException if fails to make API call
*/
public Map<String, Integer> getInventory(Map<String, String> headers) throws ApiException {
ApiResponse<Map<String, Integer>> localVarResponse = getInventoryWithHttpInfo(headers);
return localVarResponse.getData();
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @return ApiResponse&lt;Map&lt;String, Integer&gt;&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
return getInventoryWithHttpInfo(, null);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Map&lt;String, Integer&gt;&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("getInventory", localVarResponse);
}
if (localVarResponse.body() == null) {
return new ApiResponse<Map<String, Integer>>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null
);
}
String responseBody = new String(localVarResponse.body().readAllBytes());
localVarResponse.body().close();
return new ApiResponse<Map<String, Integer>>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<Map<String, Integer>>() {})
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder getInventoryRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/store/inventory";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @return Order
* @throws ApiException if fails to make API call
*/
public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException {
return getOrderById(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return Order
* @throws ApiException if fails to make API call
*/
public Order getOrderById(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
ApiResponse<Order> localVarResponse = getOrderByIdWithHttpInfo(orderId, headers);
return localVarResponse.getData();
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException {
return getOrderByIdWithHttpInfo(orderId, null);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("getOrderById", localVarResponse);
}
if (localVarResponse.body() == null) {
return new ApiResponse<Order>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null
);
}
String responseBody = new String(localVarResponse.body().readAllBytes());
localVarResponse.body().close();
return new ApiResponse<Order>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<Order>() {})
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder getOrderByIdRequestBuilder(@javax.annotation.Nonnull Long orderId, Map<String, String> headers) throws ApiException {
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/store/order/{orderId}"
.replace("{orderId}", ApiClient.urlEncode(orderId.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/xml, application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @return Order
* @throws ApiException if fails to make API call
*/
public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException {
return placeOrder(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return Order
* @throws ApiException if fails to make API call
*/
public Order placeOrder(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
ApiResponse<Order> localVarResponse = placeOrderWithHttpInfo(order, headers);
return localVarResponse.getData();
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException {
return placeOrderWithHttpInfo(order, null);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Order&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Order> placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("placeOrder", localVarResponse);
}
if (localVarResponse.body() == null) {
return new ApiResponse<Order>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null
);
}
String responseBody = new String(localVarResponse.body().readAllBytes());
localVarResponse.body().close();
return new ApiResponse<Order>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<Order>() {})
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder placeOrderRequestBuilder(@javax.annotation.Nonnull Order order, Map<String, String> headers) throws ApiException {
// verify the required parameter 'order' is set
if (order == null) {
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/store/order";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/xml, application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(order);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
}

View File

@@ -0,0 +1,995 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.ApiResponse;
import org.openapitools.client.Configuration;
import org.openapitools.client.Pair;
import java.time.OffsetDateTime;
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.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;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class UserApi {
private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
private final Duration memberVarReadTimeout;
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
private final Consumer<HttpResponse<String>> memberVarAsyncResponseInterceptor;
public UserApi() {
this(Configuration.getDefaultApiClient());
}
public UserApi(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<InputStream> 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 operationId + " call failed with: " + statusCode + " - " + body;
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @throws ApiException if fails to make API call
*/
public void createUser(@javax.annotation.Nonnull User user) throws ApiException {
return createUser(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUser(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
createUserWithHttpInfo(user, headers);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException {
return createUserWithHttpInfo(user, null);
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUserWithHttpInfo(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("createUser", 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 createUserRequestBuilder(@javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUser");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @throws ApiException if fails to make API call
*/
public void createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithArrayInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUsersWithArrayInput(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
createUsersWithArrayInputWithHttpInfo(user, headers);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithArrayInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("createUsersWithArrayInput", 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 createUsersWithArrayInputRequestBuilder(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/createWithArray";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @throws ApiException if fails to make API call
*/
public void createUsersWithListInput(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithListInput(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void createUsersWithListInput(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
createUsersWithListInputWithHttpInfo(user, headers);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user) throws ApiException {
return createUsersWithListInputWithHttpInfo(user, null);
}
/**
* Creates list of users with given input array
*
* @param user List of user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("createUsersWithListInput", 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 createUsersWithListInputRequestBuilder(@javax.annotation.Nonnull List<User> user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'user' is set
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/createWithList";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @throws ApiException if fails to make API call
*/
public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException {
return deleteUser(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void deleteUser(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
deleteUserWithHttpInfo(username, headers);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
return deleteUserWithHttpInfo(username, null);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> deleteUserWithHttpInfo(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("deleteUser", 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 deleteUserRequestBuilder(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/{username}"
.replace("{username}", ApiClient.urlEncode(username.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return User
* @throws ApiException if fails to make API call
*/
public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException {
return getUserByName(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return User
* @throws ApiException if fails to make API call
*/
public User getUserByName(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
ApiResponse<User> localVarResponse = getUserByNameWithHttpInfo(username, headers);
return localVarResponse.getData();
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @return ApiResponse&lt;User&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<User> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException {
return getUserByNameWithHttpInfo(username, null);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing. (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;User&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<User> getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("getUserByName", localVarResponse);
}
if (localVarResponse.body() == null) {
return new ApiResponse<User>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null
);
}
String responseBody = new String(localVarResponse.body().readAllBytes());
localVarResponse.body().close();
return new ApiResponse<User>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<User>() {})
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder getUserByNameRequestBuilder(@javax.annotation.Nonnull String username, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/{username}"
.replace("{username}", ApiClient.urlEncode(username.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/xml, application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return String
* @throws ApiException if fails to make API call
*/
public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
return loginUser(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return String
* @throws ApiException if fails to make API call
*/
public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
ApiResponse<String> localVarResponse = loginUserWithHttpInfo(username, password, headers);
return localVarResponse.getData();
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException {
return loginUserWithHttpInfo(username, password, null);
}
/**
* Logs user into the system
*
* @param username The user name for login (required)
* @param password The password for login in clear text (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;String&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("loginUser", localVarResponse);
}
if (localVarResponse.body() == null) {
return new ApiResponse<String>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null
);
}
String responseBody = new String(localVarResponse.body().readAllBytes());
localVarResponse.body().close();
return new ApiResponse<String>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference<String>() {})
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
private HttpRequest.Builder loginUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
}
// verify the required parameter 'password' is set
if (password == null) {
throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/login";
List<Pair> localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "username";
localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username));
localVarQueryParameterBaseName = "password";
localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password));
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("Accept", "application/xml, application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Logs out current logged in user session
*
* @throws ApiException if fails to make API call
*/
public void logoutUser() throws ApiException {
return logoutUser(, null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void logoutUser(Map<String, String> headers) throws ApiException {
logoutUserWithHttpInfo(headers);
}
/**
* Logs out current logged in user session
*
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
return logoutUserWithHttpInfo(, null);
}
/**
* Logs out current logged in user session
*
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> logoutUserWithHttpInfo(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("logoutUser", 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 logoutUserRequestBuilder(Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/logout";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @throws ApiException if fails to make API call
*/
public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
return updateUser(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @throws ApiException if fails to make API call
*/
public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
updateUserWithHttpInfo(username, user, headers);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException {
return updateUserWithHttpInfo(username, user, null);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted (required)
* @param user Updated user object (required)
* @param headers Optional headers to include in the request
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
*/
public ApiResponse<Void> updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
try {
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("updateUser", 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 updateUserRequestBuilder(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, Map<String, String> headers) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
}
// verify the required parameter 'user' is set
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/user/{username}"
.replace("{username}", ApiClient.urlEncode(username.toString()));
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(user);
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
localVarRequestBuilder.header(entry.getKey(), entry.getValue());
}
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
}

View File

@@ -0,0 +1,147 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.lang.reflect.Type;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public abstract class AbstractOpenApiSchema {
// store the actual instance of the schema/object
private Object instance;
// is nullable
private Boolean isNullable;
// schema type (e.g. oneOf, anyOf)
private final String schemaType;
public AbstractOpenApiSchema(String schemaType, Boolean isNullable) {
this.schemaType = schemaType;
this.isNullable = isNullable;
}
/**
* Get the list of oneOf/anyOf composed schemas allowed to be stored in this object
*
* @return an instance of the actual schema/object
*/
public abstract Map<String, Class<?>> getSchemas();
/**
* Get the actual instance
*
* @return an instance of the actual schema/object
*/
@JsonValue
public Object getActualInstance() {return instance;}
/**
* Set the actual instance
*
* @param instance the actual instance of the schema/object
*/
public void setActualInstance(Object instance) {this.instance = instance;}
/**
* Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well
*
* @return an instance of the actual schema/object
*/
public Object getActualInstanceRecursively() {
return getActualInstanceRecursively(this);
}
private Object getActualInstanceRecursively(AbstractOpenApiSchema object) {
if (object.getActualInstance() == null) {
return null;
} else if (object.getActualInstance() instanceof AbstractOpenApiSchema) {
return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance());
} else {
return object.getActualInstance();
}
}
/**
* Get the schema type (e.g. anyOf, oneOf)
*
* @return the schema type
*/
public String getSchemaType() {
return schemaType;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ").append(getClass()).append(" {\n");
sb.append(" instance: ").append(toIndentedString(instance)).append("\n");
sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n");
sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AbstractOpenApiSchema a = (AbstractOpenApiSchema) o;
return Objects.equals(this.instance, a.instance) &&
Objects.equals(this.isNullable, a.isNullable) &&
Objects.equals(this.schemaType, a.schemaType);
}
@Override
public int hashCode() {
return Objects.hash(instance, isNullable, schemaType);
}
/**
* Is nullable
*
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
}
}

View File

@@ -0,0 +1,187 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.ApiClient;
/**
* A category for a pet
*/
@JsonPropertyOrder({
Category.JSON_PROPERTY_ID,
Category.JSON_PROPERTY_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class Category {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable
private Long id;
public static final String JSON_PROPERTY_NAME = "name";
@javax.annotation.Nullable
private String name;
public Category() {
}
public Category id(@javax.annotation.Nullable Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(@javax.annotation.Nullable Long id) {
this.id = id;
}
public Category name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
/**
* Return true if this Category object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,223 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.ApiClient;
/**
* Describes the result of uploading an image resource
*/
@JsonPropertyOrder({
ModelApiResponse.JSON_PROPERTY_CODE,
ModelApiResponse.JSON_PROPERTY_TYPE,
ModelApiResponse.JSON_PROPERTY_MESSAGE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class ModelApiResponse {
public static final String JSON_PROPERTY_CODE = "code";
@javax.annotation.Nullable
private Integer code;
public static final String JSON_PROPERTY_TYPE = "type";
@javax.annotation.Nullable
private String type;
public static final String JSON_PROPERTY_MESSAGE = "message";
@javax.annotation.Nullable
private String message;
public ModelApiResponse() {
}
public ModelApiResponse code(@javax.annotation.Nullable Integer code) {
this.code = code;
return this;
}
/**
* Get code
* @return code
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CODE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getCode() {
return code;
}
@JsonProperty(JSON_PROPERTY_CODE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCode(@javax.annotation.Nullable Integer code) {
this.code = code;
}
public ModelApiResponse type(@javax.annotation.Nullable String type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getType() {
return type;
}
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(@javax.annotation.Nullable String type) {
this.type = type;
}
public ModelApiResponse message(@javax.annotation.Nullable String message) {
this.message = message;
return this;
}
/**
* Get message
* @return message
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_MESSAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getMessage() {
return message;
}
@JsonProperty(JSON_PROPERTY_MESSAGE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setMessage(@javax.annotation.Nullable String message) {
this.message = message;
}
/**
* Return true if this ApiResponse object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(this.code, _apiResponse.code) &&
Objects.equals(this.type, _apiResponse.type) &&
Objects.equals(this.message, _apiResponse.message);
}
@Override
public int hashCode() {
return Objects.hash(code, type, message);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelApiResponse {\n");
sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `code` to the URL query string
if (getCode() != null) {
joiner.add(String.format("%scode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCode()))));
}
// add `type` to the URL query string
if (getType() != null) {
joiner.add(String.format("%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType()))));
}
// add `message` to the URL query string
if (getMessage() != null) {
joiner.add(String.format("%smessage%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMessage()))));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,369 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.ApiClient;
/**
* An order for a pets from the pet store
*/
@JsonPropertyOrder({
Order.JSON_PROPERTY_ID,
Order.JSON_PROPERTY_PET_ID,
Order.JSON_PROPERTY_QUANTITY,
Order.JSON_PROPERTY_SHIP_DATE,
Order.JSON_PROPERTY_STATUS,
Order.JSON_PROPERTY_COMPLETE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class Order {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable
private Long id;
public static final String JSON_PROPERTY_PET_ID = "petId";
@javax.annotation.Nullable
private Long petId;
public static final String JSON_PROPERTY_QUANTITY = "quantity";
@javax.annotation.Nullable
private Integer quantity;
public static final String JSON_PROPERTY_SHIP_DATE = "shipDate";
@javax.annotation.Nullable
private OffsetDateTime shipDate;
/**
* Order Status
*/
public enum StatusEnum {
PLACED(String.valueOf("placed")),
APPROVED(String.valueOf("approved")),
DELIVERED(String.valueOf("delivered"));
private String value;
StatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_STATUS = "status";
@javax.annotation.Nullable
private StatusEnum status;
public static final String JSON_PROPERTY_COMPLETE = "complete";
@javax.annotation.Nullable
private Boolean complete = false;
public Order() {
}
public Order id(@javax.annotation.Nullable Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(@javax.annotation.Nullable Long id) {
this.id = id;
}
public Order petId(@javax.annotation.Nullable Long petId) {
this.petId = petId;
return this;
}
/**
* Get petId
* @return petId
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PET_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getPetId() {
return petId;
}
@JsonProperty(JSON_PROPERTY_PET_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPetId(@javax.annotation.Nullable Long petId) {
this.petId = petId;
}
public Order quantity(@javax.annotation.Nullable Integer quantity) {
this.quantity = quantity;
return this;
}
/**
* Get quantity
* @return quantity
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_QUANTITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getQuantity() {
return quantity;
}
@JsonProperty(JSON_PROPERTY_QUANTITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setQuantity(@javax.annotation.Nullable Integer quantity) {
this.quantity = quantity;
}
public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) {
this.shipDate = shipDate;
return this;
}
/**
* Get shipDate
* @return shipDate
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SHIP_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OffsetDateTime getShipDate() {
return shipDate;
}
@JsonProperty(JSON_PROPERTY_SHIP_DATE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) {
this.shipDate = shipDate;
}
public Order status(@javax.annotation.Nullable StatusEnum status) {
this.status = status;
return this;
}
/**
* Order Status
* @return status
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public StatusEnum getStatus() {
return status;
}
@JsonProperty(JSON_PROPERTY_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setStatus(@javax.annotation.Nullable StatusEnum status) {
this.status = status;
}
public Order complete(@javax.annotation.Nullable Boolean complete) {
this.complete = complete;
return this;
}
/**
* Get complete
* @return complete
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_COMPLETE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getComplete() {
return complete;
}
@JsonProperty(JSON_PROPERTY_COMPLETE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setComplete(@javax.annotation.Nullable Boolean complete) {
this.complete = complete;
}
/**
* Return true if this Order object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
public int hashCode() {
return Objects.hash(id, petId, quantity, shipDate, status, complete);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `petId` to the URL query string
if (getPetId() != null) {
joiner.add(String.format("%spetId%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPetId()))));
}
// add `quantity` to the URL query string
if (getQuantity() != null) {
joiner.add(String.format("%squantity%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getQuantity()))));
}
// add `shipDate` to the URL query string
if (getShipDate() != null) {
joiner.add(String.format("%sshipDate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getShipDate()))));
}
// add `status` to the URL query string
if (getStatus() != null) {
joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus()))));
}
// add `complete` to the URL query string
if (getComplete() != null) {
joiner.add(String.format("%scomplete%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getComplete()))));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,397 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.ApiClient;
/**
* A pet for sale in the pet store
*/
@JsonPropertyOrder({
Pet.JSON_PROPERTY_ID,
Pet.JSON_PROPERTY_CATEGORY,
Pet.JSON_PROPERTY_NAME,
Pet.JSON_PROPERTY_PHOTO_URLS,
Pet.JSON_PROPERTY_TAGS,
Pet.JSON_PROPERTY_STATUS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class Pet {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable
private Long id;
public static final String JSON_PROPERTY_CATEGORY = "category";
@javax.annotation.Nullable
private Category category;
public static final String JSON_PROPERTY_NAME = "name";
@javax.annotation.Nonnull
private String name;
public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls";
@javax.annotation.Nonnull
private List<String> photoUrls = new ArrayList<>();
public static final String JSON_PROPERTY_TAGS = "tags";
@javax.annotation.Nullable
private List<Tag> tags = new ArrayList<>();
/**
* pet status in the store
*/
public enum StatusEnum {
AVAILABLE(String.valueOf("available")),
PENDING(String.valueOf("pending")),
SOLD(String.valueOf("sold"));
private String value;
StatusEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_STATUS = "status";
@javax.annotation.Nullable
private StatusEnum status;
public Pet() {
}
public Pet id(@javax.annotation.Nullable Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(@javax.annotation.Nullable Long id) {
this.id = id;
}
public Pet category(@javax.annotation.Nullable Category category) {
this.category = category;
return this;
}
/**
* Get category
* @return category
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_CATEGORY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Category getCategory() {
return category;
}
@JsonProperty(JSON_PROPERTY_CATEGORY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCategory(@javax.annotation.Nullable Category category) {
this.category = category;
}
public Pet name(@javax.annotation.Nonnull String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setName(@javax.annotation.Nonnull String name) {
this.name = name;
}
public Pet photoUrls(@javax.annotation.Nonnull List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
public Pet addPhotoUrlsItem(String photoUrlsItem) {
if (this.photoUrls == null) {
this.photoUrls = new ArrayList<>();
}
this.photoUrls.add(photoUrlsItem);
return this;
}
/**
* Get photoUrls
* @return photoUrls
*/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<String> getPhotoUrls() {
return photoUrls;
}
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setPhotoUrls(@javax.annotation.Nonnull List<String> photoUrls) {
this.photoUrls = photoUrls;
}
public Pet tags(@javax.annotation.Nullable List<Tag> tags) {
this.tags = tags;
return this;
}
public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<>();
}
this.tags.add(tagsItem);
return this;
}
/**
* Get tags
* @return tags
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Tag> getTags() {
return tags;
}
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setTags(@javax.annotation.Nullable List<Tag> tags) {
this.tags = tags;
}
public Pet status(@javax.annotation.Nullable StatusEnum status) {
this.status = status;
return this;
}
/**
* pet status in the store
* @return status
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public StatusEnum getStatus() {
return status;
}
@JsonProperty(JSON_PROPERTY_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setStatus(@javax.annotation.Nullable StatusEnum status) {
this.status = status;
}
/**
* Return true if this Pet object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
public int hashCode() {
return Objects.hash(id, category, name, photoUrls, tags, status);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pet {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" category: ").append(toIndentedString(category)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `category` to the URL query string
if (getCategory() != null) {
joiner.add(getCategory().toUrlQueryString(prefix + "category" + suffix));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
// add `photoUrls` to the URL query string
if (getPhotoUrls() != null) {
for (int i = 0; i < getPhotoUrls().size(); i++) {
joiner.add(String.format("%sphotoUrls%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
ApiClient.urlEncode(ApiClient.valueToString(getPhotoUrls().get(i)))));
}
}
// add `tags` to the URL query string
if (getTags() != null) {
for (int i = 0; i < getTags().size(); i++) {
if (getTags().get(i) != null) {
joiner.add(getTags().get(i).toUrlQueryString(String.format("%stags%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
// add `status` to the URL query string
if (getStatus() != null) {
joiner.add(String.format("%sstatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getStatus()))));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,187 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.ApiClient;
/**
* A tag for a pet
*/
@JsonPropertyOrder({
Tag.JSON_PROPERTY_ID,
Tag.JSON_PROPERTY_NAME
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class Tag {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable
private Long id;
public static final String JSON_PROPERTY_NAME = "name";
@javax.annotation.Nullable
private String name;
public Tag() {
}
public Tag id(@javax.annotation.Nullable Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(@javax.annotation.Nullable Long id) {
this.id = id;
}
public Tag name(@javax.annotation.Nullable String name) {
this.name = name;
return this;
}
/**
* Get name
* @return name
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(@javax.annotation.Nullable String name) {
this.name = name;
}
/**
* Return true if this Tag object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Tag {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `name` to the URL query string
if (getName() != null) {
joiner.add(String.format("%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName()))));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,403 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.ApiClient;
/**
* A User who is purchasing from the pet store
*/
@JsonPropertyOrder({
User.JSON_PROPERTY_ID,
User.JSON_PROPERTY_USERNAME,
User.JSON_PROPERTY_FIRST_NAME,
User.JSON_PROPERTY_LAST_NAME,
User.JSON_PROPERTY_EMAIL,
User.JSON_PROPERTY_PASSWORD,
User.JSON_PROPERTY_PHONE,
User.JSON_PROPERTY_USER_STATUS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-08T21:07:41.448223+07:00[Asia/Bangkok]", comments = "Generator version: 7.15.0-SNAPSHOT")
public class User {
public static final String JSON_PROPERTY_ID = "id";
@javax.annotation.Nullable
private Long id;
public static final String JSON_PROPERTY_USERNAME = "username";
@javax.annotation.Nullable
private String username;
public static final String JSON_PROPERTY_FIRST_NAME = "firstName";
@javax.annotation.Nullable
private String firstName;
public static final String JSON_PROPERTY_LAST_NAME = "lastName";
@javax.annotation.Nullable
private String lastName;
public static final String JSON_PROPERTY_EMAIL = "email";
@javax.annotation.Nullable
private String email;
public static final String JSON_PROPERTY_PASSWORD = "password";
@javax.annotation.Nullable
private String password;
public static final String JSON_PROPERTY_PHONE = "phone";
@javax.annotation.Nullable
private String phone;
public static final String JSON_PROPERTY_USER_STATUS = "userStatus";
@javax.annotation.Nullable
private Integer userStatus;
public User() {
}
public User id(@javax.annotation.Nullable Long id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(@javax.annotation.Nullable Long id) {
this.id = id;
}
public User username(@javax.annotation.Nullable String username) {
this.username = username;
return this;
}
/**
* Get username
* @return username
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_USERNAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getUsername() {
return username;
}
@JsonProperty(JSON_PROPERTY_USERNAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUsername(@javax.annotation.Nullable String username) {
this.username = username;
}
public User firstName(@javax.annotation.Nullable String firstName) {
this.firstName = firstName;
return this;
}
/**
* Get firstName
* @return firstName
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_FIRST_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getFirstName() {
return firstName;
}
@JsonProperty(JSON_PROPERTY_FIRST_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFirstName(@javax.annotation.Nullable String firstName) {
this.firstName = firstName;
}
public User lastName(@javax.annotation.Nullable String lastName) {
this.lastName = lastName;
return this;
}
/**
* Get lastName
* @return lastName
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_LAST_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getLastName() {
return lastName;
}
@JsonProperty(JSON_PROPERTY_LAST_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setLastName(@javax.annotation.Nullable String lastName) {
this.lastName = lastName;
}
public User email(@javax.annotation.Nullable String email) {
this.email = email;
return this;
}
/**
* Get email
* @return email
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_EMAIL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getEmail() {
return email;
}
@JsonProperty(JSON_PROPERTY_EMAIL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setEmail(@javax.annotation.Nullable String email) {
this.email = email;
}
public User password(@javax.annotation.Nullable String password) {
this.password = password;
return this;
}
/**
* Get password
* @return password
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PASSWORD)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getPassword() {
return password;
}
@JsonProperty(JSON_PROPERTY_PASSWORD)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPassword(@javax.annotation.Nullable String password) {
this.password = password;
}
public User phone(@javax.annotation.Nullable String phone) {
this.phone = phone;
return this;
}
/**
* Get phone
* @return phone
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PHONE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getPhone() {
return phone;
}
@JsonProperty(JSON_PROPERTY_PHONE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setPhone(@javax.annotation.Nullable String phone) {
this.phone = phone;
}
public User userStatus(@javax.annotation.Nullable Integer userStatus) {
this.userStatus = userStatus;
return this;
}
/**
* User Status
* @return userStatus
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_USER_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Integer getUserStatus() {
return userStatus;
}
@JsonProperty(JSON_PROPERTY_USER_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUserStatus(@javax.annotation.Nullable Integer userStatus) {
this.userStatus = userStatus;
}
/**
* Return true if this User object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
public int hashCode() {
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class User {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" username: ").append(toIndentedString(username)).append("\n");
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
sb.append(" email: ").append(toIndentedString(email)).append("\n");
sb.append(" password: ").append(toIndentedString(password)).append("\n");
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format("%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}
// add `username` to the URL query string
if (getUsername() != null) {
joiner.add(String.format("%susername%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUsername()))));
}
// add `firstName` to the URL query string
if (getFirstName() != null) {
joiner.add(String.format("%sfirstName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFirstName()))));
}
// add `lastName` to the URL query string
if (getLastName() != null) {
joiner.add(String.format("%slastName%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLastName()))));
}
// add `email` to the URL query string
if (getEmail() != null) {
joiner.add(String.format("%semail%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEmail()))));
}
// add `password` to the URL query string
if (getPassword() != null) {
joiner.add(String.format("%spassword%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPassword()))));
}
// add `phone` to the URL query string
if (getPhone() != null) {
joiner.add(String.format("%sphone%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPhone()))));
}
// add `userStatus` to the URL query string
if (getUserStatus() != null) {
joiner.add(String.format("%suserStatus%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getUserStatus()))));
}
return joiner.toString();
}
}

View File

@@ -0,0 +1,180 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* API tests for PetApi
*/
@Disabled
public class PetApiTest {
private final PetApi api = new PetApi();
/**
* Add a new pet to the store
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void addPetTest() throws ApiException {
Pet pet = null;
Pet response =
api.addPet(pet);
// TODO: test validations
}
/**
* Deletes a pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deletePetTest() throws ApiException {
Long petId = null;
String apiKey = null;
api.deletePet(petId, apiKey);
// TODO: test validations
}
/**
* Finds Pets by status
*
* Multiple status values can be provided with comma separated strings
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void findPetsByStatusTest() throws ApiException {
List<String> status = null;
List<Pet> response =
api.findPetsByStatus(status);
// TODO: test validations
}
/**
* Finds Pets by tags
*
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void findPetsByTagsTest() throws ApiException {
List<String> tags = null;
List<Pet> response =
api.findPetsByTags(tags);
// TODO: test validations
}
/**
* Find pet by ID
*
* Returns a single pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getPetByIdTest() throws ApiException {
Long petId = null;
Pet response =
api.getPetById(petId);
// TODO: test validations
}
/**
* Update an existing pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetTest() throws ApiException {
Pet pet = null;
Pet response =
api.updatePet(pet);
// TODO: test validations
}
/**
* Updates a pet in the store with form data
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetWithFormTest() throws ApiException {
Long petId = null;
String name = null;
String status = null;
api.updatePetWithForm(petId, name, status);
// TODO: test validations
}
/**
* uploads an image
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileTest() throws ApiException {
Long petId = null;
String additionalMetadata = null;
File _file = null;
ModelApiResponse response =
api.uploadFile(petId, additionalMetadata, _file);
// TODO: test validations
}
}

View File

@@ -0,0 +1,104 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Order;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* API tests for StoreApi
*/
@Disabled
public class StoreApiTest {
private final StoreApi api = new StoreApi();
/**
* Delete purchase order by ID
*
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deleteOrderTest() throws ApiException {
String orderId = null;
api.deleteOrder(orderId);
// TODO: test validations
}
/**
* Returns pet inventories by status
*
* Returns a map of status codes to quantities
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getInventoryTest() throws ApiException {
Map<String, Integer> response =
api.getInventory();
// TODO: test validations
}
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getOrderByIdTest() throws ApiException {
Long orderId = null;
Order response =
api.getOrderById(orderId);
// TODO: test validations
}
/**
* Place an order for a pet
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void placeOrderTest() throws ApiException {
Order order = null;
Order response =
api.placeOrder(order);
// TODO: test validations
}
}

View File

@@ -0,0 +1,175 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import java.time.OffsetDateTime;
import org.openapitools.client.model.User;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* API tests for UserApi
*/
@Disabled
public class UserApiTest {
private final UserApi api = new UserApi();
/**
* Create user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUserTest() throws ApiException {
User user = null;
api.createUser(user);
// TODO: test validations
}
/**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithArrayInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithArrayInput(user);
// TODO: test validations
}
/**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithListInputTest() throws ApiException {
List<User> user = null;
api.createUsersWithListInput(user);
// TODO: test validations
}
/**
* Delete user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deleteUserTest() throws ApiException {
String username = null;
api.deleteUser(username);
// TODO: test validations
}
/**
* Get user by user name
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getUserByNameTest() throws ApiException {
String username = null;
User response =
api.getUserByName(username);
// TODO: test validations
}
/**
* Logs user into the system
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void loginUserTest() throws ApiException {
String username = null;
String password = null;
String response =
api.loginUser(username, password);
// TODO: test validations
}
/**
* Logs out current logged in user session
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void logoutUserTest() throws ApiException {
api.logoutUser();
// TODO: test validations
}
/**
* Updated user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updateUserTest() throws ApiException {
String username = null;
User user = null;
api.updateUser(username, user);
// TODO: test validations
}
}

View File

@@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for Category
*/
class CategoryTest {
private final Category model = new Category();
/**
* Model tests for Category
*/
@Test
void testCategory() {
// TODO: test Category
}
/**
* Test the property 'id'
*/
@Test
void idTest() {
// TODO: test id
}
/**
* Test the property 'name'
*/
@Test
void nameTest() {
// TODO: test name
}
}

View File

@@ -0,0 +1,64 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for ModelApiResponse
*/
class ModelApiResponseTest {
private final ModelApiResponse model = new ModelApiResponse();
/**
* Model tests for ModelApiResponse
*/
@Test
void testModelApiResponse() {
// TODO: test ModelApiResponse
}
/**
* Test the property 'code'
*/
@Test
void codeTest() {
// TODO: test code
}
/**
* Test the property 'type'
*/
@Test
void typeTest() {
// TODO: test type
}
/**
* Test the property 'message'
*/
@Test
void messageTest() {
// TODO: test message
}
}

View File

@@ -0,0 +1,89 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for Order
*/
class OrderTest {
private final Order model = new Order();
/**
* Model tests for Order
*/
@Test
void testOrder() {
// TODO: test Order
}
/**
* Test the property 'id'
*/
@Test
void idTest() {
// TODO: test id
}
/**
* Test the property 'petId'
*/
@Test
void petIdTest() {
// TODO: test petId
}
/**
* Test the property 'quantity'
*/
@Test
void quantityTest() {
// TODO: test quantity
}
/**
* Test the property 'shipDate'
*/
@Test
void shipDateTest() {
// TODO: test shipDate
}
/**
* Test the property 'status'
*/
@Test
void statusTest() {
// TODO: test status
}
/**
* Test the property 'complete'
*/
@Test
void completeTest() {
// TODO: test complete
}
}

View File

@@ -0,0 +1,92 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for Pet
*/
class PetTest {
private final Pet model = new Pet();
/**
* Model tests for Pet
*/
@Test
void testPet() {
// TODO: test Pet
}
/**
* Test the property 'id'
*/
@Test
void idTest() {
// TODO: test id
}
/**
* Test the property 'category'
*/
@Test
void categoryTest() {
// TODO: test category
}
/**
* Test the property 'name'
*/
@Test
void nameTest() {
// TODO: test name
}
/**
* Test the property 'photoUrls'
*/
@Test
void photoUrlsTest() {
// TODO: test photoUrls
}
/**
* Test the property 'tags'
*/
@Test
void tagsTest() {
// TODO: test tags
}
/**
* Test the property 'status'
*/
@Test
void statusTest() {
// TODO: test status
}
}

View File

@@ -0,0 +1,56 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for Tag
*/
class TagTest {
private final Tag model = new Tag();
/**
* Model tests for Tag
*/
@Test
void testTag() {
// TODO: test Tag
}
/**
* Test the property 'id'
*/
@Test
void idTest() {
// TODO: test id
}
/**
* Test the property 'name'
*/
@Test
void nameTest() {
// TODO: test name
}
}

View File

@@ -0,0 +1,104 @@
/*
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for User
*/
class UserTest {
private final User model = new User();
/**
* Model tests for User
*/
@Test
void testUser() {
// TODO: test User
}
/**
* Test the property 'id'
*/
@Test
void idTest() {
// TODO: test id
}
/**
* Test the property 'username'
*/
@Test
void usernameTest() {
// TODO: test username
}
/**
* Test the property 'firstName'
*/
@Test
void firstNameTest() {
// TODO: test firstName
}
/**
* Test the property 'lastName'
*/
@Test
void lastNameTest() {
// TODO: test lastName
}
/**
* Test the property 'email'
*/
@Test
void emailTest() {
// TODO: test email
}
/**
* Test the property 'password'
*/
@Test
void passwordTest() {
// TODO: test password
}
/**
* Test the property 'phone'
*/
@Test
void phoneTest() {
// TODO: test phone
}
/**
* Test the property 'userStatus'
*/
@Test
void userStatusTest() {
// TODO: test userStatus
}
}

View File

@@ -0,0 +1,30 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
#
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
name: Java CI with Maven
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build:
name: Build OpenAPI Petstore
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17, 21 ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml

View File

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

View File

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

View File

@@ -0,0 +1,56 @@
.github/workflows/maven.yml
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
api/openapi.yaml
build.gradle
build.sbt
docs/Category.md
docs/ModelApiResponse.md
docs/Order.md
docs/Pet.md
docs/PetApi.md
docs/StoreApi.md
docs/Tag.md
docs/User.md
docs/UserApi.md
git_push.sh
gradle.properties
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
gradlew
gradlew.bat
pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiException.java
src/main/java/org/openapitools/client/ApiResponse.java
src/main/java/org/openapitools/client/Configuration.java
src/main/java/org/openapitools/client/JSON.java
src/main/java/org/openapitools/client/Pair.java
src/main/java/org/openapitools/client/RFC3339DateFormat.java
src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java
src/main/java/org/openapitools/client/RFC3339JavaTimeModule.java
src/main/java/org/openapitools/client/ServerConfiguration.java
src/main/java/org/openapitools/client/ServerVariable.java
src/main/java/org/openapitools/client/api/PetApi.java
src/main/java/org/openapitools/client/api/StoreApi.java
src/main/java/org/openapitools/client/api/UserApi.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/Category.java
src/main/java/org/openapitools/client/model/ModelApiResponse.java
src/main/java/org/openapitools/client/model/Order.java
src/main/java/org/openapitools/client/model/Pet.java
src/main/java/org/openapitools/client/model/Tag.java
src/main/java/org/openapitools/client/model/User.java
src/test/java/org/openapitools/client/api/PetApiTest.java
src/test/java/org/openapitools/client/api/StoreApiTest.java
src/test/java/org/openapitools/client/api/UserApiTest.java
src/test/java/org/openapitools/client/model/CategoryTest.java
src/test/java/org/openapitools/client/model/ModelApiResponseTest.java
src/test/java/org/openapitools/client/model/OrderTest.java
src/test/java/org/openapitools/client/model/PetTest.java
src/test/java/org/openapitools/client/model/TagTest.java
src/test/java/org/openapitools/client/model/UserTest.java

View File

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

View File

@@ -0,0 +1,197 @@
# openapi-java-client
OpenAPI Petstore
- API version: 1.0.0
- Build date: 2025-07-08T21:08:28.986952+07:00[Asia/Bangkok]
- Generator version: 7.15.0-SNAPSHOT
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
## Requirements
Building the API client library requires:
1. Java 11+
2. Maven/Gradle
## Installation
To install the API client library to your local Maven repository, simply execute:
```shell
mvn clean install
```
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
```shell
mvn clean deploy
```
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
### Maven users
Add this dependency to your project's POM:
```xml
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-java-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```
### Gradle users
Add this dependency to your project's build file:
```groovy
compile "org.openapitools:openapi-java-client:1.0.0"
```
### Others
At first generate the JAR by executing:
```shell
mvn clean package
```
Then manually install the following JARs:
- `target/openapi-java-client-1.0.0.jar`
- `target/lib/*.jar`
## Getting Started
Please follow the [installation](#installation) instruction and execute the following Java code:
```java
import org.openapitools.client.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.PetApi;
public class PetApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure clients using the `defaultClient` object, such as
// overriding the host and port, timeout, etc.
PetApi apiInstance = new PetApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Pet result = apiInstance.addPet(pet);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#addPet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**addPetWithHttpInfo**](docs/PetApi.md#addPetWithHttpInfo) | **POST** /pet | Add a new pet to the store
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**deletePetWithHttpInfo**](docs/PetApi.md#deletePetWithHttpInfo) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByStatusWithHttpInfo**](docs/PetApi.md#findPetsByStatusWithHttpInfo) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**findPetsByTagsWithHttpInfo**](docs/PetApi.md#findPetsByTagsWithHttpInfo) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**getPetByIdWithHttpInfo**](docs/PetApi.md#getPetByIdWithHttpInfo) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithHttpInfo**](docs/PetApi.md#updatePetWithHttpInfo) | **PUT** /pet | Update an existing pet
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**updatePetWithFormWithHttpInfo**](docs/PetApi.md#updatePetWithFormWithHttpInfo) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
*PetApi* | [**uploadFileWithHttpInfo**](docs/PetApi.md#uploadFileWithHttpInfo) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**deleteOrderWithHttpInfo**](docs/StoreApi.md#deleteOrderWithHttpInfo) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getInventoryWithHttpInfo**](docs/StoreApi.md#getInventoryWithHttpInfo) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**getOrderByIdWithHttpInfo**](docs/StoreApi.md#getOrderByIdWithHttpInfo) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
*StoreApi* | [**placeOrderWithHttpInfo**](docs/StoreApi.md#placeOrderWithHttpInfo) | **POST** /store/order | Place an order for a pet
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
*UserApi* | [**createUserWithHttpInfo**](docs/UserApi.md#createUserWithHttpInfo) | **POST** /user | Create user
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithArrayInputWithHttpInfo**](docs/UserApi.md#createUsersWithArrayInputWithHttpInfo) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**createUsersWithListInputWithHttpInfo**](docs/UserApi.md#createUsersWithListInputWithHttpInfo) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**deleteUserWithHttpInfo**](docs/UserApi.md#deleteUserWithHttpInfo) | **DELETE** /user/{username} | Delete user
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
*UserApi* | [**getUserByNameWithHttpInfo**](docs/UserApi.md#getUserByNameWithHttpInfo) | **GET** /user/{username} | Get user by user name
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
*UserApi* | [**loginUserWithHttpInfo**](docs/UserApi.md#loginUserWithHttpInfo) | **GET** /user/login | Logs user into the system
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**logoutUserWithHttpInfo**](docs/UserApi.md#logoutUserWithHttpInfo) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
*UserApi* | [**updateUserWithHttpInfo**](docs/UserApi.md#updateUserWithHttpInfo) | **PUT** /user/{username} | Updated user
## Documentation for Models
- [Category](docs/Category.md)
- [ModelApiResponse](docs/ModelApiResponse.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)
<a id="documentation-for-authorization"></a>
## Documentation for Authorization
Authentication schemes defined for the API:
<a id="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets
<a id="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
## Recommendation
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used.
## Author

View File

@@ -0,0 +1,865 @@
openapi: 3.0.0
info:
description: "This is a sample server Petstore server. For this sample, you can\
\ use the api key `special-key` to test the authorization filters."
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore
version: 1.0.0
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://petstore.swagger.io/v2
tags:
- description: Everything about your Pets
name: pet
- description: Access to Petstore orders
name: store
- description: Operations about user
name: user
paths:
/pet:
post:
description: ""
operationId: addPet
requestBody:
$ref: "#/components/requestBodies/Pet"
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Pet"
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: successful operation
"405":
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Add a new pet to the store
tags:
- pet
x-content-type: application/json
x-accepts:
- application/json
- application/xml
put:
description: ""
operationId: updatePet
requestBody:
$ref: "#/components/requestBodies/Pet"
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Pet"
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
"405":
description: Validation exception
security:
- petstore_auth:
- write:pets
- read:pets
summary: Update an existing pet
tags:
- pet
x-content-type: application/json
x-accepts:
- application/json
- application/xml
/pet/findByStatus:
get:
description: Multiple status values can be provided with comma separated strings
operationId: findPetsByStatus
parameters:
- description: Status values that need to be considered for filter
explode: false
in: query
name: status
required: true
schema:
items:
default: available
enum:
- available
- pending
- sold
type: string
type: array
style: form
responses:
"200":
content:
application/xml:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
application/json:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
description: successful operation
"400":
description: Invalid status value
security:
- petstore_auth:
- read:pets
summary: Finds Pets by status
tags:
- pet
x-accepts:
- application/json
- application/xml
/pet/findByTags:
get:
deprecated: true
description: "Multiple tags can be provided with comma separated strings. Use\
\ tag1, tag2, tag3 for testing."
operationId: findPetsByTags
parameters:
- description: Tags to filter by
explode: false
in: query
name: tags
required: true
schema:
items:
type: string
type: array
style: form
responses:
"200":
content:
application/xml:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
application/json:
schema:
items:
$ref: "#/components/schemas/Pet"
type: array
description: successful operation
"400":
description: Invalid tag value
security:
- petstore_auth:
- read:pets
summary: Finds Pets by tags
tags:
- pet
x-accepts:
- application/json
- application/xml
/pet/{petId}:
delete:
description: ""
operationId: deletePet
parameters:
- explode: false
in: header
name: api_key
required: false
schema:
type: string
style: simple
- description: Pet id to delete
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"400":
description: Invalid pet value
security:
- petstore_auth:
- write:pets
- read:pets
summary: Deletes a pet
tags:
- pet
x-accepts:
- application/json
get:
description: Returns a single pet
operationId: getPetById
parameters:
- description: ID of pet to return
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Pet"
application/json:
schema:
$ref: "#/components/schemas/Pet"
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Pet not found
security:
- api_key: []
summary: Find pet by ID
tags:
- pet
x-accepts:
- application/json
- application/xml
post:
description: ""
operationId: updatePetWithForm
parameters:
- description: ID of pet that needs to be updated
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/updatePetWithForm_request"
responses:
"405":
description: Invalid input
security:
- petstore_auth:
- write:pets
- read:pets
summary: Updates a pet in the store with form data
tags:
- pet
x-content-type: application/x-www-form-urlencoded
x-accepts:
- application/json
/pet/{petId}/uploadImage:
post:
description: ""
operationId: uploadFile
parameters:
- description: ID of pet to update
explode: false
in: path
name: petId
required: true
schema:
format: int64
type: integer
style: simple
requestBody:
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/uploadFile_request"
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
description: successful operation
security:
- petstore_auth:
- write:pets
- read:pets
summary: uploads an image
tags:
- pet
x-content-type: multipart/form-data
x-accepts:
- application/json
/store/inventory:
get:
description: Returns a map of status codes to quantities
operationId: getInventory
responses:
"200":
content:
application/json:
schema:
additionalProperties:
format: int32
type: integer
type: object
description: successful operation
security:
- api_key: []
summary: Returns pet inventories by status
tags:
- store
x-accepts:
- application/json
/store/order:
post:
description: ""
operationId: placeOrder
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Order"
description: order placed for purchasing the pet
required: true
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Order"
application/json:
schema:
$ref: "#/components/schemas/Order"
description: successful operation
"400":
description: Invalid Order
summary: Place an order for a pet
tags:
- store
x-content-type: application/json
x-accepts:
- application/json
- application/xml
/store/order/{orderId}:
delete:
description: For valid response try integer IDs with value < 1000. Anything
above 1000 or nonintegers will generate API errors
operationId: deleteOrder
parameters:
- description: ID of the order that needs to be deleted
explode: false
in: path
name: orderId
required: true
schema:
type: string
style: simple
responses:
"400":
description: Invalid ID supplied
"404":
description: Order not found
summary: Delete purchase order by ID
tags:
- store
x-accepts:
- application/json
get:
description: For valid response try integer IDs with value <= 5 or > 10. Other
values will generate exceptions
operationId: getOrderById
parameters:
- description: ID of pet that needs to be fetched
explode: false
in: path
name: orderId
required: true
schema:
format: int64
maximum: 5
minimum: 1
type: integer
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/Order"
application/json:
schema:
$ref: "#/components/schemas/Order"
description: successful operation
"400":
description: Invalid ID supplied
"404":
description: Order not found
summary: Find purchase order by ID
tags:
- store
x-accepts:
- application/json
- application/xml
/user:
post:
description: This can only be done by the logged in user.
operationId: createUser
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/User"
description: Created user object
required: true
responses:
default:
description: successful operation
security:
- api_key: []
summary: Create user
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
/user/createWithArray:
post:
description: ""
operationId: createUsersWithArrayInput
requestBody:
$ref: "#/components/requestBodies/UserArray"
responses:
default:
description: successful operation
security:
- api_key: []
summary: Creates list of users with given input array
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
/user/createWithList:
post:
description: ""
operationId: createUsersWithListInput
requestBody:
$ref: "#/components/requestBodies/UserArray"
responses:
default:
description: successful operation
security:
- api_key: []
summary: Creates list of users with given input array
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
/user/login:
get:
description: ""
operationId: loginUser
parameters:
- description: The user name for login
explode: true
in: query
name: username
required: true
schema:
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
type: string
style: form
- description: The password for login in clear text
explode: true
in: query
name: password
required: true
schema:
type: string
style: form
responses:
"200":
content:
application/xml:
schema:
type: string
application/json:
schema:
type: string
description: successful operation
headers:
Set-Cookie:
description: Cookie authentication key for use with the `api_key` apiKey
authentication.
explode: false
schema:
example: AUTH_KEY=abcde12345; Path=/; HttpOnly
type: string
style: simple
X-Rate-Limit:
description: calls per hour allowed by the user
explode: false
schema:
format: int32
type: integer
style: simple
X-Expires-After:
description: date in UTC when token expires
explode: false
schema:
format: date-time
type: string
style: simple
"400":
description: Invalid username/password supplied
summary: Logs user into the system
tags:
- user
x-accepts:
- application/json
- application/xml
/user/logout:
get:
description: ""
operationId: logoutUser
responses:
default:
description: successful operation
security:
- api_key: []
summary: Logs out current logged in user session
tags:
- user
x-accepts:
- application/json
/user/{username}:
delete:
description: This can only be done by the logged in user.
operationId: deleteUser
parameters:
- description: The name that needs to be deleted
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
responses:
"400":
description: Invalid username supplied
"404":
description: User not found
security:
- api_key: []
summary: Delete user
tags:
- user
x-accepts:
- application/json
get:
description: ""
operationId: getUserByName
parameters:
- description: The name that needs to be fetched. Use user1 for testing.
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
responses:
"200":
content:
application/xml:
schema:
$ref: "#/components/schemas/User"
application/json:
schema:
$ref: "#/components/schemas/User"
description: successful operation
"400":
description: Invalid username supplied
"404":
description: User not found
summary: Get user by user name
tags:
- user
x-accepts:
- application/json
- application/xml
put:
description: This can only be done by the logged in user.
operationId: updateUser
parameters:
- description: name that need to be deleted
explode: false
in: path
name: username
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/User"
description: Updated user object
required: true
responses:
"400":
description: Invalid user supplied
"404":
description: User not found
security:
- api_key: []
summary: Updated user
tags:
- user
x-content-type: application/json
x-accepts:
- application/json
components:
requestBodies:
UserArray:
content:
application/json:
schema:
items:
$ref: "#/components/schemas/User"
type: array
description: List of user object
required: true
Pet:
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
application/xml:
schema:
$ref: "#/components/schemas/Pet"
description: Pet object that needs to be added to the store
required: true
schemas:
ApiResponse:
description: Describes the result of uploading an image resource
example:
code: 0
type: type
message: message
properties:
code:
format: int32
type: integer
type:
type: string
message:
type: string
title: An uploaded response
type: object
Pet:
description: A pet for sale in the pet store
example:
photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 0
category:
name: name
id: 6
tags:
- name: name
id: 1
- name: name
id: 1
status: available
properties:
id:
format: int64
type: integer
category:
$ref: "#/components/schemas/Category"
name:
example: doggie
type: string
photoUrls:
items:
type: string
type: array
xml:
name: photoUrl
wrapped: true
tags:
items:
$ref: "#/components/schemas/Tag"
type: array
xml:
name: tag
wrapped: true
status:
description: pet status in the store
enum:
- available
- pending
- sold
type: string
required:
- name
- photoUrls
title: a Pet
type: object
xml:
name: Pet
Order:
description: An order for a pets from the pet store
example:
petId: 6
quantity: 1
id: 0
shipDate: 2000-01-23T04:56:07.000+00:00
complete: false
status: placed
properties:
id:
format: int64
type: integer
petId:
format: int64
type: integer
quantity:
format: int32
type: integer
shipDate:
format: date-time
type: string
status:
description: Order Status
enum:
- placed
- approved
- delivered
type: string
complete:
default: false
type: boolean
title: Pet Order
type: object
xml:
name: Order
User:
description: A User who is purchasing from the pet store
example:
firstName: firstName
lastName: lastName
password: password
userStatus: 6
phone: phone
id: 0
email: email
username: username
properties:
id:
format: int64
type: integer
username:
type: string
firstName:
type: string
lastName:
type: string
email:
type: string
password:
type: string
phone:
type: string
userStatus:
description: User Status
format: int32
type: integer
title: a User
type: object
xml:
name: User
Category:
description: A category for a pet
example:
name: name
id: 6
properties:
id:
format: int64
type: integer
name:
pattern: "^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$"
type: string
title: Pet category
type: object
xml:
name: Category
Tag:
description: A tag for a pet
example:
name: name
id: 1
properties:
id:
format: int64
type: integer
name:
type: string
title: Pet Tag
type: object
xml:
name: Tag
updatePetWithForm_request:
properties:
name:
description: Updated name of the pet
type: string
status:
description: Updated status of the pet
type: string
type: object
uploadFile_request:
properties:
additionalMetadata:
description: Additional data to pass to server
type: string
file:
description: file to upload
format: binary
type: string
type: object
securitySchemes:
petstore_auth:
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
scopes:
write:pets: modify pets in your account
read:pets: read your pets
type: oauth2
api_key:
in: header
name: api_key
type: apiKey

View File

@@ -0,0 +1,109 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.diffplug.spotless'
group = 'org.openapitools'
version = '1.0.0'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
// Some text from the schema is copy pasted into the source files as UTF-8
// but the default still seems to be to use platform encoding
tasks.withType(JavaCompile) {
configure(options) {
options.encoding = 'UTF-8'
}
}
javadoc {
options.encoding = 'UTF-8'
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'openapi-java-client'
from components.java
}
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
ext {
jackson_version = "2.17.1"
jakarta_annotation_version = "1.3.5"
beanvalidation_version = "2.0.2"
junit_version = "5.10.2"
httpmime_version = "4.5.13"
}
dependencies {
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "org.openapitools:jackson-databind-nullable:0.2.1"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
}
// Use spotless plugin to automatically format code, remove unused import, etc
// To apply changes directly to the file, run `gradlew spotlessApply`
// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle
spotless {
// comment out below to run spotless as part of the `check` task
enforceCheck false
format 'misc', {
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to
target '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces() // Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat('1.8').aosp().reflowLongStrings()
removeUnusedImports()
importOrder()
}
}

View File

@@ -0,0 +1 @@
# TODO

View File

@@ -0,0 +1,15 @@
# Category
A category for a pet
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**name** | **String** | | [optional] |

View File

@@ -0,0 +1,16 @@
# ModelApiResponse
Describes the result of uploading an image resource
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**code** | **Integer** | | [optional] |
|**type** | **String** | | [optional] |
|**message** | **String** | | [optional] |

View File

@@ -0,0 +1,29 @@
# Order
An order for a pets from the pet store
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**petId** | **Long** | | [optional] |
|**quantity** | **Integer** | | [optional] |
|**shipDate** | **OffsetDateTime** | | [optional] |
|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] |
|**complete** | **Boolean** | | [optional] |
## Enum: StatusEnum
| Name | Value |
|---- | -----|
| PLACED | &quot;placed&quot; |
| APPROVED | &quot;approved&quot; |
| DELIVERED | &quot;delivered&quot; |

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,15 @@
# Tag
A tag for a pet
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**name** | **String** | | [optional] |

View File

@@ -0,0 +1,21 @@
# User
A User who is purchasing from the pet store
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**username** | **String** | | [optional] |
|**firstName** | **String** | | [optional] |
|**lastName** | **String** | | [optional] |
|**email** | **String** | | [optional] |
|**password** | **String** | | [optional] |
|**phone** | **String** | | [optional] |
|**userStatus** | **Integer** | User Status | [optional] |

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