Class Sms
- java.lang.Object
-
- pl.gsmservice.gateway.Sms
-
public class Sms extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncSmsasync()Switches to the async SDK.GetSmsPriceRequestBuildergetPrice()Check the price of SMS MessagesGetSmsPriceResponsegetPrice(GetSmsPriceRequestBody request)Check the price of SMS MessagesGetSmsPriceResponsegetPrice(GetSmsPriceRequestBody request, java.util.Optional<Options> options)Check the price of SMS MessagesSendSmsRequestBuildersend()Send SMS MessagesSendSmsResponsesend(SendSmsRequestBody request)Send SMS MessagesSendSmsResponsesend(SendSmsRequestBody request, java.util.Optional<Options> options)Send SMS Messages
-
-
-
Method Detail
-
async
public AsyncSms async()
Switches to the async SDK.- Returns:
- The async SDK
-
getPrice
public GetSmsPriceRequestBuilder getPrice()
Check the price of SMS Messages
Check the price of single or multiple SMS messages at the same time before sending them. You can pass a singleSmsMessageobject usingGetSmsPriceRequestBody.of(SmsMessage)method (for single message) orList<SmsMessage>usingGetSmsPriceRequestBody.of(List.of(SmsMessage,...))method (for multiple messages).
EachSmsMessageobject has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. Please use builder style:
GetSmsPriceResponse res = sdk.outgoing().sms().getPrice() .request(req) // here pass GetSmsPriceRequestBody.of(...) object .call();
The method will accept maximum 100 messages in one call.
As a successful result aGetSmsPriceResponseobject will be returned withpricesproperty of typeList<Price>containing aPriceobjects, one object per each single message. You should check theerrorproperty of eachPriceobject to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will havenullvalue oferrorproperty.
GetSmsPriceResponseobject will include alsoheadersproperty withX-Success-Count(a count of messages which were processed successfully) andX-Error-Count(count of messages which were rejected) elements.- Returns:
- The call builder
-
getPrice
public GetSmsPriceResponse getPrice(GetSmsPriceRequestBody request) throws java.lang.Exception
Check the price of SMS Messages
Check the price of single or multiple SMS messages at the same time before sending them. You can pass a singleSmsMessageobject usingGetSmsPriceRequestBody.of(SmsMessage)method (for single message) orList<SmsMessage>usingGetSmsPriceRequestBody.of(List.of(SmsMessage,...))method (for multiple messages).
EachSmsMessageobject has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. Please use builder style:
GetSmsPriceResponse res = sdk.outgoing().sms().getPrice() .request(req) // here pass GetSmsPriceRequestBody.of(...) object .call();
The method will accept maximum 100 messages in one call.
As a successful result aGetSmsPriceResponseobject will be returned withpricesproperty of typeList<Price>containing aPriceobjects, one object per each single message. You should check theerrorproperty of eachPriceobject to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will havenullvalue oferrorproperty.
GetSmsPriceResponseobject will include alsoheadersproperty withX-Success-Count(a count of messages which were processed successfully) andX-Error-Count(count of messages which were rejected) elements.- Parameters:
request- The request object containing all the parameters for the API call.- Returns:
- The response from the API call
- Throws:
java.lang.Exception- if the API call fails
-
getPrice
public GetSmsPriceResponse getPrice(GetSmsPriceRequestBody request, java.util.Optional<Options> options) throws java.lang.Exception
Check the price of SMS Messages
Check the price of single or multiple SMS messages at the same time before sending them. You can pass a singleSmsMessageobject usingGetSmsPriceRequestBody.of(SmsMessage)method (for single message) orList<SmsMessage>usingGetSmsPriceRequestBody.of(List.of(SmsMessage,...))method (for multiple messages).
EachSmsMessageobject has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. Please use builder style:
GetSmsPriceResponse res = sdk.outgoing().sms().getPrice() .request(req) // here pass GetSmsPriceRequestBody.of(...) object .call();
The method will accept maximum 100 messages in one call.
As a successful result aGetSmsPriceResponseobject will be returned withpricesproperty of typeList<Price>containing aPriceobjects, one object per each single message. You should check theerrorproperty of eachPriceobject to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will havenullvalue oferrorproperty.
GetSmsPriceResponseobject will include alsoheadersproperty withX-Success-Count(a count of messages which were processed successfully) andX-Error-Count(count of messages which were rejected) elements.- Parameters:
request- The request object containing all the parameters for the API call.options- additional options- Returns:
- The response from the API call
- Throws:
java.lang.Exception- if the API call fails
-
send
public SendSmsRequestBuilder send()
Send SMS Messages
Send single or multiple SMS messages at the same time. You can pass a singleSmsMessageobject usingSendSmsRequestBody.of(SmsMessage)method (for single message) orList<SmsMessage>usingSendSmsRequestBody.of(List.of(SmsMessage,...))method (for multiple messages). EachSmsMessageobject has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. Please use builder style:
SendSmsResponse res = sdk.outgoing().sms().send() .request(req) // here pass GetSmsPriceRequestBody.of(...) object .call();
This method will accept maximum 100 messages in one call.
As a successful result aSendSmsResponseobject will be returned withmessagesproperty of type List<Message> containingMessageobjects, one object per each single message. You should check thestatusCodeproperty of eachMessageobject to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection,statusDescriptionproperty will include a reason.
SendSmsResponsewill also includeheadersproperty withX-Success-Count(a count of messages which were processed successfully),X-Error-Count(count of messages which were rejected) andX-Sandbox(if a request was made in Sandbox or Production system) elements.- Returns:
- The call builder
-
send
public SendSmsResponse send(SendSmsRequestBody request) throws java.lang.Exception
Send SMS Messages
Send single or multiple SMS messages at the same time. You can pass a singleSmsMessageobject usingSendSmsRequestBody.of(SmsMessage)method (for single message) orList<SmsMessage>usingSendSmsRequestBody.of(List.of(SmsMessage,...))method (for multiple messages). EachSmsMessageobject has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. Please use builder style:
SendSmsResponse res = sdk.outgoing().sms().send() .request(req) // here pass GetSmsPriceRequestBody.of(...) object .call();
This method will accept maximum 100 messages in one call.
As a successful result aSendSmsResponseobject will be returned withmessagesproperty of type List<Message> containingMessageobjects, one object per each single message. You should check thestatusCodeproperty of eachMessageobject to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection,statusDescriptionproperty will include a reason.
SendSmsResponsewill also includeheadersproperty withX-Success-Count(a count of messages which were processed successfully),X-Error-Count(count of messages which were rejected) andX-Sandbox(if a request was made in Sandbox or Production system) elements.- Parameters:
request- The request object containing all the parameters for the API call.- Returns:
- The response from the API call
- Throws:
java.lang.Exception- if the API call fails
-
send
public SendSmsResponse send(SendSmsRequestBody request, java.util.Optional<Options> options) throws java.lang.Exception
Send SMS Messages
Send single or multiple SMS messages at the same time. You can pass a singleSmsMessageobject usingSendSmsRequestBody.of(SmsMessage)method (for single message) orList<SmsMessage>usingSendSmsRequestBody.of(List.of(SmsMessage,...))method (for multiple messages). EachSmsMessageobject has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. Please use builder style:
SendSmsResponse res = sdk.outgoing().sms().send() .request(req) // here pass GetSmsPriceRequestBody.of(...) object .call();
This method will accept maximum 100 messages in one call.
As a successful result aSendSmsResponseobject will be returned withmessagesproperty of type List<Message> containingMessageobjects, one object per each single message. You should check thestatusCodeproperty of eachMessageobject to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection,statusDescriptionproperty will include a reason.
SendSmsResponsewill also includeheadersproperty withX-Success-Count(a count of messages which were processed successfully),X-Error-Count(count of messages which were rejected) andX-Sandbox(if a request was made in Sandbox or Production system) elements.- Parameters:
request- The request object containing all the parameters for the API call.options- additional options- Returns:
- The response from the API call
- Throws:
java.lang.Exception- if the API call fails
-
-