/// <summary>
        /// Create a new Verification 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));
        }
 private static Request BuildCreateRequest(CreateVerificationOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/Verifications",
                postParams: options.GetParams()
                ));
 }
Esempio n. 3
0
        /// <summary>
        /// Create a new Verification for a To number using a Service
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the verification Service to create the resource under </param>
        /// <param name="to"> The phone number to verify </param>
        /// <param name="channel"> The verification method to use </param>
        /// <param name="customMessage"> The text of a custom message to use for the verification </param>
        /// <param name="sendDigits"> The digits to send after a phone call is answered </param>
        /// <param name="locale"> The locale to use for the verification SMS or call </param>
        /// <param name="customCode"> A pre-generated code </param>
        /// <param name="amount"> The amount of the associated PSD2 compliant transaction. </param>
        /// <param name="payee"> The payee of the associated PSD2 compliant transaction </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,
                                                                                           string sendDigits        = null,
                                                                                           string locale            = null,
                                                                                           string customCode        = null,
                                                                                           string amount            = null,
                                                                                           string payee             = null,
                                                                                           ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomMessage = customMessage, SendDigits = sendDigits, Locale = locale, CustomCode = customCode, Amount = amount, Payee = payee
            };

            return(await CreateAsync(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new Verification for a To number using a Service
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the verification Service to create the resource under </param>
        /// <param name="to"> The phone number to verify </param>
        /// <param name="channel"> The verification method to use </param>
        /// <param name="customMessage"> The text of a custom message to use for the verification </param>
        /// <param name="sendDigits"> The digits to send after a phone call is answered </param>
        /// <param name="locale"> The locale to use for the verification SMS or call </param>
        /// <param name="customCode"> A pre-generated code </param>
        /// <param name="amount"> The amount of the associated PSD2 compliant transaction. </param>
        /// <param name="payee"> The payee of the associated PSD2 compliant transaction </param>
        /// <param name="rateLimits"> The custom key-value pairs of Programmable Rate Limits. </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,
                                                  string sendDigits        = null,
                                                  string locale            = null,
                                                  string customCode        = null,
                                                  string amount            = null,
                                                  string payee             = null,
                                                  object rateLimits        = null,
                                                  ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomMessage = customMessage, SendDigits = sendDigits, Locale = locale, CustomCode = customCode, Amount = amount, Payee = payee, RateLimits = rateLimits
            };

            return(Create(options, client));
        }
        /// <summary>
        /// Create a new Verification using a Service
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the verification Service to create the resource under </param>
        /// <param name="to"> The phone number or email to verify </param>
        /// <param name="channel"> The verification method to use </param>
        /// <param name="customFriendlyName"> A custom user defined friendly name </param>
        /// <param name="customMessage"> The text of a custom message to use for the verification </param>
        /// <param name="sendDigits"> The digits to send after a phone call is answered </param>
        /// <param name="locale"> The locale to use for the verification SMS or call </param>
        /// <param name="customCode"> A pre-generated code </param>
        /// <param name="amount"> The amount of the associated PSD2 compliant transaction. </param>
        /// <param name="payee"> The payee of the associated PSD2 compliant transaction </param>
        /// <param name="rateLimits"> The custom key-value pairs of Programmable Rate Limits. </param>
        /// <param name="channelConfiguration"> Channel specific configuration in json format. </param>
        /// <param name="appHash"> Your App Hash to be appended at the end of an SMS. </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 customFriendlyName = null,
                                                                                           string customMessage      = null,
                                                                                           string sendDigits         = null,
                                                                                           string locale             = null,
                                                                                           string customCode         = null,
                                                                                           string amount             = null,
                                                                                           string payee                = null,
                                                                                           object rateLimits           = null,
                                                                                           object channelConfiguration = null,
                                                                                           string appHash              = null,
                                                                                           ITwilioRestClient client    = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomFriendlyName = customFriendlyName, CustomMessage = customMessage, SendDigits = sendDigits, Locale = locale, CustomCode = customCode, Amount = amount, Payee = payee, RateLimits = rateLimits, ChannelConfiguration = channelConfiguration, AppHash = appHash
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// Create a new Verification 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));
        }