// Path: libs/sms/src/main/java/com/africastalking/sms/FetchMessageResponse.java
// public final class FetchMessageResponse {
// 
//     @SerializedName("SMSMessageData")
//     public SmsMessageData data;
// 
//     public static final class SmsMessageData {
//         @SerializedName("Recipients")
//         public List<Message> messages = new ArrayList<>();
//     }
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/FetchSubscriptionResponse.java
// public final class FetchSubscriptionResponse {
//     @SerializedName("Subscriptions")
//     public List<Subscription> subscriptions = new ArrayList<>();
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/Message.java
// public final class Message {
//     public String from;
//     public String to;
//     public String text;
//     public String linkId;
//     public String date;
//     public long id;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/Recipient.java
// public final class Recipient {
//     public String number;
//     public String cost;
//     public String status;
//     public String messageId;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/SendMessageResponse.java
// public final class SendMessageResponse {
// 
//     @SerializedName("SMSMessageData")
//     public SmsMessageData data;
// 
//     public static final class SmsMessageData {
//         @SerializedName("Recipients")
//         public List<Recipient> recipients;
//     }
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// 
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/Subscription.java
// public final class Subscription {
//     public long id;
//     public String phoneNumber;
//     public String date;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/SubscriptionResponse.java
// public final class SubscriptionResponse {
//     public String success;
//     public String description;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }


import com.africastalking.sms.FetchMessageResponse;
import com.africastalking.sms.FetchSubscriptionResponse;
import com.africastalking.sms.Message;
import com.africastalking.sms.Recipient;
import com.africastalking.sms.SendMessageResponse;
import com.africastalking.sms.Subscription;
import com.africastalking.sms.SubscriptionResponse;
import retrofit2.Response;
import java.io.IOException;
import java.util.List;
import java.util.StringJoiner;
        if (!resp.isSuccessful()) {
            throw new IOException(resp.errorBody().string());
        }
        return resp.body().data.messages;
    }

    /**
     * Fetch messages
     * <p>
     *     Synchronously send the request and return its response.
     * </p>
     * @return
     * @throws IOException
     */
    public List<Message> fetchMessages() throws IOException {
        return fetchMessages("0");
    }

    /**
     * Fetch messages
     * <p>
     *     Asynchronously send the request and notify {@code callback} of its response or if an error
     * occurred
     * </p>
     * @param lastReceivedId
     * @param callback
     */
    public void fetchMessages(String lastReceivedId, final Callback<List<Message>> callback) {
        sms.fetchMessages(mUsername, lastReceivedId).enqueue(makeCallback(new Callback<FetchMessageResponse>() {
            @Override
// Path: libs/sms/src/main/java/com/africastalking/sms/FetchMessageResponse.java
// public final class FetchMessageResponse {
// 
//     @SerializedName("SMSMessageData")
//     public SmsMessageData data;
// 
//     public static final class SmsMessageData {
//         @SerializedName("Recipients")
//         public List<Message> messages = new ArrayList<>();
//     }
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/FetchSubscriptionResponse.java
// public final class FetchSubscriptionResponse {
//     @SerializedName("Subscriptions")
//     public List<Subscription> subscriptions = new ArrayList<>();
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/Message.java
// public final class Message {
//     public String from;
//     public String to;
//     public String text;
//     public String linkId;
//     public String date;
//     public long id;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/Recipient.java
// public final class Recipient {
//     public String number;
//     public String cost;
//     public String status;
//     public String messageId;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/SendMessageResponse.java
// public final class SendMessageResponse {
// 
//     @SerializedName("SMSMessageData")
//     public SmsMessageData data;
// 
//     public static final class SmsMessageData {
//         @SerializedName("Recipients")
//         public List<Recipient> recipients;
//     }
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// 
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/Subscription.java
// public final class Subscription {
//     public long id;
//     public String phoneNumber;
//     public String date;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }
// 
// Path: libs/sms/src/main/java/com/africastalking/sms/SubscriptionResponse.java
// public final class SubscriptionResponse {
//     public String success;
//     public String description;
// 
//     @Override
//     public String toString() {
//         return new Gson().toJson(this);
//     }
// }


// Path: libs/sms/src/main/java/com/africastalking/SmsService.java
import com.africastalking.sms.FetchMessageResponse;
import com.africastalking.sms.FetchSubscriptionResponse;
import com.africastalking.sms.Message;
import com.africastalking.sms.Recipient;
import com.africastalking.sms.SendMessageResponse;
import com.africastalking.sms.Subscription;
import com.africastalking.sms.SubscriptionResponse;
import retrofit2.Response;
import java.io.IOException;
import java.util.List;
import java.util.StringJoiner;

        if (!resp.isSuccessful()) {
            throw new IOException(resp.errorBody().string());
        }
        return resp.body().data.messages;
    }

    /**
     * Fetch messages
     * <p>
     *     Synchronously send the request and return its response.
     * </p>
     * @return
     * @throws IOException
     */
    public List<Message> fetchMessages() throws IOException {
        return fetchMessages("0");
    }

    /**
     * Fetch messages
     * <p>
     *     Asynchronously send the request and notify {@code callback} of its response or if an error
     * occurred
     * </p>
     * @param lastReceivedId
     * @param callback
     */
    public void fetchMessages(String lastReceivedId, final Callback<List<Message>> callback) {
        sms.fetchMessages(mUsername, lastReceivedId).enqueue(makeCallback(new Callback<FetchMessageResponse>() {
            @Override
            public void onSuccess(FetchMessageResponse data) {