예제 #1
0
        /// <summary>
        /// Fetch the balance for an Account based on Account Sid. Balance changes may not be reflected immediately. Child
        /// accounts do not contain balance information
        /// </summary>
        /// <param name="options"> Fetch Balance parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Balance </returns>
        public static BalanceResource Fetch(FetchBalanceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
예제 #2
0
        /// <summary>
        /// Fetch the balance for an Account based on Account Sid. Balance changes may not be reflected immediately. Child
        /// accounts do not contain balance information
        /// </summary>
        /// <param name="options"> Fetch Balance parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Balance </returns>
        public static async System.Threading.Tasks.Task <BalanceResource> FetchAsync(FetchBalanceOptions options,
                                                                                     ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
예제 #3
0
        /// <summary>
        /// Fetch the balance for an Account based on Account Sid. Balance changes may not be reflected immediately. Child
        /// accounts do not contain balance information
        /// </summary>
        /// <param name="pathAccountSid"> Account Sid. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Balance </returns>
        public static BalanceResource Fetch(string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchBalanceOptions()
            {
                PathAccountSid = pathAccountSid
            };

            return(Fetch(options, client));
        }
 private static Request BuildFetchRequest(FetchBalanceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Balance.json",
                queryParams: options.GetParams()
                ));
 }
예제 #5
0
        /// <summary>
        /// Fetch the balance for an Account based on Account Sid. Balance changes may not be reflected immediately. Child
        /// accounts do not contain balance information
        /// </summary>
        /// <param name="pathAccountSid"> Account Sid. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Balance </returns>
        public static async System.Threading.Tasks.Task <BalanceResource> FetchAsync(string pathAccountSid    = null,
                                                                                     ITwilioRestClient client = null)
        {
            var options = new FetchBalanceOptions()
            {
                PathAccountSid = pathAccountSid
            };

            return(await FetchAsync(options, client));
        }