ActiveLogin.Identity icon indicating copy to clipboard operation
ActiveLogin.Identity copied to clipboard

Unified api for PersonalIdentityNumber, CompanyRegistrationNumber, etc.

Open viktorvan opened this issue 6 years ago • 0 comments

When we have implemented more types of IdentityNumbers there will probably be a usecase for parsing an unknown number and get back the type that it is.

The returned type might be something like:

type IdentityNumber =
    | SwedishPersonalIdentityNumber of SwedishPersonalIdentityNumber
    | CompanyRegistrationNumber of CompanyRegistrationNumber
    | PersonalIdentityNumberOrCompanyRegistrationNumber of SwedishPersonalIdentityNumber * CompanyRegistrationNumber
    | SwedishCoordinationNumber of SwedishCoordinationNumber

and in C# we cannot be quite as helpful and would have to let the client check themselves what number types that were returned.

public class ParseResult
{
    public SwedishPersonalIdentityNumber SwedishPersonalIdentityNumber { get; }
    public CompanyRegistrationNumber CompanyRegistrationNumber { get; }
    public SwedishCoordinationNumber SwedishCoordinationNumber { get; }
}

viktorvan avatar Feb 19 '19 07:02 viktorvan