/// <summary> /// Create a new Bucket for a Rate Limit /// </summary> /// <param name="options"> Create Bucket parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Bucket </returns> public static BucketResource Create(CreateBucketOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = client.Request(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
/// <summary> /// Create a new Bucket for a Rate Limit /// </summary> /// <param name="options"> Create Bucket parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Bucket </returns> public static async System.Threading.Tasks.Task <BucketResource> CreateAsync(CreateBucketOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }
private static Request BuildCreateRequest(CreateBucketOptions options, ITwilioRestClient client) { return(new Request( HttpMethod.Post, Rest.Domain.Verify, "/v2/Services/" + options.PathServiceSid + "/RateLimits/" + options.PathRateLimitSid + "/Buckets", postParams: options.GetParams() )); }
/// <summary> /// Create a new Bucket for a Rate Limit /// </summary> /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </param> /// <param name="pathRateLimitSid"> Rate Limit Sid. </param> /// <param name="max"> Max number of requests. </param> /// <param name="interval"> Number of seconds that the rate limit will be enforced over. </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Bucket </returns> public static async System.Threading.Tasks.Task <BucketResource> CreateAsync(string pathServiceSid, string pathRateLimitSid, int?max, int?interval, ITwilioRestClient client = null) { var options = new CreateBucketOptions(pathServiceSid, pathRateLimitSid, max, interval); return(await CreateAsync(options, client)); }
/// <summary> /// Create a new Bucket for a Rate Limit /// </summary> /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </param> /// <param name="pathRateLimitSid"> Rate Limit Sid. </param> /// <param name="max"> Max number of requests. </param> /// <param name="interval"> Number of seconds that the rate limit will be enforced over. </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> A single instance of Bucket </returns> public static BucketResource Create(string pathServiceSid, string pathRateLimitSid, int?max, int?interval, ITwilioRestClient client = null) { var options = new CreateBucketOptions(pathServiceSid, pathRateLimitSid, max, interval); return(Create(options, client)); }