/// <summary> /// Fetch the account specified by the provided Account Sid /// </summary> /// /// <param name="options"> Fetch Account parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Account </returns> public static AccountResource Fetch(FetchAccountOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildFetchRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Fetch the account specified by the provided Account Sid /// </summary> /// /// <param name="options"> Fetch Account parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Account </returns> public static async System.Threading.Tasks.Task <AccountResource> FetchAsync(FetchAccountOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildFetchRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Fetch the account specified by the provided Account Sid /// </summary> /// /// <param name="pathSid"> Fetch by unique Account Sid </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Account </returns> public static async System.Threading.Tasks.Task <AccountResource> FetchAsync(string pathSid = null, ITwilioRestClient client = null) { var options = new FetchAccountOptions { PathSid = pathSid }; return(await FetchAsync(options, client)); }
/// <summary> /// Fetch the account specified by the provided Account Sid /// </summary> /// /// <param name="pathSid"> Fetch by unique Account Sid </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Account </returns> public static AccountResource Fetch(string pathSid = null, ITwilioRestClient client = null) { var options = new FetchAccountOptions { PathSid = pathSid }; return(Fetch(options, client)); }
private static Request BuildFetchRequest(FetchAccountOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Get, Rest.Domain.Api, "/2010-04-01/Accounts/" + (options.PathSid ?? client.AccountSid) + ".json", queryParams: options.GetParams() )); }