示例#1
0
        /// <summary>
        /// Create a new Rate Limit for a Service
        /// </summary>
        /// <param name="options"> Create RateLimit parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of RateLimit </returns>
        public static RateLimitResource Create(CreateRateLimitOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
 private static Request BuildCreateRequest(CreateRateLimitOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/RateLimits",
                postParams: options.GetParams()
                ));
 }
示例#3
0
        /// <summary>
        /// Create a new Rate Limit for a Service
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Rate Limit. </param>
        /// <param name="description"> Description of this Rate 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 <RateLimitResource> CreateAsync(string pathServiceSid,
                                                                                        string uniqueName,
                                                                                        string description       = null,
                                                                                        ITwilioRestClient client = null)
        {
            var options = new CreateRateLimitOptions(pathServiceSid, uniqueName)
            {
                Description = description
            };

            return(await CreateAsync(options, client));
        }
示例#4
0
        /// <summary>
        /// Create a new Rate Limit for a Service
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </param>
        /// <param name="uniqueName"> A unique, developer assigned name of this Rate Limit. </param>
        /// <param name="description"> Description of this Rate Limit </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of RateLimit </returns>
        public static RateLimitResource Create(string pathServiceSid,
                                               string uniqueName,
                                               string description       = null,
                                               ITwilioRestClient client = null)
        {
            var options = new CreateRateLimitOptions(pathServiceSid, uniqueName)
            {
                Description = description
            };

            return(Create(options, client));
        }
示例#5
0
        /// <summary>
        /// Create a new Rate Limit for a Service
        /// </summary>
        /// <param name="options"> Create 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 <RateLimitResource> CreateAsync(CreateRateLimitOptions options,
                                                                                        ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }