github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/model/bitwarden/contact.go (about) 1 package bitwarden 2 3 import ( 4 "github.com/cozy/cozy-stack/pkg/consts" 5 "github.com/cozy/cozy-stack/pkg/couchdb" 6 "github.com/cozy/cozy-stack/pkg/metadata" 7 ) 8 9 // Contact is used to add users to an organization. 10 type Contact struct { 11 UserID string `json:"_id,omitempty"` 12 CouchRev string `json:"_rev,omitempty"` 13 Email string `json:"email"` 14 PublicKey string `json:"public_key"` 15 Confirmed bool `json:"confirmed,omitempty"` 16 Metadata metadata.CozyMetadata `json:"cozyMetadata"` 17 } 18 19 // ID returns the contact identifier 20 func (c *Contact) ID() string { return c.UserID } 21 22 // Rev returns the contact revision 23 func (c *Contact) Rev() string { return c.CouchRev } 24 25 // SetID changes the contact identifier 26 func (c *Contact) SetID(id string) { c.UserID = id } 27 28 // SetRev changes the contact revision 29 func (c *Contact) SetRev(rev string) { c.CouchRev = rev } 30 31 // DocType returns the contact document type 32 func (c *Contact) DocType() string { return consts.BitwardenContacts } 33 34 // Clone implements couchdb.Doc 35 func (c *Contact) Clone() couchdb.Doc { 36 cloned := *c 37 return &cloned 38 } 39 40 var _ couchdb.Doc = &Contact{}