Class AsyncSms


  • public class AsyncSms
    extends java.lang.Object
    • 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 single SmsMessage object using GetSmsPriceRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using GetSmsPriceRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages).

        Each SmsMessage object 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 a GetSmsPriceResponse object will be returned with prices property of type List<Price> containing a Price objects, one object per each single message. You should check the error property of each Price object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have null value of error property.

        GetSmsPriceResponse object will include also headers property with X-Success-Count (a count of messages which were processed successfully) and X-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 single SmsMessage object using GetSmsPriceRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using GetSmsPriceRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages).

        Each SmsMessage object 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 a GetSmsPriceResponse object will be returned with prices property of type List<Price> containing a Price objects, one object per each single message. You should check the error property of each Price object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have null value of error property.

        GetSmsPriceResponse object will include also headers property with X-Success-Count (a count of messages which were processed successfully) and X-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 single SmsMessage object using GetSmsPriceRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using GetSmsPriceRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages).

        Each SmsMessage object 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 a GetSmsPriceResponse object will be returned with prices property of type List<Price> containing a Price objects, one object per each single message. You should check the error property of each Price object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have null value of error property.

        GetSmsPriceResponse object will include also headers property with X-Success-Count (a count of messages which were processed successfully) and X-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 single SmsMessage object using SendSmsRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using SendSmsRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages). Each SmsMessage object 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 a SendSmsResponse object will be returned with messages property of type List<Message> containing Message objects, one object per each single message. You should check the statusCode property of each Message object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, statusDescription property will include a reason.

        SendSmsResponse will also include headers property with X-Success-Count (a count of messages which were processed successfully), X-Error-Count (count of messages which were rejected) and X-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 single SmsMessage object using SendSmsRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using SendSmsRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages). Each SmsMessage object 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 a SendSmsResponse object will be returned with messages property of type List<Message> containing Message objects, one object per each single message. You should check the statusCode property of each Message object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, statusDescription property will include a reason.

        SendSmsResponse will also include headers property with X-Success-Count (a count of messages which were processed successfully), X-Error-Count (count of messages which were rejected) and X-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 single SmsMessage object using SendSmsRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using SendSmsRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages). Each SmsMessage object 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 a SendSmsResponse object will be returned with messages property of type List<Message> containing Message objects, one object per each single message. You should check the statusCode property of each Message object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, statusDescription property will include a reason.

        SendSmsResponse will also include headers property with X-Success-Count (a count of messages which were processed successfully), X-Error-Count (count of messages which were rejected) and X-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