/// <summary>
        /// read
        /// </summary>
        ///
        /// <param name="pathWorkspaceSid"> The workspace_sid </param>
        /// <param name="endDate"> The end_date </param>
        /// <param name="eventType"> The event_type </param>
        /// <param name="minutes"> The minutes </param>
        /// <param name="reservationSid"> The reservation_sid </param>
        /// <param name="startDate"> The start_date </param>
        /// <param name="taskQueueSid"> The task_queue_sid </param>
        /// <param name="taskSid"> The task_sid </param>
        /// <param name="workerSid"> The worker_sid </param>
        /// <param name="workflowSid"> The workflow_sid </param>
        /// <param name="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Event </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <EventResource> > ReadAsync(string pathWorkspaceSid, DateTime?endDate = null, string eventType = null, int?minutes = null, string reservationSid = null, DateTime?startDate = null, string taskQueueSid = null, string taskSid = null, string workerSid = null, string workflowSid = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadEventOptions(pathWorkspaceSid)
            {
                EndDate = endDate, EventType = eventType, Minutes = minutes, ReservationSid = reservationSid, StartDate = startDate, TaskQueueSid = taskQueueSid, TaskSid = taskSid, WorkerSid = workerSid, WorkflowSid = workflowSid, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
        /// <summary>
        /// read
        /// </summary>
        ///
        /// <param name="options"> Read Event parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Event </returns>
        public static ResourceSet <EventResource> Read(ReadEventOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <EventResource> .FromJson("events", response.Content);

            return(new ResourceSet <EventResource>(page, options, client));
        }
 private static Request BuildReadRequest(ReadEventOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Taskrouter,
                "/v1/Workspaces/" + options.PathWorkspaceSid + "/Events",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// read
        /// </summary>
        /// <param name="pathWorkspaceSid"> Filter events by those pertaining to a particular workspace </param>
        /// <param name="endDate"> Filter events by an end date. </param>
        /// <param name="eventType"> Filter events by those of a certain event type </param>
        /// <param name="minutes"> Filter events by up to 'x' minutes in the past. </param>
        /// <param name="reservationSid"> Filter events by those pertaining to a particular reservation </param>
        /// <param name="startDate"> Filter events by a start date. </param>
        /// <param name="taskQueueSid"> Filter events by those pertaining to a particular queue </param>
        /// <param name="taskSid"> Filter events by those pertaining to a particular task </param>
        /// <param name="workerSid"> Filter events by those pertaining to a particular worker </param>
        /// <param name="workflowSid"> Filter events by those pertaining to a particular workflow </param>
        /// <param name="taskChannel"> Filter events by those pertaining to a particular task channel </param>
        /// <param name="sid"> Filter events by those pertaining to a particular event </param>
        /// <param name="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Event </returns>
        public static ResourceSet <EventResource> Read(string pathWorkspaceSid,
                                                       DateTime?endDate         = null,
                                                       string eventType         = null,
                                                       int?minutes              = null,
                                                       string reservationSid    = null,
                                                       DateTime?startDate       = null,
                                                       string taskQueueSid      = null,
                                                       string taskSid           = null,
                                                       string workerSid         = null,
                                                       string workflowSid       = null,
                                                       string taskChannel       = null,
                                                       string sid               = null,
                                                       int?pageSize             = null,
                                                       long?limit               = null,
                                                       ITwilioRestClient client = null)
        {
            var options = new ReadEventOptions(pathWorkspaceSid)
            {
                EndDate = endDate, EventType = eventType, Minutes = minutes, ReservationSid = reservationSid, StartDate = startDate, TaskQueueSid = taskQueueSid, TaskSid = taskSid, WorkerSid = workerSid, WorkflowSid = workflowSid, TaskChannel = taskChannel, Sid = sid, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// read
        /// </summary>
        ///
        /// <param name="options"> Read Event parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Event </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <EventResource> > ReadAsync(ReadEventOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <EventResource> .FromJson("events", response.Content);

            return(new ResourceSet <EventResource>(page, options, client));
        }