mirror of
https://github.com/alexhopeoconnor/binarylane-dotnet.git
synced 2026-10-22 11:47:49 +10:00
Initial BinaryLane v2 API client
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace BinaryLane.Api.V2.Configuration;
|
||||
|
||||
/// <summary>Validates client options at application startup.</summary>
|
||||
public sealed class BinaryLaneOptionsValidator : IValidateOptions<BinaryLaneOptions>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ValidateOptionsResult Validate(string? name, BinaryLaneOptions options)
|
||||
{
|
||||
if (options is null)
|
||||
{
|
||||
return ValidateOptionsResult.Fail("BinaryLane options are required.");
|
||||
}
|
||||
|
||||
if (!BinaryLaneOptions.IsValid(options))
|
||||
{
|
||||
return ValidateOptionsResult.Fail(
|
||||
"BinaryLane BaseUrl must be an absolute HTTPS URL and RequestTimeoutSeconds must be between 1 and 300.");
|
||||
}
|
||||
|
||||
return ValidateOptionsResult.Success;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user