コード例 #1
0
        /// <summary>
        /// Retrieve a list of all Buckets for a Rate Limit.
        /// </summary>
        /// <param name="options"> Read Bucket parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Bucket </returns>
        public static ResourceSet <BucketResource> Read(ReadBucketOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <BucketResource> .FromJson("buckets", response.Content);

            return(new ResourceSet <BucketResource>(page, options, client));
        }
コード例 #2
0
 private static Request BuildReadRequest(ReadBucketOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/RateLimits/" + options.PathRateLimitSid + "/Buckets",
                queryParams: options.GetParams()
                ));
 }
コード例 #3
0
        /// <summary>
        /// Retrieve a list of all Buckets 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="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </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 <ResourceSet <BucketResource> > ReadAsync(string pathServiceSid,
                                                                                                  string pathRateLimitSid,
                                                                                                  int?pageSize             = null,
                                                                                                  long?limit               = null,
                                                                                                  ITwilioRestClient client = null)
        {
            var options = new ReadBucketOptions(pathServiceSid, pathRateLimitSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
コード例 #4
0
        /// <summary>
        /// Retrieve a list of all Buckets 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="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Bucket </returns>
        public static ResourceSet <BucketResource> Read(string pathServiceSid,
                                                        string pathRateLimitSid,
                                                        int?pageSize             = null,
                                                        long?limit               = null,
                                                        ITwilioRestClient client = null)
        {
            var options = new ReadBucketOptions(pathServiceSid, pathRateLimitSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
コード例 #5
0
        /// <summary>
        /// Retrieve a list of all Buckets for a Rate Limit.
        /// </summary>
        /// <param name="options"> Read 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 <ResourceSet <BucketResource> > ReadAsync(ReadBucketOptions options,
                                                                                                  ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <BucketResource> .FromJson("buckets", response.Content);

            return(new ResourceSet <BucketResource>(page, options, client));
        }