/// <summary>
        /// fetch
        /// </summary>
        /// <param name="options"> Fetch Usage parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Usage </returns>
        public static UsageResource Fetch(FetchUsageOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

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

            return(FromJson(response.Content));
        }
Exemple #3
0
 private static Request BuildFetchRequest(FetchUsageOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Preview,
                "/wireless/Sims/" + options.PathSimSid + "/Usage",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// fetch
        /// </summary>
        ///
        /// <param name="pathSimSid"> The sim_sid </param>
        /// <param name="end"> The end </param>
        /// <param name="start"> The start </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Usage </returns>
        public static async System.Threading.Tasks.Task <UsageResource> FetchAsync(string pathSimSid, string end = null, string start = null, ITwilioRestClient client = null)
        {
            var options = new FetchUsageOptions(pathSimSid)
            {
                End = end, Start = start
            };

            return(await FetchAsync(options, client));
        }
        /// <summary>
        /// fetch
        /// </summary>
        ///
        /// <param name="pathSimSid"> The sim_sid </param>
        /// <param name="end"> The end </param>
        /// <param name="start"> The start </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Usage </returns>
        public static UsageResource Fetch(string pathSimSid, string end = null, string start = null, ITwilioRestClient client = null)
        {
            var options = new FetchUsageOptions(pathSimSid)
            {
                End = end, Start = start
            };

            return(Fetch(options, client));
        }