Skip to content

Commit a08e188

Browse files
committed
Commit for librarian generation of 5.7.1
1 parent 2506e41 commit a08e188

File tree

9 files changed

+1412
-0
lines changed

9 files changed

+1412
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/// This code was generated by
2+
/// \ / _ _ _| _ _
3+
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
4+
/// / /
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using Twilio.Base;
9+
using Twilio.Converters;
10+
11+
namespace Twilio.Rest.Preview.AccSecurity.Service
12+
{
13+
14+
/// <summary>
15+
/// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you
16+
/// currently do not have developer preview access, please contact [email protected].
17+
///
18+
/// challenge a specific Verification Check.
19+
/// </summary>
20+
public class CreateVerificationCheckOptions : IOptions<VerificationCheckResource>
21+
{
22+
/// <summary>
23+
/// The service_sid
24+
/// </summary>
25+
public string PathServiceSid { get; }
26+
/// <summary>
27+
/// The verification string
28+
/// </summary>
29+
public string Code { get; }
30+
/// <summary>
31+
/// To phonenumber
32+
/// </summary>
33+
public string To { get; set; }
34+
35+
/// <summary>
36+
/// Construct a new CreateVerificationCheckOptions
37+
/// </summary>
38+
///
39+
/// <param name="pathServiceSid"> The service_sid </param>
40+
/// <param name="code"> The verification string </param>
41+
public CreateVerificationCheckOptions(string pathServiceSid, string code)
42+
{
43+
PathServiceSid = pathServiceSid;
44+
Code = code;
45+
}
46+
47+
/// <summary>
48+
/// Generate the necessary parameters
49+
/// </summary>
50+
public List<KeyValuePair<string, string>> GetParams()
51+
{
52+
var p = new List<KeyValuePair<string, string>>();
53+
if (Code != null)
54+
{
55+
p.Add(new KeyValuePair<string, string>("Code", Code));
56+
}
57+
58+
if (To != null)
59+
{
60+
p.Add(new KeyValuePair<string, string>("To", To));
61+
}
62+
63+
return p;
64+
}
65+
}
66+
67+
}
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
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+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/// This code was generated by
2+
/// \ / _ _ _| _ _
3+
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
4+
/// / /
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using Twilio.Base;
9+
using Twilio.Converters;
10+
11+
namespace Twilio.Rest.Preview.AccSecurity.Service
12+
{
13+
14+
/// <summary>
15+
/// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you
16+
/// currently do not have developer preview access, please contact [email protected].
17+
///
18+
/// Create a new Verification for a To number using a Service
19+
/// </summary>
20+
public class CreateVerificationOptions : IOptions<VerificationResource>
21+
{
22+
/// <summary>
23+
/// Service Sid.
24+
/// </summary>
25+
public string PathServiceSid { get; }
26+
/// <summary>
27+
/// To phonenumber
28+
/// </summary>
29+
public string To { get; }
30+
/// <summary>
31+
/// sms or call
32+
/// </summary>
33+
public string Channel { get; }
34+
/// <summary>
35+
/// A custom message for this verification
36+
/// </summary>
37+
public string CustomMessage { get; set; }
38+
39+
/// <summary>
40+
/// Construct a new CreateVerificationOptions
41+
/// </summary>
42+
///
43+
/// <param name="pathServiceSid"> Service Sid. </param>
44+
/// <param name="to"> To phonenumber </param>
45+
/// <param name="channel"> sms or call </param>
46+
public CreateVerificationOptions(string pathServiceSid, string to, string channel)
47+
{
48+
PathServiceSid = pathServiceSid;
49+
To = to;
50+
Channel = channel;
51+
}
52+
53+
/// <summary>
54+
/// Generate the necessary parameters
55+
/// </summary>
56+
public List<KeyValuePair<string, string>> GetParams()
57+
{
58+
var p = new List<KeyValuePair<string, string>>();
59+
if (To != null)
60+
{
61+
p.Add(new KeyValuePair<string, string>("To", To));
62+
}
63+
64+
if (Channel != null)
65+
{
66+
p.Add(new KeyValuePair<string, string>("Channel", Channel));
67+
}
68+
69+
if (CustomMessage != null)
70+
{
71+
p.Add(new KeyValuePair<string, string>("CustomMessage", CustomMessage));
72+
}
73+
74+
return p;
75+
}
76+
}
77+
78+
}

0 commit comments

Comments
 (0)