/// <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));
        }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathWorkspaceSid"> The workspace_sid </param>
        /// <param name="timeout"> The timeout </param>
        /// <param name="priority"> The priority </param>
        /// <param name="taskChannel"> The task_channel </param>
        /// <param name="workflowSid"> The workflow_sid </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 Task </returns>
        public static async System.Threading.Tasks.Task <TaskResource> CreateAsync(string pathWorkspaceSid, int?timeout = null, int?priority = null, string taskChannel = null, string workflowSid = null, string attributes = null, ITwilioRestClient client = null)
        {
            var options = new CreateTaskOptions(pathWorkspaceSid)
            {
                Timeout = timeout, Priority = priority, TaskChannel = taskChannel, WorkflowSid = workflowSid, Attributes = attributes
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="pathWorkspaceSid"> The workspace_sid </param>
        /// <param name="timeout"> The timeout </param>
        /// <param name="priority"> The priority </param>
        /// <param name="taskChannel"> The task_channel </param>
        /// <param name="workflowSid"> The workflow_sid </param>
        /// <param name="attributes"> The attributes </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Task </returns>
        public static TaskResource Create(string pathWorkspaceSid, int?timeout = null, int?priority = null, string taskChannel = null, string workflowSid = null, string attributes = null, ITwilioRestClient client = null)
        {
            var options = new CreateTaskOptions(pathWorkspaceSid)
            {
                Timeout = timeout, Priority = priority, TaskChannel = taskChannel, WorkflowSid = workflowSid, Attributes = attributes
            };

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateTaskOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Taskrouter,
                "/v1/Workspaces/" + options.PathWorkspaceSid + "/Tasks",
                postParams: options.GetParams()
                ));
 }