예제 #1
0
        /// <summary>
        /// Fetch a pricing for a specific destination and, optionally, origination phone number.
        /// </summary>
        /// <param name="options"> Fetch Number parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Number </returns>
        public static NumberResource Fetch(FetchNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
예제 #2
0
        /// <summary>
        /// Fetch a pricing for a specific destination and, optionally, origination phone number.
        /// </summary>
        /// <param name="options"> Fetch Number parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Number </returns>
        public static async System.Threading.Tasks.Task <NumberResource> FetchAsync(FetchNumberOptions options,
                                                                                    ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildFetchRequest(FetchNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Pricing,
                "/v2/Voice/Numbers/" + options.PathDestinationNumber + "",
                queryParams: options.GetParams()
                ));
 }
예제 #4
0
        /// <summary>
        /// Fetch a pricing for a specific destination and, optionally, origination phone number.
        /// </summary>
        /// <param name="pathDestinationNumber"> Fetches voice prices for number </param>
        /// <param name="originationNumber"> The origination_number </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Number </returns>
        public static async System.Threading.Tasks.Task <NumberResource> FetchAsync(Types.PhoneNumber pathDestinationNumber,
                                                                                    Types.PhoneNumber originationNumber = null,
                                                                                    ITwilioRestClient client            = null)
        {
            var options = new FetchNumberOptions(pathDestinationNumber)
            {
                OriginationNumber = originationNumber
            };

            return(await FetchAsync(options, client));
        }
예제 #5
0
        /// <summary>
        /// Fetch a pricing for a specific destination and, optionally, origination phone number.
        /// </summary>
        /// <param name="pathDestinationNumber"> Fetches voice prices for number </param>
        /// <param name="originationNumber"> The origination_number </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Number </returns>
        public static NumberResource Fetch(Types.PhoneNumber pathDestinationNumber,
                                           Types.PhoneNumber originationNumber = null,
                                           ITwilioRestClient client            = null)
        {
            var options = new FetchNumberOptions(pathDestinationNumber)
            {
                OriginationNumber = originationNumber
            };

            return(Fetch(options, client));
        }