-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from team-telnyx/feature/add2fa
Feature/add2fa
- Loading branch information
Showing
30 changed files
with
787 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Telnyx.net.Services.VerifyAPI; | ||
|
||
namespace Telnyx.Example | ||
{ | ||
[ExcludeFromCodeCoverage] | ||
public class VerificationExample | ||
{ | ||
private VerificationService verifyService = new VerificationService(); | ||
|
||
public async Task RunVerification() | ||
{ | ||
VerifyProfileOptions profileOptions = new VerifyProfileOptions | ||
{ | ||
DefaultTimeoutSecs = 300, | ||
MessagingEnabled = true, | ||
MessagingTemplate = "Hello this is a test {code}", | ||
Name = "Test Profile", | ||
RcsEnabled = false | ||
}; | ||
Console.WriteLine($"Creating profile: {profileOptions.Name}"); | ||
var profile = await verifyService.CreateVerificationProfileAsync(profileOptions); | ||
Console.WriteLine($"Profile Created. Id: {profile.Id.Value}"); | ||
VerifyOptions verifyOptions = new VerifyOptions | ||
{ | ||
TimeoutSecs = 300, | ||
PhoneNumber = "+13100000010", | ||
VerifyProfileId = profile.Id.Value, | ||
Type = "sms", | ||
}; | ||
Console.WriteLine($"Creating verification"); | ||
var verification = await verifyService.CreateVerificationAsync(verifyOptions); | ||
Console.WriteLine($"Verification created successfully: {verification.Id} with status {verification.Status}"); | ||
|
||
Console.WriteLine($"Checking verification status current status: {verification.Status}"); | ||
var getStatus = await verifyService.GetVerificationAsync(verification.Id.ToString()); | ||
Console.WriteLine($"Verification retrieved previous status: {verification.Status}, current status: {getStatus.Status}"); | ||
|
||
|
||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Telnyx.net.Infrastructure.JsonConverters; | ||
|
||
namespace Telnyx.net.Entities.Enum | ||
{ | ||
[JsonConverter(typeof(SafeStringEnumConverter), Unknown)] | ||
public enum VerifyStatus | ||
{ | ||
Unknown = -1, | ||
[EnumMember(Value = "pending")] | ||
Pending = 0, | ||
[EnumMember(Value = "sms_delivery_failed")] | ||
SmsDeliveryFailed = 1, | ||
[EnumMember(Value = "accepted")] | ||
Accepted = 2, | ||
[EnumMember(Value = "expired")] | ||
Expired = 3, | ||
[EnumMember(Value = "not_enough_credit")] | ||
NotEnoughCredit = 4, | ||
[EnumMember(Value = "network_error")] | ||
NetworkError = 5, | ||
[EnumMember(Value = "number_unreachable")] | ||
NumberUnreachable = 6, | ||
[EnumMember(Value = "internal_error")] | ||
InternalError = 7, | ||
[EnumMember(Value = "invalid_destination")] | ||
InvalidDestination = 8, | ||
[EnumMember(Value = "timed_out")] | ||
TimedOut = 9 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Telnyx.net.Entities.Enum; | ||
|
||
namespace Telnyx.net.Entities.VerifyAPI | ||
{ | ||
public class Verify : VerifyBase | ||
{ | ||
[JsonProperty("created_at")] | ||
public DateTimeOffset? CreatedAt { get; set; } | ||
|
||
[JsonProperty("id")] | ||
public Guid Id { get; set; } | ||
|
||
[JsonProperty("organization_id")] | ||
public string OrganizationId { get; set; } | ||
|
||
/// <summary> | ||
/// Identifies the type of the resource. | ||
/// </summary> | ||
[JsonProperty("record_type")] | ||
public RecordType? RecordType { get; set; } | ||
/// <summary> | ||
/// The possible statuses of the verify verification request. | ||
/// </summary> | ||
[JsonProperty("status")] | ||
public VerifyStatus Status { get; set; } | ||
/// <summary> | ||
/// This is the number of seconds before the code of the request is expired. Once this request has expired, the code will no longer verify the user. | ||
/// <para>Note: this will override the `default_timeout_secs` on the verify profile</para> | ||
/// </summary> | ||
[JsonProperty("timeout_secs")] | ||
public long TimeoutSecs { get; set; } | ||
/// <summary> | ||
/// The identifier of the associated verify profile. | ||
/// </summary> | ||
[JsonProperty("verify_profile_id")] | ||
public Guid VerifyProfileId { get; set; } | ||
/// <summary> | ||
/// The verification request type | ||
/// </summary> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonProperty("updated_at")] | ||
public DateTimeOffset? UpdatedAt { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Telnyx.net.Entities.VerifyAPI | ||
{ | ||
public class VerifyBase : TelnyxEntity | ||
{ | ||
/// <summary> | ||
/// +E164 formatted phone number. | ||
/// </summary> | ||
[JsonProperty("phone_number")] | ||
public string PhoneNumber { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Telnyx.net.Entities.Enum; | ||
|
||
namespace Telnyx.net.Entities.VerifyAPI | ||
{ | ||
public class VerifyCode : VerifyBase | ||
{ | ||
/// <summary> | ||
/// Identifies if the verification code has been accepted or rejected. | ||
/// <para>Options: ["accepted","rejected"]</para> | ||
/// </summary> | ||
[JsonProperty("response_code")] | ||
public string ResponseCode { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Telnyx.net.Entities.Enum; | ||
|
||
namespace Telnyx.net.Entities.VerifyAPI | ||
{ | ||
public class VerifyProfile : TelnyxEntity | ||
{ | ||
[JsonProperty("created_at")] | ||
public DateTimeOffset? CreatedAt { get; set; } | ||
/// <summary> | ||
/// For every request that is initiated via this verify Profile, this sets the number of seconds before a verification request code expires. Once the verification request expires, the user cannot use the code to verify their identity. | ||
/// </summary> | ||
[JsonProperty("default_timeout_secs")] | ||
public long DefaultTimeoutSecs { get; set; } | ||
|
||
[JsonProperty("id")] | ||
public Guid? Id { get; set; } | ||
/// <summary> | ||
/// Enables SMS text messaging for the verify profile. | ||
/// </summary> | ||
[JsonProperty("messaging_enabled")] | ||
public bool MessagingEnabled { get; set; } | ||
/// <summary> | ||
/// Optionally sets a messaging text template when sending the verification code. Uses `{code}` to template in the actual verification code. | ||
/// </summary> | ||
[JsonProperty("messaging_template")] | ||
public string MessagingTemplate { get; set; } | ||
/// <summary> | ||
/// The name of the verify profile. | ||
/// </summary> | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("organization_id")] | ||
public string OrganizationId { get; set; } | ||
/// <summary> | ||
/// Enables RCS messaging for the verify profile. | ||
/// </summary> | ||
[JsonProperty("rcs_enabled")] | ||
public bool RcsEnabled { get; set; } | ||
|
||
[JsonProperty("record_type")] | ||
public RecordType? RecordType { get; set; } | ||
|
||
[JsonProperty("updated_at")] | ||
public DateTimeOffset? UpdatedAt { get; set; } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.