Struct AccountKey
Represents a validated Vonage Account API key. The key must be exactly 8 alphanumeric characters.
public readonly struct AccountKey
- Inherited Members
Remarks
Use Parse(string) to create an instance with validation.
Validation rules: non-empty, exactly 8 characters, alphanumeric only.
Properties
ApiKey
Gets the account API key value.
public string ApiKey { get; }
Property Value
Methods
Parse(string)
Parses and validates a Vonage Account API key.
public static Result<AccountKey> Parse(string key)
Parameters
keystringThe API key to validate. Must be exactly 8 alphanumeric characters.
Returns
- Result<AccountKey>
A Result<T> containing the validated AccountKey on success, or an IResultFailure describing the validation error on failure.
Examples
// Parse a valid account key
var result = AccountKey.Parse("abc12345");
result.Match(
success => Console.WriteLine($"Valid key: {success.ApiKey}"),
failure => Console.WriteLine($"Invalid: {failure.GetFailureMessage()}")
);
ToString()
Returns the account ApiKey.
public override string ToString()
Returns
- string
The account ApiKey.