Skip to content

Commit 428af6a

Browse files
committed
changes for message in apiResponse added in mustache
1 parent 60f41dc commit 428af6a

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

generator/cybersource-java-template/libraries/okhttp-gson/ApiClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ public class ApiClient {
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);

generator/cybersource-java-template/libraries/okhttp-gson/ApiResponse.mustache

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,25 @@ public class ApiResponse<T> {
1414
final private int statusCode;
1515
final private Map<String, List<String>> headers;
1616
final private T data;
17+
final private String message;
1718
1819
/**
1920
* @param statusCode The status code of HTTP response
2021
* @param headers The headers of HTTP response
2122
*/
22-
public ApiResponse(int statusCode, Map<String, List<String>> headers) {
23-
this(statusCode, headers, null);
23+
public ApiResponse(int statusCode, Map<String, List<String>> headers, String message) {
24+
this(statusCode, headers, message, null);
2425
}
2526

2627
/**
2728
* @param statusCode The status code of HTTP response
2829
* @param headers The headers of HTTP response
2930
* @param data The object deserialized from response bod
3031
*/
31-
public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) {
32+
public ApiResponse(int statusCode, Map<String, List<String>> headers, String message, T data) {
3233
this.statusCode = statusCode;
3334
this.headers = headers;
35+
this.message= message;
3436
this.data = data;
3537
}
3638

@@ -45,4 +47,8 @@ public class ApiResponse<T> {
4547
public T getData() {
4648
return data;
4749
}
50+
51+
public String getMessage() {
52+
return message;
53+
}
4854
}

src/main/java/Invokers/ApiResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public T getData() {
5959
return data;
6060
}
6161

62-
public String getMessage() {
63-
return message;
64-
}
62+
public String getMessage() {
63+
return message;
64+
}
6565
}

0 commit comments

Comments
 (0)