1+ /// This code was generated by
2+ /// \ / _ _ _| _ _
3+ /// | (_)\/(_)(_|\/| |(/_ v1.0.0
4+ /// / /
5+ /// <summary>
6+ /// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you
7+ /// currently do not have developer preview access, please contact [email protected] . 8+ ///
9+ /// VerificationCheckResource
10+ /// </summary>
11+
12+ using Newtonsoft . Json ;
13+ using System ;
14+ using System . Collections . Generic ;
15+ using Twilio . Base ;
16+ using Twilio . Clients ;
17+ using Twilio . Converters ;
18+ using Twilio . Exceptions ;
19+ using Twilio . Http ;
20+ using Twilio . Types ;
21+
22+ namespace Twilio . Rest . Preview . AccSecurity . Service
23+ {
24+
25+ public class VerificationCheckResource : Resource
26+ {
27+ public sealed class ChannelEnum : StringEnum
28+ {
29+ private ChannelEnum ( string value ) : base ( value ) { }
30+ public ChannelEnum ( ) { }
31+
32+ public static readonly ChannelEnum Sms = new ChannelEnum ( "sms" ) ;
33+ public static readonly ChannelEnum Call = new ChannelEnum ( "call" ) ;
34+ }
35+
36+ private static Request BuildCreateRequest ( CreateVerificationCheckOptions options , ITwilioRestClient client )
37+ {
38+ return new Request (
39+ HttpMethod . Post ,
40+ Rest . Domain . Preview ,
41+ "/Verification/Services/" + options . PathServiceSid + "/VerificationCheck" ,
42+ client . Region ,
43+ postParams : options . GetParams ( )
44+ ) ;
45+ }
46+
47+ /// <summary>
48+ /// challenge a specific Verification Check.
49+ /// </summary>
50+ ///
51+ /// <param name="options"> Create VerificationCheck parameters </param>
52+ /// <param name="client"> Client to make requests to Twilio </param>
53+ /// <returns> A single instance of VerificationCheck </returns>
54+ public static VerificationCheckResource Create ( CreateVerificationCheckOptions options , ITwilioRestClient client = null )
55+ {
56+ client = client ?? TwilioClient . GetRestClient ( ) ;
57+ var response = client . Request ( BuildCreateRequest ( options , client ) ) ;
58+ return FromJson ( response . Content ) ;
59+ }
60+
61+ #if ! NET35
62+ /// <summary>
63+ /// challenge a specific Verification Check.
64+ /// </summary>
65+ ///
66+ /// <param name="options"> Create VerificationCheck parameters </param>
67+ /// <param name="client"> Client to make requests to Twilio </param>
68+ /// <returns> Task that resolves to A single instance of VerificationCheck </returns>
69+ public static async System . Threading . Tasks . Task < VerificationCheckResource > CreateAsync ( CreateVerificationCheckOptions options , ITwilioRestClient client = null )
70+ {
71+ client = client ?? TwilioClient . GetRestClient ( ) ;
72+ var response = await client . RequestAsync ( BuildCreateRequest ( options , client ) ) ;
73+ return FromJson ( response . Content ) ;
74+ }
75+ #endif
76+
77+ /// <summary>
78+ /// challenge a specific Verification Check.
79+ /// </summary>
80+ ///
81+ /// <param name="pathServiceSid"> The service_sid </param>
82+ /// <param name="code"> The verification string </param>
83+ /// <param name="to"> To phonenumber </param>
84+ /// <param name="client"> Client to make requests to Twilio </param>
85+ /// <returns> A single instance of VerificationCheck </returns>
86+ public static VerificationCheckResource Create ( string pathServiceSid , string code , string to = null , ITwilioRestClient client = null )
87+ {
88+ var options = new CreateVerificationCheckOptions ( pathServiceSid , code ) { To = to } ;
89+ return Create ( options , client ) ;
90+ }
91+
92+ #if ! NET35
93+ /// <summary>
94+ /// challenge a specific Verification Check.
95+ /// </summary>
96+ ///
97+ /// <param name="pathServiceSid"> The service_sid </param>
98+ /// <param name="code"> The verification string </param>
99+ /// <param name="to"> To phonenumber </param>
100+ /// <param name="client"> Client to make requests to Twilio </param>
101+ /// <returns> Task that resolves to A single instance of VerificationCheck </returns>
102+ public static async System . Threading . Tasks . Task < VerificationCheckResource > CreateAsync ( string pathServiceSid , string code , string to = null , ITwilioRestClient client = null )
103+ {
104+ var options = new CreateVerificationCheckOptions ( pathServiceSid , code ) { To = to } ;
105+ return await CreateAsync ( options , client ) ;
106+ }
107+ #endif
108+
109+ /// <summary>
110+ /// Converts a JSON string into a VerificationCheckResource object
111+ /// </summary>
112+ ///
113+ /// <param name="json"> Raw JSON string </param>
114+ /// <returns> VerificationCheckResource object represented by the provided JSON </returns>
115+ public static VerificationCheckResource FromJson ( string json )
116+ {
117+ // Convert all checked exceptions to Runtime
118+ try
119+ {
120+ return JsonConvert . DeserializeObject < VerificationCheckResource > ( json ) ;
121+ }
122+ catch ( JsonException e )
123+ {
124+ throw new ApiException ( e . Message , e ) ;
125+ }
126+ }
127+
128+ /// <summary>
129+ /// A string that uniquely identifies this Verification Check.
130+ /// </summary>
131+ [ JsonProperty ( "sid" ) ]
132+ public string Sid { get ; private set ; }
133+ /// <summary>
134+ /// Service Sid.
135+ /// </summary>
136+ [ JsonProperty ( "service_sid" ) ]
137+ public string ServiceSid { get ; private set ; }
138+ /// <summary>
139+ /// Account Sid.
140+ /// </summary>
141+ [ JsonProperty ( "account_sid" ) ]
142+ public string AccountSid { get ; private set ; }
143+ /// <summary>
144+ /// To phonenumber
145+ /// </summary>
146+ [ JsonProperty ( "to" ) ]
147+ public string To { get ; private set ; }
148+ /// <summary>
149+ /// sms or call
150+ /// </summary>
151+ [ JsonProperty ( "channel" ) ]
152+ [ JsonConverter ( typeof ( StringEnumConverter ) ) ]
153+ public VerificationCheckResource . ChannelEnum Channel { get ; private set ; }
154+ /// <summary>
155+ /// pending, approved, denied or expired
156+ /// </summary>
157+ [ JsonProperty ( "status" ) ]
158+ public string Status { get ; private set ; }
159+ /// <summary>
160+ /// successful verification
161+ /// </summary>
162+ [ JsonProperty ( "valid" ) ]
163+ public bool ? Valid { get ; private set ; }
164+ /// <summary>
165+ /// The date this Verification Check was created
166+ /// </summary>
167+ [ JsonProperty ( "date_created" ) ]
168+ public DateTime ? DateCreated { get ; private set ; }
169+ /// <summary>
170+ /// The date this Verification Check was updated
171+ /// </summary>
172+ [ JsonProperty ( "date_updated" ) ]
173+ public DateTime ? DateUpdated { get ; private set ; }
174+
175+ private VerificationCheckResource ( )
176+ {
177+
178+ }
179+ }
180+
181+ }
0 commit comments