Exemplo n.º 1
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> 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,
                                             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(Create(options, client));
        }
Exemplo n.º 2
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> 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?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(await CreateAsync(options, client));
        }