/// <summary>
        /// read
        /// </summary>
        /// <param name="pathCountryCode"> The ISO Country code of the country from which to read phone numbers </param>
        /// <param name="pathAccountSid"> The SID of the Account requesting the AvailablePhoneNumber resources </param>
        /// <param name="areaCode"> The area code of the phone numbers to read </param>
        /// <param name="contains"> The pattern on which to match phone numbers </param>
        /// <param name="smsEnabled"> Whether the phone numbers can receive text messages </param>
        /// <param name="mmsEnabled"> Whether the phone numbers can receive MMS messages </param>
        /// <param name="voiceEnabled"> Whether the phone numbers can receive calls. </param>
        /// <param name="excludeAllAddressRequired"> Whether to exclude phone numbers that require an Address </param>
        /// <param name="excludeLocalAddressRequired"> Whether to exclude phone numbers that require a local address </param>
        /// <param name="excludeForeignAddressRequired"> Whether to exclude phone numbers that require a foreign address
        ///                                     </param>
        /// <param name="beta"> Whether to read phone numbers new to the Twilio platform </param>
        /// <param name="nearNumber"> Given a phone number, find a geographically close number within distance miles.
        ///                  (US/Canada only) </param>
        /// <param name="nearLatLong"> Given a latitude/longitude pair lat,long find geographically close numbers within
        ///                   distance miles. (US/Canada only) </param>
        /// <param name="distance"> The search radius, in miles, for a near_ query. (US/Canada only) </param>
        /// <param name="inPostalCode"> Limit results to a particular postal code. (US/Canada only) </param>
        /// <param name="inRegion"> Limit results to a particular region. (US/Canada only) </param>
        /// <param name="inRateCenter"> Limit results to a specific rate center, or given a phone number search within the same
        ///                    rate center as that number. (US/Canada only) </param>
        /// <param name="inLata"> Limit results to a specific local access and transport area. (US/Canada only) </param>
        /// <param name="inLocality"> Limit results to a particular locality </param>
        /// <param name="faxEnabled"> Whether the phone numbers can receive faxes </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 National </returns>
        public static ResourceSet <NationalResource> Read(string pathCountryCode,
                                                          string pathAccountSid              = null,
                                                          int?areaCode                       = null,
                                                          string contains                    = null,
                                                          bool?smsEnabled                    = null,
                                                          bool?mmsEnabled                    = null,
                                                          bool?voiceEnabled                  = null,
                                                          bool?excludeAllAddressRequired     = null,
                                                          bool?excludeLocalAddressRequired   = null,
                                                          bool?excludeForeignAddressRequired = null,
                                                          bool?beta = null,
                                                          Types.PhoneNumber nearNumber = null,
                                                          string nearLatLong           = null,
                                                          int?distance             = null,
                                                          string inPostalCode      = null,
                                                          string inRegion          = null,
                                                          string inRateCenter      = null,
                                                          string inLata            = null,
                                                          string inLocality        = null,
                                                          bool?faxEnabled          = null,
                                                          int?pageSize             = null,
                                                          long?limit               = null,
                                                          ITwilioRestClient client = null)
        {
            var options = new ReadNationalOptions(pathCountryCode)
            {
                PathAccountSid = pathAccountSid, AreaCode = areaCode, Contains = contains, SmsEnabled = smsEnabled, MmsEnabled = mmsEnabled, VoiceEnabled = voiceEnabled, ExcludeAllAddressRequired = excludeAllAddressRequired, ExcludeLocalAddressRequired = excludeLocalAddressRequired, ExcludeForeignAddressRequired = excludeForeignAddressRequired, Beta = beta, NearNumber = nearNumber, NearLatLong = nearLatLong, Distance = distance, InPostalCode = inPostalCode, InRegion = inRegion, InRateCenter = inRateCenter, InLata = inLata, InLocality = inLocality, FaxEnabled = faxEnabled, PageSize = pageSize, Limit = limit
            };

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

            var page = Page <NationalResource> .FromJson("available_phone_numbers", response.Content);

            return(new ResourceSet <NationalResource>(page, options, client));
        }
예제 #3
0
 private static Request BuildReadRequest(ReadNationalOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/AvailablePhoneNumbers/" + options.PathCountryCode + "/National.json",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// read
        /// </summary>
        /// <param name="options"> Read National parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of National </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <NationalResource> > ReadAsync(ReadNationalOptions options,
                                                                                                    ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <NationalResource> .FromJson("available_phone_numbers", response.Content);

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