diff --git a/address_types.go b/address_types.go index cb46b5f..e34c4ab 100644 --- a/address_types.go +++ b/address_types.go @@ -1,5 +1,7 @@ package proton +import "fmt" + type Address struct { ID string Email string @@ -27,6 +29,14 @@ const ( AddressStatusDeleting ) +func (s AddressStatus) String() string { + statusStrings := [...]string{"disabled", "enabled", "deleting" } + if s < AddressStatusDisabled || s > AddressStatusDeleting { + return fmt.Sprintf("Unknown Status (%d)", s) + } + return statusStrings[s] +} + type AddressType int const ( @@ -42,3 +52,13 @@ const ( func (a Address) IsBYOEAddress() bool { return bool(a.Send) && a.Type == AddressTypeExternal } + +func (a AddressType) String() string { + typeStrings := [...]string{"original", "alias", "custom", "premium", "external" } + if a < AddressTypeOriginal || a > AddressTypeExternal { + return fmt.Sprintf("Unknown Status (%d)", a) + } + + // Proton API defines the start type as `iota + 1` + return typeStrings[a-1] +}