示例#1
0
        /// <summary>
        /// Create a new Verification Service.
        /// </summary>
        ///
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(CreateServiceOptions 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 Verification Service.
        /// </summary>
        ///
        /// <param name="name"> Friendly name of the service </param>
        /// <param name="codeLength"> Length of verification code. Valid values are 4-10 </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(string name, int?codeLength = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(name)
            {
                CodeLength = codeLength
            };

            return(await CreateAsync(options, client));
        }
示例#3
0
        /// <summary>
        /// Create a new Verification Service.
        /// </summary>
        ///
        /// <param name="name"> Friendly name of the service </param>
        /// <param name="codeLength"> Length of verification code. Valid values are 4-10 </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Service </returns>
        public static ServiceResource Create(string name, int?codeLength = null, ITwilioRestClient client = null)
        {
            var options = new CreateServiceOptions(name)
            {
                CodeLength = codeLength
            };

            return(Create(options, client));
        }
示例#4
0
 private static Request BuildCreateRequest(CreateServiceOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Preview,
                "/Verification/Services",
                client.Region,
                postParams: options.GetParams()
                ));
 }
示例#5
0
        /// <summary>
        /// Create a new Verification Service.
        /// </summary>
        ///
        /// <param name="options"> Create Service parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Service </returns>
        public static async System.Threading.Tasks.Task <ServiceResource> CreateAsync(CreateServiceOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }