-
Notifications
You must be signed in to change notification settings - Fork 43
/
get.go
49 lines (42 loc) · 1.16 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
package keyword
import (
"encoding/json"
"strconv"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)
// GetRequest 获取关键词列表 API Request
type GetRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Filtering 过滤结构
Filtering *GetFiltering `json:"filtering,omitempty"`
}
// GetFiltering 过滤结构
type GetFiltering struct {
// AdID 待过滤的广告计划ID
AdID uint64 `json:"ad_id,omitempty"`
}
// Encode implement GetRequest interface
func (r GetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
if r.Filtering != nil {
filter, _ := json.Marshal(r.Filtering)
values.Set("filtering", string(filter))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
}
// GetResponse 获取关键词列表 API Response
type GetResponse struct {
model.BaseResponse
// Data json返回值
Data *GetResponseData `json:"data,omitempty"`
}
// GetResponseData json返回值
type GetResponseData struct {
// List 关键词列表
List []Keyword `json:"list,omitempty"`
}