/// <summary>
        /// List SIP Domains associated with the Trunk
        /// </summary>
        /// <param name="options"> Read TerminatingSipDomain parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of TerminatingSipDomain </returns>
        public static ResourceSet <TerminatingSipDomainResource> Read(ReadTerminatingSipDomainOptions options,
                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <TerminatingSipDomainResource> .FromJson("sip_domains", response.Content);

            return(new ResourceSet <TerminatingSipDomainResource>(page, options, client));
        }
 private static Request BuildReadRequest(ReadTerminatingSipDomainOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Trunking,
                "/v1/Trunks/" + options.PathTrunkSid + "/TerminatingSipDomains",
                client.Region,
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// List SIP Domains associated with the Trunk
        /// </summary>
        /// <param name="pathTrunkSid"> The SID of the Trunk with the resources to read </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 TerminatingSipDomain </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <TerminatingSipDomainResource> > ReadAsync(string pathTrunkSid,
                                                                                                                int?pageSize             = null,
                                                                                                                long?limit               = null,
                                                                                                                ITwilioRestClient client = null)
        {
            var options = new ReadTerminatingSipDomainOptions(pathTrunkSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
        /// <summary>
        /// List SIP Domains associated with the Trunk
        /// </summary>
        /// <param name="pathTrunkSid"> The SID of the Trunk with the resources to read </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 TerminatingSipDomain </returns>
        public static ResourceSet <TerminatingSipDomainResource> Read(string pathTrunkSid,
                                                                      int?pageSize             = null,
                                                                      long?limit               = null,
                                                                      ITwilioRestClient client = null)
        {
            var options = new ReadTerminatingSipDomainOptions(pathTrunkSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// List SIP Domains associated with the Trunk
        /// </summary>
        /// <param name="options"> Read TerminatingSipDomain parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of TerminatingSipDomain </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <TerminatingSipDomainResource> > ReadAsync(ReadTerminatingSipDomainOptions options,
                                                                                                                ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <TerminatingSipDomainResource> .FromJson("sip_domains", response.Content);

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