Class AsyncSms
- java.lang.Object
-
- pl.gsmservice.gateway.AsyncSms
-
public class AsyncSms extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GetSmsPriceRequestBuildergetPrice()Check the price of SMS Messagesjava.util.concurrent.CompletableFuture<GetSmsPriceResponse>getPrice(GetSmsPriceRequestBody request)Check the price of SMS Messagesjava.util.concurrent.CompletableFuture<GetSmsPriceResponse>getPrice(GetSmsPriceRequestBody request, java.util.Optional<Options> options)Check the price of SMS MessagesSendSmsRequestBuildersend()Send SMS Messagesjava.util.concurrent.CompletableFuture<SendSmsResponse>send(SendSmsRequestBody request)Send SMS Messagesjava.util.concurrent.CompletableFuture<SendSmsResponse>send(SendSmsRequestBody request, java.util.Optional<Options> options)Send SMS MessagesSmssync()Switches to the sync SDK.
-
-
-
Method Detail
-
sync
public Sms sync()
Switches to the sync SDK.- Returns:
- The sync 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 async call builder
-
getPrice
public java.util.concurrent.CompletableFuture<GetSmsPriceResponse> getPrice(GetSmsPriceRequestBody request)
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:
- CompletableFuture<GetSmsPriceResponse> - The async response
-
getPrice
public java.util.concurrent.CompletableFuture<GetSmsPriceResponse> getPrice(GetSmsPriceRequestBody request, java.util.Optional<Options> options)
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:
- CompletableFuture<GetSmsPriceResponse> - The async response
-
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 async call builder
-
send
public java.util.concurrent.CompletableFuture<SendSmsResponse> send(SendSmsRequestBody request)
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:
- CompletableFuture<SendSmsResponse> - The async response
-
send
public java.util.concurrent.CompletableFuture<SendSmsResponse> send(SendSmsRequestBody request, java.util.Optional<Options> options)
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:
- CompletableFuture<SendSmsResponse> - The async response
-
-