2021-10-25 10:25:37 +00:00
|
|
|
package requests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
var ErrAddContactInvalidID = errors.New("add-contact: invalid id")
|
|
|
|
|
|
|
|
type AddContact struct {
|
2024-04-03 14:49:57 +00:00
|
|
|
ID string `json:"id"`
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
DisplayName string `json:"displayName"`
|
|
|
|
ENSName string `json:"ensName"`
|
|
|
|
CustomizationColor string `json:"customizationColor,omitempty"`
|
2021-10-25 10:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *AddContact) Validate() error {
|
|
|
|
if len(a.ID) == 0 {
|
|
|
|
return ErrAddContactInvalidID
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2022-10-14 08:50:36 +00:00
|
|
|
|
|
|
|
func (a *AddContact) HexID() (string, error) {
|
|
|
|
return ConvertCompressedToLegacyKey(a.ID)
|
|
|
|
}
|