-
Notifications
You must be signed in to change notification settings - Fork 0
/
LeadTag.go
47 lines (38 loc) · 1 KB
/
LeadTag.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package skylead
import (
"fmt"
"net/http"
"strings"
errortools "github.com/leapforce-libraries/go_errortools"
go_http "github.com/leapforce-libraries/go_http"
)
type LeadTag struct {
Id int64 `json:"id"`
TagId int64 `json:"tagId"`
LeadId int64 `json:"leadId"`
}
type GetLeadTagsConfig struct {
UserId int64
AccountId int64
LeadIds []string
}
func (service *Service) GetLeadTags(config *GetLeadTagsConfig) (*[]LeadTag, *errortools.Error) {
if config == nil {
return nil, errortools.ErrorMessage("config is nil")
}
result := struct {
Result struct {
Items []LeadTag `json:"items"`
} `json:"result"`
}{}
requestConfig := go_http.RequestConfig{
Method: http.MethodGet,
Url: service.url(fmt.Sprintf("users/%v/accounts/%v/leads/tags?leadIds=[%s]", config.UserId, config.AccountId, strings.Join(config.LeadIds, ","))),
ResponseModel: &result,
}
_, _, e := service.httpRequest(&requestConfig)
if e != nil {
return nil, e
}
return &result.Result.Items, nil
}