Esempio n. 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));
        }
 private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Conversations,
                "/v1/Conversations/" + options.PathConversationSid + "/Messages",
                postParams: options.GetParams()
                ));
 }
Esempio n. 3
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathConversationSid"> The unique id of the Conversation for this message. </param>
        /// <param name="author"> The channel specific identifier of the message's author. </param>
        /// <param name="body"> The content of the message. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Message </returns>
        public static MessageResource Create(string pathConversationSid,
                                             string author            = null,
                                             string body              = null,
                                             DateTime?dateCreated     = null,
                                             DateTime?dateUpdated     = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathConversationSid)
            {
                Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated
            };

            return(Create(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// create
        /// </summary>
        /// <param name="pathConversationSid"> The unique id of the Conversation for this message. </param>
        /// <param name="author"> The channel specific identifier of the message's author. </param>
        /// <param name="body"> The content of the message. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </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 pathConversationSid,
                                                                                      string author            = null,
                                                                                      string body              = null,
                                                                                      DateTime?dateCreated     = null,
                                                                                      DateTime?dateUpdated     = null,
                                                                                      ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathConversationSid)
            {
                Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Add a new message to the conversation
        /// </summary>
        /// <param name="pathConversationSid"> The unique ID of the Conversation for this message. </param>
        /// <param name="author"> The channel specific identifier of the message's author. </param>
        /// <param name="body"> The content of the message. </param>
        /// <param name="dateCreated"> The date that this resource was created. </param>
        /// <param name="dateUpdated"> The date that this resource was last updated. </param>
        /// <param name="attributes"> A string metadata field you can use to store any data you wish. </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 pathConversationSid,
                                             string author        = null,
                                             string body          = null,
                                             DateTime?dateCreated = null,
                                             DateTime?dateUpdated = null,
                                             string attributes    = null,
                                             string mediaSid      = null,
                                             MessageResource.WebhookEnabledTypeEnum xTwilioWebhookEnabled = null,
                                             ITwilioRestClient client = null)
        {
            var options = new CreateMessageOptions(pathConversationSid)
            {
                Author = author, Body = body, DateCreated = dateCreated, DateUpdated = dateUpdated, Attributes = attributes, MediaSid = mediaSid, XTwilioWebhookEnabled = xTwilioWebhookEnabled
            };

            return(Create(options, client));
        }
Esempio n. 6
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));
        }