Esempio n. 1
0
        /// <summary>
        /// Create a new Verification for a To number using a Service
        /// </summary>
        ///
        /// <param name="options"> Create Verification parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Verification </returns>
        public static VerificationResource Create(CreateVerificationOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new Verification for a To number using a Service
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="to"> To phonenumber </param>
        /// <param name="channel"> sms or call </param>
        /// <param name="customMessage"> A custom message for this verification </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Verification </returns>
        public static VerificationResource Create(string pathServiceSid, string to, string channel, string customMessage = null, ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomMessage = customMessage
            };

            return(Create(options, client));
        }
Esempio n. 3
0
        /// <summary>
        /// Create a new Verification for a To number using a Service
        /// </summary>
        ///
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="to"> To phonenumber </param>
        /// <param name="channel"> sms or call </param>
        /// <param name="customMessage"> A custom message for this verification </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Verification </returns>
        public static async System.Threading.Tasks.Task <VerificationResource> CreateAsync(string pathServiceSid, string to, string channel, string customMessage = null, ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomMessage = customMessage
            };

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

            return(FromJson(response.Content));
        }