-
Notifications
You must be signed in to change notification settings - Fork 42
/
get.go
59 lines (52 loc) · 1.51 KB
/
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
package landinggroup
import (
"encoding/json"
"net/url"
"strconv"
"github.com/bububa/oceanengine/marketing-api/model"
)
// GetRequest 获取落地页组 API Request
type GetRequest struct {
// AdvertiserID 广告主id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Page 页数默认值: 1,page必须大于0
Page int `json:"page,omitempty"`
// PageSize 页面大小默认值:10,page_size范围为1-1000
PageSize int `json:"page_size,omitempty"`
// Filtering 过滤字段
Filtering *GetFiltering `json:"filtering,omitempty"`
}
// GetFiltering 过滤字段
type GetFiltering struct {
// GroupID 落地页组 ID
GroupID uint64 `json:"group_id,omitempty"`
}
// Encode implement GetRequest interface
func (r GetRequest) Encode() string {
values := &url.Values{}
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
if r.Filtering != nil {
filtering, _ := json.Marshal(r.Filtering)
values.Set("filtering", string(filtering))
}
if r.Page > 0 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
return values.Encode()
}
// GetResponse 获取第三方落地页站点列表 API Response
type GetResponse struct {
model.BaseResponse
// Data json返回值
Data *GetResponseData `json:"data,omitempty"`
}
// GetResponseData json返回值
type GetResponseData struct {
// List 落地页组信息
List []LandingGroup `json:"list,omitempty"`
// PageInfo 分页信息
PageInfo *model.PageInfo `json:"page_info,omitempty"`
}