File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 11package dev .resms ;
2+
23import dev .resms .config .ReSMSConfig ;
3- import dev .resms .service .SmsService ;
44import dev .resms .model .request .SendSmsRequest ;
55import dev .resms .model .response .SendSmsResponse ;
6+ import dev .resms .service .SmsService ;
67
78/**
89 * ReSMS Java SDK - Client principal
910 */
1011public class ReSMS {
11- private final SmsService smsService ;
1212 private static final int DEFAULT_TIMEOUT = 10 ;
13+ private final SmsService smsService ;
1314
1415 /**
1516 * Creates a new ReSMS client
1617 *
17- * @param apiKey API key for authentication
18+ * @param apiKey API key for authentication
1819 * @param timeoutSeconds HTTP request timeout in seconds
1920 */
2021 public ReSMS (String apiKey , int timeoutSeconds ) {
@@ -34,7 +35,7 @@ public ReSMS(String apiKey) {
3435 /**
3536 * Sends an SMS message - Main method
3637 *
37- * @param to Phone number to send the message to
38+ * @param to Phone number to send the message to
3839 * @param message Message content
3940 * @return SendSmsResponse containing the message ID and status
4041 * @throws Exception if fails
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public int getTimeoutSeconds() {
2929 return timeoutSeconds ;
3030 }
3131
32- public String getUrl () {
32+ public String getBaseUrl () {
3333 return BASE_URL ;
3434 }
3535
Original file line number Diff line number Diff line change 1616 * Generic API client for HTTP requests
1717 */
1818public class SmsRepository {
19+ private static final String SEND_SMS_PATH = "sms/send" ;
20+
1921 private final ReSMSConfig config ;
2022 private final JsonAdapter <SendSmsRequest > requestAdapter ;
2123 private final JsonAdapter <SendSmsResponse > responseAdapter ;
@@ -43,7 +45,7 @@ public SendSmsResponse post(SendSmsRequest requestBody) throws Exception {
4345 String jsonBody = requestAdapter .toJson (requestBody );
4446
4547 HttpRequest request = HttpRequest .newBuilder ()
46- .uri (URI .create (config .getUrl () + "sms/send" ))
48+ .uri (URI .create (config .getBaseUrl () + SEND_SMS_PATH ))
4749 .header ("Content-Type" , "application/json" )
4850 .header ("x-api-key" , config .getApiKey ())
4951 .timeout (Duration .ofSeconds (config .getTimeoutSeconds ()))
You can’t perform that action at this time.
0 commit comments