Class AddressValidationResult
Result of an address validation call.
public record AddressValidationResult
- Inheritance
-
objectAddressValidationResult
Constructors
AddressValidationResult(bool, Address?, Address?, string?, string?)
Result of an address validation call.
public AddressValidationResult(bool IsValid, Address? NormalizedAddress = null, Address? SuggestedAddress = null, string? ErrorMessage = null, string? Reason = null)
Parameters
IsValidboolWhether the address passed validation.
NormalizedAddressAddressUSPS-normalized address when valid, if available.
SuggestedAddressAddressAn alternative address suggested by the validation service, if any.
ErrorMessagestringA user-facing error message if validation failed.
ReasonstringThe specific reason for the validation outcome (e.g., "blocked", "too_long", "abbreviated").
Properties
ErrorMessage
A user-facing error message if validation failed.
public string? ErrorMessage { get; init; }
Property Value
- string
IsValid
Whether the address passed validation.
public bool IsValid { get; init; }
Property Value
- bool
NormalizedAddress
USPS-normalized address when valid, if available.
public Address? NormalizedAddress { get; init; }
Property Value
Reason
The specific reason for the validation outcome (e.g., "blocked", "too_long", "abbreviated").
public string? Reason { get; init; }
Property Value
- string
SuggestedAddress
An alternative address suggested by the validation service, if any.
public Address? SuggestedAddress { get; init; }
Property Value
Methods
Invalid(string, string)
public static AddressValidationResult Invalid(string errorMessage, string reason)
Parameters
errorMessagestringreasonstring
Returns
Suggestion(Address, string)
public static AddressValidationResult Suggestion(Address suggested, string reason)
Parameters
suggestedAddressreasonstring
Returns
Valid(Address?)
public static AddressValidationResult Valid(Address? normalizedAddress = null)
Parameters
normalizedAddressAddress