/// <summary>
        /// Retrieve a list of all user roles in your service
        /// </summary>
        /// <param name="options"> Read Role parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Role </returns>
        public static ResourceSet <RoleResource> Read(ReadRoleOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <RoleResource> .FromJson("roles", response.Content);

            return(new ResourceSet <RoleResource>(page, options, client));
        }
 private static Request BuildReadRequest(ReadRoleOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Conversations,
                "/v1/Services/" + options.PathChatServiceSid + "/Roles",
                queryParams: options.GetParams(),
                headerParams: null
                ));
 }
        /// <summary>
        /// Retrieve a list of all user roles in your service
        /// </summary>
        /// <param name="pathChatServiceSid"> The SID of the Conversation Service to read the resources 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> Task that resolves to A single instance of Role </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <RoleResource> > ReadAsync(string pathChatServiceSid,
                                                                                                int?pageSize             = null,
                                                                                                long?limit               = null,
                                                                                                ITwilioRestClient client = null)
        {
            var options = new ReadRoleOptions(pathChatServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
        /// <summary>
        /// Retrieve a list of all user roles in your service
        /// </summary>
        /// <param name="pathChatServiceSid"> The SID of the Conversation Service to read the resources 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 Role </returns>
        public static ResourceSet <RoleResource> Read(string pathChatServiceSid,
                                                      int?pageSize             = null,
                                                      long?limit               = null,
                                                      ITwilioRestClient client = null)
        {
            var options = new ReadRoleOptions(pathChatServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// Retrieve a list of all user roles in your service
        /// </summary>
        /// <param name="options"> Read Role parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Role </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <RoleResource> > ReadAsync(ReadRoleOptions options,
                                                                                                ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <RoleResource> .FromJson("roles", response.Content);

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