feat: leads: added GetMain().
This commit is contained in:
parent
df24215dcb
commit
7583137585
1 changed files with 13 additions and 2 deletions
|
@ -64,16 +64,27 @@ type Companies struct {
|
|||
Links Links `json:"_links"`
|
||||
}
|
||||
|
||||
type Contacts struct {
|
||||
|
||||
type Contact struct {
|
||||
ID int `json:"id"`
|
||||
IsMain bool `json:"is_main"`
|
||||
Links Links `json:"_links"`
|
||||
}
|
||||
type Contacts []Contact
|
||||
|
||||
func (cs Contacts) GetMain() (Contact, bool) {
|
||||
for _, contact := range cs {
|
||||
if contact.IsMain {
|
||||
return contact, true
|
||||
}
|
||||
}
|
||||
return Contact{}, false
|
||||
}
|
||||
|
||||
type Embedded struct {
|
||||
Tags []*Tags `json:"tags"`
|
||||
CatalogElements []*CatalogElements `json:"catalog_elements"`
|
||||
LossReason []*LossReason `json:"loss_reason"`
|
||||
Companies []*Companies `json:"companies"`
|
||||
Contacts []*Contacts `json:"contacts"`
|
||||
Contacts Contacts `json:"contacts"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue