/// <summary> /// Fetch and instance of a usage-trigger /// </summary> /// /// <param name="options"> Fetch Trigger parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Trigger </returns> public static TriggerResource Fetch(FetchTriggerOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildFetchRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Fetch and instance of a usage-trigger /// </summary> /// /// <param name="options"> Fetch Trigger parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Trigger </returns> public static async System.Threading.Tasks.Task <TriggerResource> FetchAsync(FetchTriggerOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildFetchRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Fetch and instance of a usage-trigger /// </summary> /// /// <param name="pathSid"> Fetch by unique usage-trigger Sid </param> /// <param name="pathAccountSid"> The account_sid </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Trigger </returns> public static async System.Threading.Tasks.Task <TriggerResource> FetchAsync(string pathSid, string pathAccountSid = null, ITwilioRestClient client = null) { var options = new FetchTriggerOptions(pathSid) { PathAccountSid = pathAccountSid }; return(await FetchAsync(options, client)); }
/// <summary> /// Fetch and instance of a usage-trigger /// </summary> /// /// <param name="pathSid"> Fetch by unique usage-trigger Sid </param> /// <param name="pathAccountSid"> The account_sid </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Trigger </returns> public static TriggerResource Fetch(string pathSid, string pathAccountSid = null, ITwilioRestClient client = null) { var options = new FetchTriggerOptions(pathSid) { PathAccountSid = pathAccountSid }; return(Fetch(options, client)); }
private static Request BuildFetchRequest(FetchTriggerOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Get, Rest.Domain.Api, "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Usage/Triggers/" + options.PathSid + ".json", client.Region, queryParams: options.GetParams() )); }