Exemplo n.º 1
0
        /// <summary>
        /// Retrieve a list of all Rate Limits for a service.
        /// </summary>
        /// <param name="options"> Read RateLimit parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of RateLimit </returns>
        public static ResourceSet <RateLimitResource> Read(ReadRateLimitOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <RateLimitResource> .FromJson("rate_limits", response.Content);

            return(new ResourceSet <RateLimitResource>(page, options, client));
        }
 private static Request BuildReadRequest(ReadRateLimitOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/RateLimits",
                queryParams: options.GetParams()
                ));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieve a list of all Rate Limits for a service.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </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 RateLimit </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <RateLimitResource> > ReadAsync(string pathServiceSid,
                                                                                                     int?pageSize             = null,
                                                                                                     long?limit               = null,
                                                                                                     ITwilioRestClient client = null)
        {
            var options = new ReadRateLimitOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Retrieve a list of all Rate Limits for a service.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </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 RateLimit </returns>
        public static ResourceSet <RateLimitResource> Read(string pathServiceSid,
                                                           int?pageSize             = null,
                                                           long?limit               = null,
                                                           ITwilioRestClient client = null)
        {
            var options = new ReadRateLimitOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Retrieve a list of all Rate Limits for a service.
        /// </summary>
        /// <param name="options"> Read RateLimit parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of RateLimit </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <RateLimitResource> > ReadAsync(ReadRateLimitOptions options,
                                                                                                     ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <RateLimitResource> .FromJson("rate_limits", response.Content);

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