Example #1
0
        /// <summary>
        /// create
        /// </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));
        }
Example #2
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="body"> The body </param>
        /// <param name="from"> The from </param>
        /// <param name="attributes"> The attributes </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(string pathServiceSid, string pathChannelSid, string body, string from = null, string attributes = null, ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathServiceSid, pathChannelSid, body)
            {
                From = from, Attributes = attributes
            };

            return(await CreateAsync(options, client));
        }
Example #3
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="body"> The body </param>
        /// <param name="from"> The from </param>
        /// <param name="attributes"> The attributes </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(string pathServiceSid, string pathChannelSid, string body, string from = null, string attributes = null, ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathServiceSid, pathChannelSid, body)
            {
                From = from, Attributes = attributes
            };

            return(Create(options, client));
        }
Example #4
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="body"> The body </param>
        /// <param name="from"> The from </param>
        /// <param name="attributes"> The attributes </param>
        /// <param name="dateCreated"> The date_created </param>
        /// <param name="dateUpdated"> The date_updated </param>
        /// <param name="lastUpdatedBy"> The last_updated_by </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(string pathServiceSid, string pathChannelSid, string body, string from = null, string attributes = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, string lastUpdatedBy = null, ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathServiceSid, pathChannelSid, body)
            {
                From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy
            };

            return(Create(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathServiceSid"> The service_sid </param>
        /// <param name="pathChannelSid"> The channel_sid </param>
        /// <param name="from"> The from </param>
        /// <param name="attributes"> The attributes </param>
        /// <param name="dateCreated"> The date_created </param>
        /// <param name="dateUpdated"> The date_updated </param>
        /// <param name="lastUpdatedBy"> The last_updated_by </param>
        /// <param name="body"> The body </param>
        /// <param name="mediaSid"> The media_sid </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(string pathServiceSid, string pathChannelSid, string from = null, string attributes = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, string lastUpdatedBy = null, string body = null, string mediaSid = null, ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathServiceSid, pathChannelSid)
            {
                From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid
            };

            return(await CreateAsync(options, client));
        }
 private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.IpMessaging,
                "/v2/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the resource under </param>
        /// <param name="pathChannelSid"> The SID of the Channel the new resource belongs to </param>
        /// <param name="from"> The Identity of the new message's author </param>
        /// <param name="attributes"> A valid JSON string that contains application-specific data </param>
        /// <param name="dateCreated"> The ISO 8601 date and time in GMT when the resource was created </param>
        /// <param name="dateUpdated"> The ISO 8601 date and time in GMT when the resource was updated </param>
        /// <param name="lastUpdatedBy"> The Identity of the User who last updated the Message </param>
        /// <param name="body"> The message to send to the channel </param>
        /// <param name="mediaSid">  The Media Sid to be attached to the new Message </param>
        /// <param name="xTwilioWebhookEnabled"> The X-Twilio-Webhook-Enabled HTTP request header </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(string pathServiceSid,
                                             string pathChannelSid,
                                             string from          = null,
                                             string attributes    = null,
                                             DateTime?dateCreated = null,
                                             DateTime?dateUpdated = null,
                                             string lastUpdatedBy = null,
                                             string body          = null,
                                             string mediaSid      = null,
                                             MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathServiceSid, pathChannelSid)
            {
                From = from, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, LastUpdatedBy = lastUpdatedBy, Body = body, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled
            };

            return(Create(options, client));
        }
Example #8
0
        /// <summary>
        /// create
        /// </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));
        }