/// <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.Messaging, "/v1/Sessions/" + options.PathSessionSid + "/Messages", client.Region, postParams: options.GetParams() )); }
/// <summary> /// create /// </summary> /// <param name="pathSessionSid"> The unique id of the Session for this message. </param> /// <param name="author"> The identity of the message's author. </param> /// <param name="attributes"> A string metadata field you can use to store any data you wish. </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="body"> The contents of the message. </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 pathSessionSid, string author = null, string attributes = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, string body = null, ITwilioRestClient client = null) { var options = new CreateMessageOptions(pathSessionSid) { Author = author, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, Body = body }; return(await CreateAsync(options, client)); }
/// <summary> /// create /// </summary> /// <param name="pathSessionSid"> The unique id of the Session for this message. </param> /// <param name="author"> The identity of the message's author. </param> /// <param name="attributes"> A string metadata field you can use to store any data you wish. </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="body"> The contents of the message. </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Message </returns> public static MessageResource Create(string pathSessionSid, string author = null, string attributes = null, DateTime?dateCreated = null, DateTime?dateUpdated = null, string body = null, ITwilioRestClient client = null) { var options = new CreateMessageOptions(pathSessionSid) { Author = author, Attributes = attributes, DateCreated = dateCreated, DateUpdated = dateUpdated, Body = body }; return(Create(options, client)); }
/// <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)); }