Documentation
¶
Index ¶
- Variables
- type Contact
- func (c *Contact) AddCozyURL(db prefixer.Prefixer, cozyURL string) error
- func (c *Contact) ChangeCozyURL(db prefixer.Prefixer, cozyURL string) error
- func (c *Contact) DocType() string
- func (c *Contact) PrimaryCozyURL() string
- func (c *Contact) PrimaryName() string
- func (c *Contact) PrimaryPhoneNumber() string
- func (c *Contact) ToMailAddress() (*mail.Address, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoMailAddress is returned when trying to access the email address of // a contact that has no known email address. ErrNoMailAddress = errors.New("The contact has no email address") // ErrNotFound is returned when no contact has been found for a query ErrNotFound = errors.New("No contact has been found") )
Functions ¶
This section is empty.
Types ¶
type Contact ¶
Contact is a struct containing all the informations about a contact. We are using maps/slices/interfaces instead of structs, as it is a doctype that can also be used in front applications and they can add new fields. It would be complicated to maintain a up-to-date mapping, and failing to do so means that we can lose some data on JSON round-trip.
func CreateMyself ¶
CreateMyself creates the myself contact document from the instance settings.
func FindByEmail ¶
FindByEmail returns the contact with the given email address, when possible
func (*Contact) AddCozyURL ¶
AddCozyURL adds a cozy URL to this contact (unless the contact has already this cozy URL) and saves the contact.
func (*Contact) ChangeCozyURL ¶
ChangeCozyURL is used when a contact has moved their Cozy to a new URL.
func (*Contact) PrimaryCozyURL ¶
PrimaryCozyURL returns the URL of the primary cozy, or a blank string if the contact has no known cozy.
func (*Contact) PrimaryName ¶
PrimaryName returns the name of the contact
func (*Contact) PrimaryPhoneNumber ¶
PrimaryPhoneNumber returns the preferred phone number, or a blank string if the contact has no known phone number.