Exemplo n.º 1
0
        /// <summary>
        /// Send a message from the account used to make the request
        /// </summary>
        ///
        /// <param name="options"> Create Message parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(CreateMessageOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Send a message from the account used to make the request
        /// </summary>
        /// <param name="to"> The phone number to receive the message </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="from"> The phone number that initiated the message </param>
        /// <param name="messagingServiceSid"> The 34 character unique id of the Messaging Service you want to associate with
        ///                           this Message. </param>
        /// <param name="body"> The text of the message you want to send, limited to 1600 characters. </param>
        /// <param name="mediaUrl"> The URL of the media you wish to send out with the message. </param>
        /// <param name="statusCallback"> URL Twilio will request when the status changes </param>
        /// <param name="applicationSid"> The application to use for callbacks </param>
        /// <param name="maxPrice"> The total maximum price up to the fourth decimal in US dollars acceptable for the message
        ///                to be delivered. </param>
        /// <param name="provideFeedback"> Set this value to true if you are sending messages that have a trackable user action
        ///                       and you intend to confirm delivery of the message using the Message Feedback API. </param>
        /// <param name="validityPeriod"> The number of seconds that the message can remain in a Twilio queue. </param>
        /// <param name="maxRate"> The max_rate </param>
        /// <param name="forceDelivery"> The force_delivery </param>
        /// <param name="providerSid"> The provider_sid </param>
        /// <param name="contentRetention"> The content_retention </param>
        /// <param name="addressRetention"> The address_retention </param>
        /// <param name="smartEncoded"> The smart_encoded </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Message </returns>
        public static async System.Threading.Tasks.Task <MessageResource> CreateAsync(Types.PhoneNumber to,
                                                                                      string pathAccountSid      = null,
                                                                                      Types.PhoneNumber from     = null,
                                                                                      string messagingServiceSid = null,
                                                                                      string body           = null,
                                                                                      List <Uri> mediaUrl   = null,
                                                                                      Uri statusCallback    = null,
                                                                                      string applicationSid = null,
                                                                                      decimal?maxPrice      = null,
                                                                                      bool?provideFeedback  = null,
                                                                                      int?validityPeriod    = null,
                                                                                      string maxRate        = null,
                                                                                      bool?forceDelivery    = null,
                                                                                      string providerSid    = null,
                                                                                      MessageResource.ContentRetentionEnum contentRetention = null,
                                                                                      MessageResource.AddressRetentionEnum addressRetention = null,
                                                                                      bool?smartEncoded        = null,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(to)
            {
                PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, ValidityPeriod = validityPeriod, MaxRate = maxRate, ForceDelivery = forceDelivery, ProviderSid = providerSid, ContentRetention = contentRetention, AddressRetention = addressRetention, SmartEncoded = smartEncoded
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Send a message from the account used to make the request
        /// </summary>
        /// <param name="to"> The destination phone number </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="from"> The phone number that initiated the message </param>
        /// <param name="messagingServiceSid"> The SID of the Messaging Service you want to associate with the message. </param>
        /// <param name="body"> The text of the message you want to send. Can be up to 1,600 characters in length. </param>
        /// <param name="mediaUrl"> The URL of the media to send with the message </param>
        /// <param name="statusCallback"> The URL we should call to send status information to your application </param>
        /// <param name="applicationSid"> The application to use for callbacks </param>
        /// <param name="maxPrice"> The total maximum price up to 4 decimal places in US dollars acceptable for the message to
        ///                be delivered. </param>
        /// <param name="provideFeedback"> Whether to confirm delivery of the message </param>
        /// <param name="attempt"> Total numer of attempts made , this inclusive to send out the message </param>
        /// <param name="validityPeriod"> The number of seconds that the message can remain in our outgoing queue. </param>
        /// <param name="forceDelivery"> Reserved </param>
        /// <param name="contentRetention"> Determines if the message content can be stored or redacted based on privacy
        ///                        settings </param>
        /// <param name="addressRetention"> Determines if the address can be stored or obfuscated based on privacy settings
        ///                        </param>
        /// <param name="smartEncoded"> Whether to detect Unicode characters that have a similar GSM-7 character and replace
        ///                    them </param>
        /// <param name="persistentAction"> Rich actions for Channels Messages. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(Types.PhoneNumber to,
                                             string pathAccountSid      = null,
                                             Types.PhoneNumber from     = null,
                                             string messagingServiceSid = null,
                                             string body           = null,
                                             List <Uri> mediaUrl   = null,
                                             Uri statusCallback    = null,
                                             string applicationSid = null,
                                             decimal?maxPrice      = null,
                                             bool?provideFeedback  = null,
                                             int?attempt           = null,
                                             int?validityPeriod    = null,
                                             bool?forceDelivery    = null,
                                             MessageResource.ContentRetentionEnum contentRetention = null,
                                             MessageResource.AddressRetentionEnum addressRetention = null,
                                             bool?smartEncoded = null,
                                             List <string> persistentAction = null,
                                             ITwilioRestClient client       = null)
        {
            var options = new CreateMessageOptions(to)
            {
                PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, Attempt = attempt, ValidityPeriod = validityPeriod, ForceDelivery = forceDelivery, ContentRetention = contentRetention, AddressRetention = addressRetention, SmartEncoded = smartEncoded, PersistentAction = persistentAction
            };

            return(Create(options, client));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Send a message from the account used to make the request
 /// </summary>
 /// <param name="options"> Create Message parameters </param>
 /// <param name="client"> Client to make requests to Twilio </param>
 /// <returns> Task that resolves to A single instance of Message </returns>
 public static async System.Threading.Tasks.Task<MessageResource> CreateAsync(CreateMessageOptions options,
                                                                              ITwilioRestClient client = null)
 {
     client = client ?? TwilioClient.GetRestClient();
     var response = await client.RequestAsync(BuildCreateRequest(options, client));
     return FromJson(response.Content);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Send a message from the account used to make the request
        /// </summary>
        ///
        /// <param name="to"> The phone number to receive the message </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="from"> The phone number that initiated the message </param>
        /// <param name="messagingServiceSid"> The messaging_service_sid </param>
        /// <param name="body"> The body </param>
        /// <param name="mediaUrl"> The media_url </param>
        /// <param name="statusCallback"> URL Twilio will request when the status changes </param>
        /// <param name="applicationSid"> The application to use for callbacks </param>
        /// <param name="maxPrice"> The max_price </param>
        /// <param name="provideFeedback"> The provide_feedback </param>
        /// <param name="validityPeriod"> The validity_period </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Message </returns>
        public static async System.Threading.Tasks.Task <MessageResource> CreateAsync(Types.PhoneNumber to, string pathAccountSid = null, Types.PhoneNumber from = null, string messagingServiceSid = null, string body = null, List <Uri> mediaUrl = null, Uri statusCallback = null, string applicationSid = null, decimal?maxPrice = null, bool?provideFeedback = null, int?validityPeriod = null, ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(to)
            {
                PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, ValidityPeriod = validityPeriod
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 6
0
 private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Messages.json",
                postParams: options.GetParams()
                ));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Send a message from the account used to make the request
        /// </summary>
        ///
        /// <param name="to"> The phone number to receive the message </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="from"> The phone number that initiated the message </param>
        /// <param name="messagingServiceSid"> The messaging_service_sid </param>
        /// <param name="body"> The body </param>
        /// <param name="mediaUrl"> The media_url </param>
        /// <param name="statusCallback"> URL Twilio will request when the status changes </param>
        /// <param name="applicationSid"> The application to use for callbacks </param>
        /// <param name="maxPrice"> The max_price </param>
        /// <param name="provideFeedback"> The provide_feedback </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(Types.PhoneNumber to, string pathAccountSid = null, Types.PhoneNumber from = null, string messagingServiceSid = null, string body = null, List <Uri> mediaUrl = null, Uri statusCallback = null, string applicationSid = null, decimal?maxPrice = null, bool?provideFeedback = null, ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(to)
            {
                PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback
            };

            return(Create(options, client));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Send a message from the account used to make the request
        /// </summary>
        /// <param name="to"> The destination phone number </param>
        /// <param name="pathAccountSid"> The SID of the Account that will create the resource </param>
        /// <param name="from"> The phone number that initiated the message </param>
        /// <param name="messagingServiceSid"> The SID of the Messaging Service you want to associate with the message. </param>
        /// <param name="body"> The text of the message you want to send. Can be up to 1,600 characters in length. </param>
        /// <param name="mediaUrl"> The URL of the media to send with the message </param>
        /// <param name="statusCallback"> The URL we should call to send status information to your application </param>
        /// <param name="applicationSid"> The application to use for callbacks </param>
        /// <param name="maxPrice"> The total maximum price up to 4 decimal places in US dollars acceptable for the message to
        ///                be delivered. </param>
        /// <param name="provideFeedback"> Whether to confirm delivery of the message </param>
        /// <param name="validityPeriod"> The number of seconds that the message can remain in our outgoing queue. </param>
        /// <param name="smartEncoded"> Whether to detect Unicode characters that have a similar GSM-7 character and replace
        ///                    them </param>
        /// <param name="interactiveData"> A JSON string that represents an interactive message </param>
        /// <param name="forceOptIn"> Whether to forcefully whitelist a from:to pair </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(Types.PhoneNumber to,
                                             string pathAccountSid      = null,
                                             Types.PhoneNumber from     = null,
                                             string messagingServiceSid = null,
                                             string body              = null,
                                             List <Uri> mediaUrl      = null,
                                             Uri statusCallback       = null,
                                             string applicationSid    = null,
                                             decimal?maxPrice         = null,
                                             bool?provideFeedback     = null,
                                             int?validityPeriod       = null,
                                             bool?smartEncoded        = null,
                                             string interactiveData   = null,
                                             bool?forceOptIn          = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(to)
            {
                PathAccountSid = pathAccountSid, From = from, MessagingServiceSid = messagingServiceSid, Body = body, MediaUrl = mediaUrl, StatusCallback = statusCallback, ApplicationSid = applicationSid, MaxPrice = maxPrice, ProvideFeedback = provideFeedback, ValidityPeriod = validityPeriod, SmartEncoded = smartEncoded, InteractiveData = interactiveData, ForceOptIn = forceOptIn
            };

            return(Create(options, client));
        }