[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

@@ -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")
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 ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
@@ -71,6 +91,7 @@ public class AnotherFakeApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), 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
*/
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 {
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client);
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -170,8 +203,20 @@ public class AnotherFakeApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client);
HttpRequest.Builder localVarRequestBuilder = call123testSpecialTagsRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (client == null) {
throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags");
@@ -224,6 +269,8 @@ public class AnotherFakeApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
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")
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 ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
@@ -71,6 +91,7 @@ public class DefaultApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), 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
*/
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 {
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder();
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -168,8 +200,19 @@ public class DefaultApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder();
HttpRequest.Builder localVarRequestBuilder = fooGetRequestBuilder(headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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();
@@ -212,6 +255,8 @@ public class DefaultApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
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")
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 ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
@@ -77,6 +97,7 @@ public class FakeClassnameTags123Api {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), 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
*/
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 {
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client);
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -176,8 +209,20 @@ public class FakeClassnameTags123Api {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client);
HttpRequest.Builder localVarRequestBuilder = testClassnameRequestBuilder(client, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (client == null) {
throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname");
@@ -230,6 +275,8 @@ public class FakeClassnameTags123Api {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
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")
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 ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
@@ -79,6 +99,7 @@ public class PetApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), 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
*/
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 {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet);
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -171,8 +204,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet);
HttpRequest.Builder localVarRequestBuilder = addPetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet");
@@ -217,6 +262,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -232,8 +279,21 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey);
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -257,8 +317,21 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey);
HttpRequest.Builder localVarRequestBuilder = deletePetRequestBuilder(petId, apiKey, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet");
@@ -301,6 +374,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -315,8 +390,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status);
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -346,8 +433,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status);
HttpRequest.Builder localVarRequestBuilder = findPetsByStatusRequestBuilder(status, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (status == null) {
throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus");
@@ -409,6 +508,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -425,8 +526,22 @@ public class PetApi {
*/
@Deprecated
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 {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags);
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -458,8 +573,22 @@ public class PetApi {
*/
@Deprecated
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 {
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags);
HttpRequest.Builder localVarRequestBuilder = findPetsByTagsRequestBuilder(tags, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (tags == null) {
throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags");
@@ -521,6 +650,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -535,8 +666,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId);
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -566,8 +709,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId);
HttpRequest.Builder localVarRequestBuilder = getPetByIdRequestBuilder(petId, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById");
@@ -615,6 +770,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -629,8 +786,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet);
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -653,8 +822,20 @@ public class PetApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet);
HttpRequest.Builder localVarRequestBuilder = updatePetRequestBuilder(pet, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (pet == null) {
throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet");
@@ -699,6 +880,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -715,8 +898,22 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status);
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -741,8 +938,22 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status);
HttpRequest.Builder localVarRequestBuilder = updatePetWithFormRequestBuilder(petId, name, status, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm");
@@ -799,6 +1010,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -815,8 +1028,22 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file);
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -848,8 +1075,22 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file);
HttpRequest.Builder localVarRequestBuilder = uploadFileRequestBuilder(petId, additionalMetadata, _file, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");
@@ -933,6 +1174,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -949,8 +1192,22 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata);
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -982,8 +1239,22 @@ public class PetApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata);
HttpRequest.Builder localVarRequestBuilder = uploadFileWithRequiredFileRequestBuilder(petId, requiredFile, additionalMetadata, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (petId == null) {
throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile");
@@ -1071,6 +1342,8 @@ public class PetApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
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")
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 ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
@@ -77,6 +97,7 @@ public class StoreApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), 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
*/
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 {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId);
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -169,8 +202,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId);
HttpRequest.Builder localVarRequestBuilder = deleteOrderRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder");
@@ -210,6 +255,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -223,8 +270,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder();
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -253,8 +311,19 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder();
HttpRequest.Builder localVarRequestBuilder = getInventoryRequestBuilder(headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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();
@@ -297,6 +366,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -311,8 +382,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId);
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -342,8 +425,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId);
HttpRequest.Builder localVarRequestBuilder = getOrderByIdRequestBuilder(orderId, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
@@ -391,6 +486,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -405,8 +502,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order);
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -436,8 +545,20 @@ public class StoreApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order);
HttpRequest.Builder localVarRequestBuilder = placeOrderRequestBuilder(order, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (order == null) {
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
@@ -490,6 +611,8 @@ public class StoreApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
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")
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 ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
@@ -78,6 +98,7 @@ public class UserApi {
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
private ApiException getApiException(String operationId, HttpResponse<String> response) {
String message = formatExceptionMessage(operationId, response.statusCode(), 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
*/
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 {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user);
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -170,8 +203,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user);
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUser");
@@ -216,6 +261,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -230,8 +277,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user);
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -254,8 +313,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user);
HttpRequest.Builder localVarRequestBuilder = createUsersWithArrayInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
@@ -300,6 +371,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -314,8 +387,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user);
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -338,8 +423,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user);
HttpRequest.Builder localVarRequestBuilder = createUsersWithListInputRequestBuilder(user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (user == null) {
throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput");
@@ -384,6 +481,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -398,8 +497,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username);
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -422,8 +533,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username);
HttpRequest.Builder localVarRequestBuilder = deleteUserRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser");
@@ -463,6 +586,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -477,8 +602,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username);
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -508,8 +645,20 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username);
HttpRequest.Builder localVarRequestBuilder = getUserByNameRequestBuilder(username, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName");
@@ -557,6 +706,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -572,8 +723,21 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password);
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -604,8 +768,21 @@ public class UserApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password);
HttpRequest.Builder localVarRequestBuilder = loginUserRequestBuilder(username, password, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");
@@ -673,6 +850,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -686,8 +865,19 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder();
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -709,8 +899,19 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder();
HttpRequest.Builder localVarRequestBuilder = logoutUserRequestBuilder(headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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();
@@ -745,6 +946,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
@@ -760,8 +963,21 @@ public class UserApi {
* @throws ApiException if fails to make API call
*/
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 {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user);
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
@@ -785,8 +1001,21 @@ public class UserApi {
* @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 {
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 {
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user);
HttpRequest.Builder localVarRequestBuilder = updateUserRequestBuilder(username, user, headers);
return memberVarHttpClient.sendAsync(
localVarRequestBuilder.build(),
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
if (username == null) {
throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser");
@@ -836,6 +1065,8 @@ public class UserApi {
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
// Add custom headers if provided
localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers);
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}