Skip to content

Commit 13fbd78

Browse files
fix: response return
1 parent 6cbfa6e commit 13fbd78

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

src/main/java/dev/resms/model/ErrorResponse.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import lombok.Getter;
44

55
@Getter
6-
public class ErrorResponse {
7-
private String status;
6+
public class ErrorResponse extends Response {
87
private ErrorDetails error;
98

109
@Getter
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package dev.resms.model;
2+
3+
import lombok.Getter;
4+
5+
@Getter
6+
public abstract class Response {
7+
private String status;
8+
}
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package dev.resms.model.response;
22

3+
import dev.resms.model.Response;
34
import lombok.Getter;
45

56
/**
67
* Response object returned after sending an SMS
78
*/
89
@Getter
9-
public class SendSmsResponse {
10-
private String messageId;
11-
private String pinPointMessageId;
10+
public class SendSmsResponse extends Response {
11+
private SensSmsResponseData data;
12+
13+
@Getter
14+
public static class SensSmsResponseData {
15+
private String messageId;
16+
}
1217
}

src/main/java/dev/resms/repository/SmsRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public SendSmsResponse sendSms(SendSmsRequest requestBody) throws ReSMSException
7171

7272
if (httpResponse.statusCode() == HttpStatus.SC_OK) {
7373
try {
74-
//TODO change to good structure
7574
return responseAdapter.fromJson(httpResponse.body());
7675
} catch (IOException e) {
7776
throw new ReSMSException("Failed to parse response body", e);

0 commit comments

Comments
 (0)