/// <summary> /// create /// </summary> /// <param name="options"> Create Task parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Task </returns> public static TaskResource Create(CreateTaskOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// create /// </summary> /// <param name="options"> Create Task parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Task </returns> public static async System.Threading.Tasks.Task<TaskResource> CreateAsync(CreateTaskOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return FromJson(response.Content); }
private static Request BuildCreateRequest(CreateTaskOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Autopilot, "/v1/Assistants/" + options.PathAssistantSid + "/Tasks", postParams: options.GetParams() )); }
/// <summary> /// create /// </summary> /// <param name="pathAssistantSid"> The SID of the Assistant that is the parent of the new resource </param> /// <param name="uniqueName"> An application-defined string that uniquely identifies the resource </param> /// <param name="friendlyName"> descriptive string that you create to describe the new resource </param> /// <param name="actions"> The JSON string that specifies the actions that instruct the Assistant on how to perform the /// task </param> /// <param name="actionsUrl"> The URL from which the Assistant can fetch actions </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Task </returns> public static async System.Threading.Tasks.Task<TaskResource> CreateAsync(string pathAssistantSid, string uniqueName, string friendlyName = null, object actions = null, Uri actionsUrl = null, ITwilioRestClient client = null) { var options = new CreateTaskOptions(pathAssistantSid, uniqueName){FriendlyName = friendlyName, Actions = actions, ActionsUrl = actionsUrl}; return await CreateAsync(options, client); }
/// <summary> /// create /// </summary> /// <param name="pathAssistantSid"> The SID of the Assistant that is the parent of the new resource </param> /// <param name="uniqueName"> An application-defined string that uniquely identifies the resource </param> /// <param name="friendlyName"> descriptive string that you create to describe the new resource </param> /// <param name="actions"> The JSON string that specifies the actions that instruct the Assistant on how to perform the /// task </param> /// <param name="actionsUrl"> The URL from which the Assistant can fetch actions </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Task </returns> public static TaskResource Create(string pathAssistantSid, string uniqueName, string friendlyName = null, object actions = null, Uri actionsUrl = null, ITwilioRestClient client = null) { var options = new CreateTaskOptions(pathAssistantSid, uniqueName){FriendlyName = friendlyName, Actions = actions, ActionsUrl = actionsUrl}; return Create(options, client); }