private static Request BuildFetchRequest(FetchPhoneNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Lookups,
                "/v1/PhoneNumbers/" + options.PathPhoneNumber + "",
                client.Region,
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// fetch
        /// </summary>
        /// <param name="pathPhoneNumber"> The phone number to fetch in E.164 format </param>
        /// <param name="countryCode"> The ISO country code of the phone number </param>
        /// <param name="type"> The type of information to return </param>
        /// <param name="addOns"> The unique_name of an Add-on you would like to invoke </param>
        /// <param name="addOnsData"> Data specific to the add-on you would like to invoke </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static PhoneNumberResource Fetch(Types.PhoneNumber pathPhoneNumber,
                                                string countryCode   = null,
                                                List <string> type   = null,
                                                List <string> addOns = null,
                                                Dictionary <string, object> addOnsData = null,
                                                ITwilioRestClient client = null)
        {
            var options = new FetchPhoneNumberOptions(pathPhoneNumber)
            {
                CountryCode = countryCode, Type = type, AddOns = addOns, AddOnsData = addOnsData
            };

            return(Fetch(options, client));
        }
        /// <summary>
        /// fetch
        /// </summary>
        /// <param name="pathPhoneNumber"> The phone number to fetch in E.164 format </param>
        /// <param name="countryCode"> The ISO country code of the phone number </param>
        /// <param name="type"> The type of information to return </param>
        /// <param name="addOns"> The unique_name of an Add-on you would like to invoke </param>
        /// <param name="addOnsData"> Data specific to the add-on you would like to invoke </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of PhoneNumber </returns>
        public static async System.Threading.Tasks.Task <PhoneNumberResource> FetchAsync(Types.PhoneNumber pathPhoneNumber,
                                                                                         string countryCode   = null,
                                                                                         List <string> type   = null,
                                                                                         List <string> addOns = null,
                                                                                         Dictionary <string, object> addOnsData = null,
                                                                                         ITwilioRestClient client = null)
        {
            var options = new FetchPhoneNumberOptions(pathPhoneNumber)
            {
                CountryCode = countryCode, Type = type, AddOns = addOns, AddOnsData = addOnsData
            };

            return(await FetchAsync(options, client));
        }
        /// <summary>
        /// fetch
        /// </summary>
        ///
        /// <param name="options"> Fetch PhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of PhoneNumber </returns>
        public static async System.Threading.Tasks.Task <PhoneNumberResource> FetchAsync(FetchPhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }