55import dev .resms .model .request .SendSmsRequest ;
66import dev .resms .model .response .SendSmsResponse ;
77import dev .resms .service .SmsService ;
8+ import lombok .NonNull ;
89
910/** ReSMS Java SDK - Client principal */
1011public class ReSMS {
11- private static final int DEFAULT_TIMEOUT = 10 ;
1212 private final SmsService smsService ;
1313
1414 /**
@@ -17,7 +17,7 @@ public class ReSMS {
1717 * @param apiKey API key for authentication
1818 * @param timeoutSeconds HTTP request timeout in seconds
1919 */
20- public ReSMS (String apiKey , int timeoutSeconds ) {
20+ public ReSMS (@ NonNull String apiKey , int timeoutSeconds ) {
2121 ReSMSConfig config = new ReSMSConfig (apiKey , timeoutSeconds );
2222 this .smsService = new SmsService (config );
2323 }
@@ -27,8 +27,13 @@ public ReSMS(String apiKey, int timeoutSeconds) {
2727 *
2828 * @param apiKey API key for authentication
2929 */
30- public ReSMS (String apiKey ) {
31- this (apiKey , DEFAULT_TIMEOUT );
30+ public ReSMS (@ NonNull String apiKey ) {
31+ ReSMSConfig config = new ReSMSConfig (apiKey );
32+ this .smsService = new SmsService (config );
33+ }
34+
35+ public ReSMS (@ NonNull ReSMSConfig config ) {
36+ this .smsService = new SmsService (config );
3237 }
3338
3439 /**
@@ -39,7 +44,7 @@ public ReSMS(String apiKey) {
3944 * @return SendSmsResponse containing the message ID and status
4045 * @throws ReSMSException if fails
4146 */
42- public SendSmsResponse send (String to , String message ) throws ReSMSException {
47+ public SendSmsResponse send (@ NonNull String to , @ NonNull String message ) throws ReSMSException {
4348 return smsService .send (to , message );
4449 }
4550
@@ -50,7 +55,7 @@ public SendSmsResponse send(String to, String message) throws ReSMSException {
5055 * @return SendSmsResponse containing the message ID and status
5156 * @throws ReSMSException if fails
5257 */
53- public SendSmsResponse send (SendSmsRequest request ) throws ReSMSException {
58+ public SendSmsResponse send (@ NonNull SendSmsRequest request ) throws ReSMSException {
5459 return smsService .send (request );
5560 }
5661}
0 commit comments