public class SmsClient extends java.lang.Object
NexmoClient.getSmsClient().| Constructor and Description |
|---|
SmsClient(HttpWrapper httpWrapper)
Create a new SmsClient.
|
| Modifier and Type | Method and Description |
|---|---|
SmsSingleSearchResponse |
getSms(java.lang.String id)
Search for a single SMS by id.
|
SearchSmsResponse |
searchMessages(java.util.Date date,
java.lang.String to)
Search for completed SMS transactions by date and recipient MSISDN.
|
SearchSmsResponse |
searchMessages(SearchSmsRequest request)
Search for completed SMS transactions.
|
SearchSmsResponse |
searchMessages(java.lang.String id,
java.lang.String... ids)
Search for completed SMS transactions by ID
|
SearchRejectedMessagesResponse |
searchRejectedMessages(java.util.Date date,
java.lang.String to)
Search for rejected SMS transactions by date and recipient MSISDN.
|
SearchRejectedMessagesResponse |
searchRejectedMessages(SearchRejectedMessagesRequest request)
Search for rejected SMS transactions using a
SearchRejectedMessagesRequest. |
SmsSubmissionResponse |
submitMessage(Message message)
Send an SMS message.
|
public SmsClient(HttpWrapper httpWrapper)
public SmsSubmissionResponse submitMessage(Message message) throws NexmoResponseParseException, NexmoClientException
This uses the supplied object to construct a request and post it to the Nexmo API.
This method will respond
with an SmsSubmissionResponse object. Depending on the nature and length of the submitted message, Nexmo may
automatically split the message into multiple sms messages in order to deliver to the handset. For example, a
long text sms of greater than 160 chars will need to be split into multiple 'concatenated' sms messages. The
Nexmo service will handle this automatically for you.
The messages are stored as a Collection of
SmsSubmissionResponseMessage objects on the SmsSubmissionResponse object. Each message can potentially have a
different status result, and each message will have a different message id. Delivery notifications will be
generated for each sms message within this set and will be posted to your application containing the appropriate
message id.
message - The message request object that describes the type of message and the contents to be submitted.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public SearchSmsResponse searchMessages(SearchSmsRequest request) throws NexmoResponseParseException, NexmoClientException
You should probably use the helper methods searchMessages(String, String...) or searchMessages(String, String...) instead.
NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public SearchSmsResponse searchMessages(java.lang.String id, java.lang.String... ids) throws NexmoResponseParseException, NexmoClientException
id - the first ID to look upids - optional extra IDs to look upNexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public SearchSmsResponse searchMessages(java.util.Date date, java.lang.String to) throws NexmoResponseParseException, NexmoClientException
date - the date of the SMS message to be looked upto - the MSISDN number of the SMS recipientNexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public SearchRejectedMessagesResponse searchRejectedMessages(SearchRejectedMessagesRequest request) throws NexmoResponseParseException, NexmoClientException
SearchRejectedMessagesRequest.
You should probably use searchRejectedMessages(Date, String) instead.
NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public SearchRejectedMessagesResponse searchRejectedMessages(java.util.Date date, java.lang.String to) throws NexmoResponseParseException, NexmoClientException
date - the date of the rejected SMS message to be looked upto - the MSISDN number of the SMS recipientNexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public SmsSingleSearchResponse getSms(java.lang.String id) throws NexmoResponseParseException, NexmoClientException
id - The message id to search for.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.