/// <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)); }
/// <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)); }
/// <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)); }
private static Request BuildCreateRequest(CreateMessageOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Chat, "/v1/Services/" + options.PathServiceSid + "/Channels/" + options.PathChannelSid + "/Messages", postParams: options.GetParams() )); }
/// <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)); }