Skip to content

Commit 60f41dc

Browse files
committed
adding message variable in ApiResponse class
1 parent 7ff2834 commit 60f41dc

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/main/java/Invokers/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ public <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiExceptio
12091209

12101210
logger.info("HTTP Response Body :\n{}", data);
12111211

1212-
return new ApiResponse<T>(response.code(), response.headers().toMultimap(), data);
1212+
return new ApiResponse<T>(response.code(), response.headers().toMultimap(), response.message(), data);
12131213
} catch (IOException e) {
12141214
logger.error("ApiException : " + e.getMessage());
12151215
throw new ApiException(e);

src/main/java/Invokers/ApiResponse.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,25 @@ public class ApiResponse<T> {
2525
final private int statusCode;
2626
final private Map<String, List<String>> headers;
2727
final private T data;
28+
final private String message;
2829

2930
/**
3031
* @param statusCode The status code of HTTP response
3132
* @param headers The headers of HTTP response
3233
*/
33-
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
34-
this(statusCode, headers, null);
34+
public ApiResponse(int statusCode, Map<String, List<String>> headers, String message) {
35+
this(statusCode, headers, message, null);
3536
}
3637

3738
/**
3839
* @param statusCode The status code of HTTP response
3940
* @param headers The headers of HTTP response
4041
* @param data The object deserialized from response bod
4142
*/
42-
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
43+
public ApiResponse(int statusCode, Map<String, List<String>> headers, String message, T data) {
4344
this.statusCode = statusCode;
4445
this.headers = headers;
46+
this.message= message;
4547
this.data = data;
4648
}
4749

@@ -56,4 +58,8 @@ public Map<String, List<String>> getHeaders() {
5658
public T getData() {
5759
return data;
5860
}
61+
62+
public String getMessage() {
63+
return message;
64+
}
5965
}

0 commit comments

Comments
 (0)