示例#1
0
        /// <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));
        }
示例#2
0
        /// <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));
        }
示例#3
0
 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()
                ));
 }
示例#4
0
        /// <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));
        }
示例#5
0
        /// <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));
        }