-
Notifications
You must be signed in to change notification settings - Fork 40
/
video_get.go
55 lines (49 loc) · 1.64 KB
/
video_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
package aweme
import (
"strconv"
"github.com/bububa/oceanengine/marketing-api/enum"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)
// VideoGetRequest 获取随心推可投视频列表 API Request
type VideoGetRequest struct {
// AdvertiserID 广告主id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// AwemeID 需要拉取视频的抖音号uid
AwemeID uint64 `json:"aweme_id,omitempty"`
// MarketingGoal 营销目标,可选值:
// LIVE_PROM_GOODS: 直播间带货
// VIDEO_PROM_GOODS: 短视频带货
MarketingGoal enum.MarketingGoal `json:"marketing_goal,omitempty"`
// Cursor 页码游标值,第一次拉取,无需入参
Cursor int `json:"cursor,omitempty"`
// Count 页面大小,限制1-20,默认值:10
Count int `json:"count,omitempty"`
}
// Encode implement GetRequest interface
func (r VideoGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("aweme_id", strconv.FormatUint(r.AwemeID, 10))
if r.MarketingGoal != "" {
values.Set("marketing_goal", string(r.MarketingGoal))
}
if r.Cursor > 0 {
values.Set("cursor", strconv.Itoa(r.Cursor))
}
if r.Count > 0 {
values.Set("count", strconv.Itoa(r.Count))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
}
// VideoGetResponse 获取随心推可投视频列表 API Response
type VideoGetResponse struct {
model.BaseResponse
Data *VideoGetResult `json:"data,omitempty"`
}
type VideoGetResult struct {
PageInfo *model.PageInfo `json:"page_info,omitempty"`
VideoList []Video `json:"video_list,omitempty"`
}