Пример #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));
        }
Пример #2
0
 private static Request BuildCreateRequest(CreateVerificationOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Verify,
                "/v1/Services/" + options.PathServiceSid + "/Verifications",
                client.Region,
                postParams: options.GetParams()
                ));
 }
        /// <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="sendDigits"> Digits to send when a phone call is started </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,
                                                  ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomMessage = customMessage, SendDigits = sendDigits
            };

            return(Create(options, client));
        }
        /// <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="sendDigits"> Digits to send when a phone call is started </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,
                                                                                           ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                CustomMessage = customMessage, SendDigits = sendDigits
            };

            return(await CreateAsync(options, client));
        }
        /// <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="sendDigits"> Digits to send when a phone call is started </param>
        /// <param name="locale"> Locale used in the sms or call. </param>
        /// <param name="customCode"> A pre-generated code </param>
        /// <param name="amount"> Amount of the associated PSD2 compliant transaction. </param>
        /// <param name="payee"> 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 sendDigits        = null,
                                                                                           string locale            = null,
                                                                                           string customCode        = null,
                                                                                           string amount            = null,
                                                                                           string payee             = null,
                                                                                           ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                SendDigits = sendDigits, Locale = locale, CustomCode = customCode, Amount = amount, Payee = payee
            };

            return(await CreateAsync(options, client));
        }
        /// <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="sendDigits"> Digits to send when a phone call is started </param>
        /// <param name="locale"> Locale used in the sms or call. </param>
        /// <param name="customCode"> A pre-generated code </param>
        /// <param name="amount"> Amount of the associated PSD2 compliant transaction. </param>
        /// <param name="payee"> Payee of the associated PSD2 compliant transaction. </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 sendDigits        = null,
                                                  string locale            = null,
                                                  string customCode        = null,
                                                  string amount            = null,
                                                  string payee             = null,
                                                  ITwilioRestClient client = null)
        {
            var options = new CreateVerificationOptions(pathServiceSid, to, channel)
            {
                SendDigits = sendDigits, Locale = locale, CustomCode = customCode, Amount = amount, Payee = payee
            };

            return(Create(options, client));
        }
Пример #7
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));
        }