-
Notifications
You must be signed in to change notification settings - Fork 1
/
contact.go
33 lines (29 loc) · 984 Bytes
/
contact.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package gcloudcx
import "github.com/gildas/go-logger"
// Contact describes something that can be contacted
type Contact struct {
Type string `json:"type"` // PRIMARY, WORK, WORK2, WORK3, WORK4, HOME, MOBILE, MAIN
MediaType string `json:"mediaType"` // PHONE, EMAIL, SMS
Display string `json:"display,omitempty"`
Address string `json:"address,omitempty"` // If present, there is no Extension
Extension string `json:"extension,omitempty"` // If present, there is no Address
}
// String gets a string version
//
// implements the fmt.Stringer interface
func (contact Contact) String() string {
return contact.Display
}
// Redact redacts sensitive data
//
// implements logger.Redactable
func (contact Contact) Redact() interface{} {
redacted := contact
if len(contact.Display) > 0 {
redacted.Display = logger.RedactWithHash(contact.Display)
}
if len(contact.Address) > 0 {
redacted.Address = logger.RedactWithHash(contact.Address)
}
return redacted
}