mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 22:56:10 +00:00
Merge remote-tracking branch 'origin/master' into 5.2.x
This commit is contained in:
@@ -25,7 +25,6 @@ import java.net.URLEncoder;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.charset.Charset;
|
||||
import java.time.Duration;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -36,6 +35,8 @@ 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.
|
||||
*
|
||||
@@ -52,8 +53,6 @@ import java.util.stream.Collectors;
|
||||
@javax.annotation.processing.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ApiClient {
|
||||
|
||||
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
|
||||
private HttpClient.Builder builder;
|
||||
private ObjectMapper mapper;
|
||||
private String scheme;
|
||||
@@ -176,7 +175,7 @@ public class ApiClient {
|
||||
public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) {
|
||||
this.builder = builder;
|
||||
this.mapper = mapper;
|
||||
updateBaseUri(baseUri);
|
||||
updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
|
||||
interceptor = null;
|
||||
readTimeout = null;
|
||||
responseInterceptor = null;
|
||||
|
||||
@@ -58,6 +58,14 @@ public class AnotherFakeApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test special tags
|
||||
* To test special tags and operation ID starting with number
|
||||
@@ -87,10 +95,7 @@ public class AnotherFakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"call123testSpecialTags call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "call123testSpecialTags call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,6 +58,14 @@ public class DefaultApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -85,10 +93,7 @@ public class DefaultApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"fooGet call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "fooGet call received non-success response");
|
||||
}
|
||||
return new ApiResponse<InlineResponseDefault>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -67,6 +67,14 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Health check endpoint
|
||||
*
|
||||
@@ -94,10 +102,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"fakeHealthGet call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "fakeHealthGet call received non-success response");
|
||||
}
|
||||
return new ApiResponse<HealthCheckResult>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -161,10 +166,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"fakeOuterBooleanSerialize call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "fakeOuterBooleanSerialize call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Boolean>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -234,10 +236,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"fakeOuterCompositeSerialize call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "fakeOuterCompositeSerialize call received non-success response");
|
||||
}
|
||||
return new ApiResponse<OuterComposite>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -307,10 +306,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"fakeOuterNumberSerialize call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "fakeOuterNumberSerialize call received non-success response");
|
||||
}
|
||||
return new ApiResponse<BigDecimal>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -380,10 +376,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"fakeOuterStringSerialize call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "fakeOuterStringSerialize call received non-success response");
|
||||
}
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -451,10 +444,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"getArrayOfEnums call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "getArrayOfEnums call received non-success response");
|
||||
}
|
||||
return new ApiResponse<List<OuterEnum>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -516,10 +506,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testBodyWithFileSchema call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testBodyWithFileSchema call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -593,10 +580,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testBodyWithQueryParams call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testBodyWithQueryParams call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -683,10 +667,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testClientModel call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testClientModel call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -784,10 +765,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testEndpointParameters call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testEndpointParameters call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -879,10 +857,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testEnumParameters call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testEnumParameters call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1005,10 +980,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testGroupParameters call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testGroupParameters call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1177,10 +1149,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testInlineAdditionalProperties call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testInlineAdditionalProperties call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1254,10 +1223,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testJsonFormData call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testJsonFormData call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -1335,10 +1301,7 @@ public class FakeApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testQueryParameterCollectionFormat call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testQueryParameterCollectionFormat call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,6 +58,14 @@ public class FakeClassnameTags123Api {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* To test class name in snake case
|
||||
* To test class name in snake case
|
||||
@@ -87,10 +95,7 @@ public class FakeClassnameTags123Api {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"testClassname call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "testClassname call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -60,6 +60,14 @@ public class PetApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
@@ -87,10 +95,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"addPet call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "addPet call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -164,10 +169,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"deletePet call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "deletePet call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -239,10 +241,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"findPetsByStatus call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "findPetsByStatus call received non-success response");
|
||||
}
|
||||
return new ApiResponse<List<Pet>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -323,10 +322,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"findPetsByTags call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "findPetsByTags call received non-success response");
|
||||
}
|
||||
return new ApiResponse<List<Pet>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -403,10 +399,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"getPetById call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "getPetById call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Pet>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -473,10 +466,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"updatePet call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "updatePet call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -552,10 +542,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"updatePetWithForm call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "updatePetWithForm call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -628,10 +615,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"uploadFile call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "uploadFile call received non-success response");
|
||||
}
|
||||
return new ApiResponse<ModelApiResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -704,10 +688,7 @@ public class PetApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"uploadFileWithRequiredFile call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "uploadFileWithRequiredFile call received non-success response");
|
||||
}
|
||||
return new ApiResponse<ModelApiResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,6 +58,14 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
@@ -85,10 +93,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"deleteOrder call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "deleteOrder call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -155,10 +160,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"getInventory call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "getInventory call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Map<String, Integer>>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -222,10 +224,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"getOrderById call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "getOrderById call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Order>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -294,10 +293,7 @@ public class StoreApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"placeOrder call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "placeOrder call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Order>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
@@ -58,6 +58,14 @@ public class UserApi {
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
if (body != null) {
|
||||
msgPrefix += ": " + body;
|
||||
}
|
||||
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
@@ -85,10 +93,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"createUser call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "createUser call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -160,10 +165,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"createUsersWithArrayInput call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "createUsersWithArrayInput call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -235,10 +237,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"createUsersWithListInput call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "createUsersWithListInput call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -310,10 +309,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"deleteUser call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "deleteUser call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -382,10 +378,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"getUserByName call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "getUserByName call received non-success response");
|
||||
}
|
||||
return new ApiResponse<User>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -456,10 +449,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"loginUser call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "loginUser call received non-success response");
|
||||
}
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -537,10 +527,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"logoutUser call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "logoutUser call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
@@ -604,10 +591,7 @@ public class UserApi {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw new ApiException(localVarResponse.statusCode(),
|
||||
"updateUser call received non-success response",
|
||||
localVarResponse.headers(),
|
||||
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
|
||||
throw createApiException(localVarResponse, "updateUser call received non-success response");
|
||||
}
|
||||
return new ApiResponse<Void>(
|
||||
localVarResponse.statusCode(),
|
||||
|
||||
Reference in New Issue
Block a user