28 lines
1.0 KiB
C#
28 lines
1.0 KiB
C#
namespace MxGateway.Server.Security.Authentication;
|
|
|
|
public sealed record ApiKeyAdminParseResult(
|
|
bool IsApiKeyCommand,
|
|
ApiKeyAdminCommand? Command,
|
|
string? Error)
|
|
{
|
|
/// <summary>Returns a result indicating the input was not an API key command.</summary>
|
|
public static ApiKeyAdminParseResult NotApiKeyCommand()
|
|
{
|
|
return new ApiKeyAdminParseResult(false, null, null);
|
|
}
|
|
|
|
/// <summary>Returns a successful parse result with the parsed API key command.</summary>
|
|
/// <param name="command">Parsed API key administration command.</param>
|
|
public static ApiKeyAdminParseResult Success(ApiKeyAdminCommand command)
|
|
{
|
|
return new ApiKeyAdminParseResult(true, command, null);
|
|
}
|
|
|
|
/// <summary>Returns a parse result with the specified error message.</summary>
|
|
/// <param name="error">Error message describing the parse failure.</param>
|
|
public static ApiKeyAdminParseResult Fail(string error)
|
|
{
|
|
return new ApiKeyAdminParseResult(true, null, error);
|
|
}
|
|
}
|