feat: added the GetValuesByID for CustomFieldsValues.
This commit is contained in:
parent
09d95941ff
commit
ab6d5fb118
4 changed files with 42 additions and 28 deletions
|
@ -1,7 +1,7 @@
|
||||||
package common
|
package common
|
||||||
|
|
||||||
type Values struct {
|
type Values struct {
|
||||||
Value interface{} `json:"value,omitempty"`
|
Value any `json:"value,omitempty"`
|
||||||
EnumID int `json:"enum_id,omitempty"`
|
EnumID int `json:"enum_id,omitempty"`
|
||||||
Enum string `json:"enum,omitempty"`
|
Enum string `json:"enum,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -12,3 +12,17 @@ type CustomFieldsValue struct {
|
||||||
FieldType string `json:"field_type,omitempty"`
|
FieldType string `json:"field_type,omitempty"`
|
||||||
Values []Values `json:"values"`
|
Values []Values `json:"values"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CustomFieldsValues []CustomFieldsValue
|
||||||
|
|
||||||
|
func (vs CustomFieldsValues) GetValuesByID(
|
||||||
|
id int,
|
||||||
|
) ([]Values, bool) {
|
||||||
|
for _, v := range vs {
|
||||||
|
if v.FieldID == id {
|
||||||
|
return v.Values, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ type Company struct {
|
||||||
CreatedAt int `json:"created_at,omitempty"`
|
CreatedAt int `json:"created_at,omitempty"`
|
||||||
UpdatedAt int `json:"updated_at,omitempty"`
|
UpdatedAt int `json:"updated_at,omitempty"`
|
||||||
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
||||||
CustomFieldsValues []common.CustomFieldsValue `json:"custom_fields_values,omitempty"`
|
CustomFieldsValues common.CustomFieldsValues `json:"custom_fields_values,omitempty"`
|
||||||
AccountID int `json:"account_id,omitempty"`
|
AccountID int `json:"account_id,omitempty"`
|
||||||
Links Links `json:"_links,omitempty"`
|
Links Links `json:"_links,omitempty"`
|
||||||
Embedded Embedded `json:"_embedded,omitempty"`
|
Embedded Embedded `json:"_embedded,omitempty"`
|
||||||
|
|
|
@ -14,7 +14,7 @@ type Contact struct {
|
||||||
CreatedAt int `json:"created_at,omitempty"`
|
CreatedAt int `json:"created_at,omitempty"`
|
||||||
UpdatedAt int `json:"updated_at,omitempty"`
|
UpdatedAt int `json:"updated_at,omitempty"`
|
||||||
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
||||||
CustomFieldsValues []common.CustomFieldsValue `json:"custom_fields_values,omitempty"`
|
CustomFieldsValues common.CustomFieldsValues `json:"custom_fields_values,omitempty"`
|
||||||
AccountId int `json:"account_id,omitempty"`
|
AccountId int `json:"account_id,omitempty"`
|
||||||
Links Links `json:"_links,omitempty"`
|
Links Links `json:"_links,omitempty"`
|
||||||
Embedded Embedded `json:"_embedded,omitempty"`
|
Embedded Embedded `json:"_embedded,omitempty"`
|
||||||
|
|
|
@ -19,7 +19,7 @@ type Lead struct {
|
||||||
ClosedAt int `json:"closed_at,omitempty"`
|
ClosedAt int `json:"closed_at,omitempty"`
|
||||||
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
ClosestTaskAt interface{} `json:"closest_task_at,omitempty"`
|
||||||
IsDeleted bool `json:"is_deleted,omitempty"`
|
IsDeleted bool `json:"is_deleted,omitempty"`
|
||||||
CustomFieldsValues []common.CustomFieldsValue `json:"custom_fields_values,omitempty"`
|
CustomFieldsValues common.CustomFieldsValues `json:"custom_fields_values,omitempty"`
|
||||||
Score interface{} `json:"score,omitempty"`
|
Score interface{} `json:"score,omitempty"`
|
||||||
AccountID int `json:"account_id,omitempty"`
|
AccountID int `json:"account_id,omitempty"`
|
||||||
IsPriceModifiedByRobot bool `json:"is_price_modified_by_robot,omitempty"`
|
IsPriceModifiedByRobot bool `json:"is_price_modified_by_robot,omitempty"`
|
||||||
|
|
Loading…
Reference in a new issue