/// <summary>
        /// Retrieve a list of all Sessions for this Service.
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Session. </param>
        /// <param name="status"> The Status of this Session </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 Session </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <SessionResource> > ReadAsync(string pathServiceSid, string uniqueName = null, SessionResource.StatusEnum status = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, Status = status, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
        /// <summary>
        /// Retrieve a list of all Sessions for this Service.
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Session. </param>
        /// <param name="status"> The Status of this Session </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 Session </returns>
        public static ResourceSet <SessionResource> Read(string pathServiceSid, string uniqueName = null, SessionResource.StatusEnum status = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadSessionOptions(pathServiceSid)
            {
                UniqueName = uniqueName, Status = status, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// Retrieve a list of all Sessions for this Service.
        /// </summary>
        ///
        /// <param name="options"> Read Session parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Session </returns>
        public static ResourceSet <SessionResource> Read(ReadSessionOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <SessionResource> .FromJson("sessions", response.Content);

            return(new ResourceSet <SessionResource>(page, options, client));
        }
 private static Request BuildReadRequest(ReadSessionOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Proxy,
                "/v1/Services/" + options.PathServiceSid + "/Sessions",
                queryParams: options.GetParams()
                ));
 }
Exemple #5
0
        /// <summary>
        /// Retrieve a list of all Sessions for the Service. A maximum of 100 records will be returned per page.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to fetch the resource from </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 Session </returns>
        public static ResourceSet <SessionResource> Read(string pathServiceSid,
                                                         int?pageSize             = null,
                                                         long?limit               = null,
                                                         ITwilioRestClient client = null)
        {
            var options = new ReadSessionOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// Retrieve a list of all Sessions for this Service.
        /// </summary>
        ///
        /// <param name="options"> Read Session parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Session </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <SessionResource> > ReadAsync(ReadSessionOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <SessionResource> .FromJson("sessions", response.Content);

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