-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateTokenRequest.cs
More file actions
29 lines (22 loc) · 900 Bytes
/
Copy pathGenerateTokenRequest.cs
File metadata and controls
29 lines (22 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Text.Json.Serialization;
namespace Termii;
public sealed class GenerateTokenRequest
{
[JsonIgnore]
public TermiiTokenPinType PinType { get; set; } = TermiiTokenPinType.Numeric;
[JsonPropertyName("phone_number")]
public string PhoneNumber { get; set; } = string.Empty;
[JsonPropertyName("pin_attempts")]
public int PinAttempts { get; set; }
[JsonPropertyName("pin_time_to_live")]
public int PinTimeToLive { get; set; }
[JsonPropertyName("pin_length")]
public int PinLength { get; set; }
internal void Validate()
{
TermiiRequestValidation.Required(PhoneNumber, nameof(PhoneNumber));
TermiiRequestValidation.Positive(PinAttempts, nameof(PinAttempts));
TermiiRequestValidation.Range(PinTimeToLive, 0, 60, nameof(PinTimeToLive));
TermiiRequestValidation.Range(PinLength, 4, 8, nameof(PinLength));
}
}