services.SendService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of courier-java Show documentation
Show all versions of courier-java Show documentation
Java SDK for communicating with the Courier REST API.
package services;
import models.SendEnhancedRequestBody;
import models.SendEnhancedResponseBody;
import models.SendListRequestBody;
import models.SendRequestBody;
import models.SendResponseBody;
import java.io.IOException;
public class SendService {
private final SendInterface sendInterface;
public SendService() {
sendInterface = Courier.getRetrofit().create(SendInterface.class);
}
public SendResponseBody send(
SendRequestBody sendRequestBody
) throws IOException {
return sendInterface.send(
sendRequestBody,
Courier.getAuthorizationHeader(),
Courier.getUserAgent()
).execute().body();
}
public SendResponseBody sendIdempotent(
SendRequestBody sendRequestBody,
String idempotencyKey
) throws IOException {
return sendInterface.sendIdempotent(
sendRequestBody,
Courier.getAuthorizationHeader(),
Courier.getUserAgent(),
idempotencyKey
).execute().body();
}
public SendResponseBody sendToList(
SendListRequestBody sendListRequestBody
) throws IOException {
return sendInterface.sendToList(
sendListRequestBody,
Courier.getAuthorizationHeader(),
Courier.getUserAgent()
).execute().body();
}
public SendEnhancedResponseBody sendEnhancedMessage(
SendEnhancedRequestBody sendEnhancedRequestBody
) throws IOException {
return sendInterface.sendEnhanced(
sendEnhancedRequestBody,
Courier.getAuthorizationHeader(),
Courier.getUserAgent()
).execute().body();
}
public SendEnhancedResponseBody sendIdempotentEnhancedMessage(
SendEnhancedRequestBody sendEnhancedRequestBody,
String idempotencyKey
) throws IOException {
return sendInterface.sendEnhancedIdempotent(
sendEnhancedRequestBody,
Courier.getAuthorizationHeader(),
Courier.getUserAgent(),
idempotencyKey
).execute().body();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy