1- package dev .resms .repository ;
1+ package dev .resms .api ;
22
33import com .squareup .moshi .JsonAdapter ;
44import com .squareup .moshi .Moshi ;
1818import java .net .http .HttpResponse ;
1919import org .apache .hc .core5 .http .HttpStatus ;
2020
21- /** Generic API client for HTTP requests */
22- public class SmsRepository {
21+ public class ReSMSApiClient {
2322 private static final String SEND_SMS_PATH = "sms/send" ;
2423
2524 private final ReSMSConfig config ;
2625 private final JsonAdapter <SendSmsRequest > requestAdapter ;
2726 private final JsonAdapter <SendSmsResponse > responseAdapter ;
2827 private final JsonAdapter <ErrorResponse > errorResponseAdapter ;
2928
30- public SmsRepository (ReSMSConfig config ) {
29+ public ReSMSApiClient (ReSMSConfig config ) {
3130 this .config = config ;
3231
3332 Moshi moshi = new Moshi .Builder ().build ();
@@ -37,13 +36,6 @@ public SmsRepository(ReSMSConfig config) {
3736 this .errorResponseAdapter = moshi .adapter (ErrorResponse .class );
3837 }
3938
40- /**
41- * Executes a POST request
42- *
43- * @param requestBody Request body object
44- * @return Parsed response object
45- * @throws ReSMSException if fails
46- */
4739 public SendSmsResponse sendSms (SendSmsRequest requestBody ) throws ReSMSException {
4840 String jsonBody = requestAdapter .toJson (requestBody );
4941
@@ -89,7 +81,6 @@ public SendSmsResponse sendSms(SendSmsRequest requestBody) throws ReSMSException
8981 throw new MessageStatusUpdateFailedException (errorMessage );
9082 default -> throw new ReSMSException (errorResponse .getStatus () + " " + errorMessage );
9183 }
92-
9384 } catch (IOException e ) {
9485 throw new ReSMSException ("Failed to parse error response" , e );
9586 }
0 commit comments