[Java] [Native] Add response body to exception message (#9169)

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Revert "Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true"

This reverts commit 56e2b1fb

* Revert "Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true"

This reverts commit 335c304d

* Fix #8027 - import the auto generated supporting JSON class only when generateSupportingFiles is true

* Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed

* Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed

* Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed

* [Java] [Native] Add response body to exception message

* [Java] [Native] Use default base URI if baseUri param is null

* [Java] [Native] Use default base URI if baseUri param is null
This commit is contained in:
Moshe Elisha 2021-04-16 06:02:56 +03:00 committed by GitHub
parent 6dce8179de
commit af992e4b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 241 additions and 312 deletions

View File

@ -170,7 +170,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;

View File

@ -65,6 +65,14 @@ public class {{classname}} {
}
{{/asyncNative}}
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);
}
{{#operation}}
{{#vendorExtensions.x-group-parameters}}
{{#hasParams}}
@ -207,10 +215,7 @@ public class {{classname}} {
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"{{operationId}} call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "{{operationId}} call received non-success response");
}
return new ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>(
localVarResponse.statusCode(),

View File

@ -175,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;

View File

@ -67,6 +67,14 @@ public class AnotherFakeApi {
localVarResponse.body());
}
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

View File

@ -75,6 +75,14 @@ public class FakeApi {
localVarResponse.body());
}
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);
}
/**
* creates an XmlItem
* this route creates an XmlItem

View File

@ -67,6 +67,14 @@ public class FakeClassnameTags123Api {
localVarResponse.body());
}
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

View File

@ -70,6 +70,14 @@ public class PetApi {
localVarResponse.body());
}
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
*

View File

@ -67,6 +67,14 @@ public class StoreApi {
localVarResponse.body());
}
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 &lt; 1000. Anything above 1000 or nonintegers will generate API errors

View File

@ -67,6 +67,14 @@ public class UserApi {
localVarResponse.body());
}
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.

View File

@ -175,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;

View File

@ -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(),

View File

@ -66,6 +66,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);
}
/**
* creates an XmlItem
* this route creates an XmlItem
@ -93,10 +101,7 @@ public class FakeApi {
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"createXmlItem call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "createXmlItem call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
@ -170,10 +175,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(),
@ -243,10 +245,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(),
@ -316,10 +315,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(),
@ -389,10 +385,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(),
@ -460,10 +453,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(),
@ -537,10 +527,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(),
@ -627,10 +614,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(),
@ -728,10 +712,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(),
@ -823,10 +804,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(),
@ -949,10 +927,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(),
@ -1121,10 +1096,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(),
@ -1198,10 +1170,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(),
@ -1279,10 +1248,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(),

View File

@ -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(),

View File

@ -61,6 +61,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
*
@ -88,10 +96,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(),
@ -165,10 +170,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(),
@ -240,10 +242,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(),
@ -324,10 +323,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<Set<Pet>>(
localVarResponse.statusCode(),
@ -404,10 +400,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(),
@ -474,10 +467,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(),
@ -553,10 +543,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(),
@ -629,10 +616,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(),
@ -705,10 +689,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(),

View File

@ -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 &lt; 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(),

View File

@ -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(),

View File

@ -175,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;

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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(),

View File

@ -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 &lt; 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(),

View File

@ -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(),