Skip to content

Commit 15052d1

Browse files
Merge pull request #5 from ReSMS-dev/feat/SMS-122_rename_otp_create
SMS-122: rename otp create method
2 parents aab21c0 + bbbe1db commit 15052d1

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/main/java/dev/resms/services/otp/Otp.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import dev.resms.core.net.AbstractHttpResponse;
55
import dev.resms.core.net.HttpMethod;
66
import dev.resms.core.service.BaseService;
7-
import dev.resms.services.otp.model.CreateOtpOptions;
8-
import dev.resms.services.otp.model.CreateOtpResponse;
7+
import dev.resms.services.otp.model.SendOtpOptions;
8+
import dev.resms.services.otp.model.SendOtpResponse;
99
import dev.resms.services.otp.model.VerifyOtpOptions;
1010
import dev.resms.services.otp.model.VerifyOtpResponse;
1111

1212
public class Otp extends BaseService {
13-
private static final String CREATE_OTP_PATH = "/otp";
13+
private static final String SEND_OTP_PATH = "/otp";
1414
private static final String VERIFY_OTP_PATH = "/otp/verify";
1515

1616
/**
@@ -23,24 +23,24 @@ public Otp(final String apiKey) {
2323
}
2424

2525
/**
26-
* Create an OTP based on the provided OTP request
26+
* Send an OTP based on the provided OTP request
2727
*
28-
* @param createOtpOptions The request containing OTP details.
29-
* @return The response indicating the status of the OTP creation.
30-
* @throws ReSMSException If an error occurs while creating the OTP.
28+
* @param sendOtpOptions The request containing OTP details.
29+
* @return The response indicating the status of the OTP.
30+
* @throws ReSMSException If an error occurs while sending the OTP.
3131
*/
32-
public CreateOtpResponse create(CreateOtpOptions createOtpOptions) throws ReSMSException {
33-
String payload = super.reSMSMapper.toJson(createOtpOptions);
32+
public SendOtpResponse send(SendOtpOptions sendOtpOptions) throws ReSMSException {
33+
String payload = super.reSMSMapper.toJson(sendOtpOptions);
3434

3535
AbstractHttpResponse<String> response =
36-
super.httpClient.perform(CREATE_OTP_PATH, apiKey, HttpMethod.POST, payload);
36+
super.httpClient.perform(SEND_OTP_PATH, apiKey, HttpMethod.POST, payload);
3737

3838
if (!response.isSuccessful()) {
3939
throw new ReSMSException(
4040
"Failed to create otp: " + response.getCode() + " " + response.getBody());
4141
}
4242

43-
return reSMSMapper.fromJson(response.getBody(), CreateOtpResponse.class);
43+
return reSMSMapper.fromJson(response.getBody(), SendOtpResponse.class);
4444
}
4545

4646
/**

src/main/java/dev/resms/services/otp/model/CreateOtpOptions.java renamed to src/main/java/dev/resms/services/otp/model/SendOtpOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@Getter
88
@Setter
99
@Builder
10-
public class CreateOtpOptions {
10+
public class SendOtpOptions {
1111
private String to;
1212
private String message;
1313
private String senderId;

src/main/java/dev/resms/services/otp/model/CreateOtpResponse.java renamed to src/main/java/dev/resms/services/otp/model/SendOtpResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import lombok.Getter;
55

66
@Getter
7-
public class CreateOtpResponse extends Response {
8-
private CreateOtpResponseData data;
7+
public class SendOtpResponse extends Response {
8+
private SendOtpResponseData data;
99

1010
@Getter
11-
public static class CreateOtpResponseData {
11+
public static class SendOtpResponseData {
1212
private String phoneNumber;
1313
private String expiresAt;
1414
}

0 commit comments

Comments
 (0)