-
Notifications
You must be signed in to change notification settings - Fork 43
/
track_url_get.go
66 lines (60 loc) · 2.02 KB
/
track_url_get.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package eventmanager
import (
"strconv"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)
// TrackURLGetRequest 获取事件资产下的监测链接组 API Request
type TrackURLGetRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// AssetsID 资产ID
AssetsID uint64 `json:"assets_id,omitempty"`
// DownloadURL 应用下载链接,应用下载链接,IOS和安卓应用资产:必填
DownloadURL string `json:"download_url,omitempty"`
// TrackURLGroupName 监测链接组名称
TrackURLGroupName string `json:"track_url_group_name,omitempty"`
// TrackURLGroupID 监测链接组ID
TrackURLGroupID uint64 `json:"track_url_group_id,omitempty"`
// Page 页码
Page int `json:"page,omitempty"`
// PageSize 分页个数
PageSize int `json:"page_size,omitempty"`
}
// Encode implement GetRequest interface
func (r TrackURLGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("assets_id", strconv.FormatUint(r.AssetsID, 10))
if r.DownloadURL != "" {
values.Set("download_url", r.DownloadURL)
}
if r.TrackURLGroupName != "" {
values.Set("track_url_group_name", r.TrackURLGroupName)
}
if r.TrackURLGroupID > 0 {
values.Set("track_url_group_id", strconv.FormatUint(r.TrackURLGroupID, 10))
}
if r.Page > 1 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
}
// TrackURLGetResponse 获取事件资产下的监测链接组 API Response
type TrackURLGetResponse struct {
model.BaseResponse
// Data 返回数据
Data *TrackURLGetData `json:"data,omitempty"`
}
// TrackURLGetData 返回数据
type TrackURLGetData struct {
// PageInfo 分页信息
PageInfo *model.PageInfo `json:"page_info,omitempty"`
// TrackURLGroups 监测链接组信息
TrackURLGroups []TrackURLGroup `json:"track_url_groups,omitempty"`
}