Skip to content

Commit

Permalink
Merge branch 'v1.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Jul 28, 2022
2 parents cfa9690 + 434e0a3 commit dbbb344
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 11 deletions.
2 changes: 2 additions & 0 deletions marketing-api/api/qianchuan/file/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package file 素材管理相关API
package file
19 changes: 19 additions & 0 deletions marketing-api/api/qianchuan/file/video_aweme_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package file

import (
"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/file"
)

// VideoAwemeGet 获取抖音号下的视频
// 获取抖音号下已有的视频素材,支持传入商品id,过滤拉取包含待推广商品的视频
// 1、仅自定义创意支持选择抖音号视频,程序化创意不支持
// 2、短视频带货场景下,仅支持选择抖音号下已关联相应推广商品的视频
// 3、由于素材库存在分钟级延迟,上传素材后请勿立即获取并创建计划
func VideoAwemeGet(clt *core.SDKClient, accessToken string, req *file.VideoAwemeGetRequest) (*file.VideoAwemeGetResponseData, error) {
var resp file.VideoAwemeGetResponse
if err := clt.Get("v1.0/qianchuan/file/video/aweme/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
2 changes: 1 addition & 1 deletion marketing-api/model/creative/creative.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ type Creative struct {
// CreativeCreateTime 广告创意创建时间,格式yyyy-MM-dd HH:mm:ss
CreativeCreateTime string `json:"creative_create_time,omitempty"`
// CreativeModifyTime 广告创意更新时间,格式yyyy-MM-dd HH:mm:ss
CreativeModifyTime string `json:"creative_modity_time,omitempty"`
CreativeModifyTime string `json:"creative_modify_time,omitempty"`
}
20 changes: 10 additions & 10 deletions marketing-api/model/file/video_aweme_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ type VideoAwemeGetRequest struct {
AwemeID uint64 `json:"aweme_id,omitempty"`
// Filtering 视频过滤条件
Filtering *VideoAwemeGetFiltering `json:"filtering,omitempty"`
// Cursor 页码游标值,第一次拉取,无需入参
Cursor int `json:"cursor,omitempty"`
// Count 页面大小,默认值30,限制1-50
Count int `json:"count,omitempty"`
// Page 页码,默认值:1
Page int `json:"page,omitempty"`
// PageSize 页面大小, 默认值:10,取值范围1-100
PageSize int `json:"page_size,omitempty"`
}

// VideoAwemeGetFiltering 筛选条件
type VideoAwemeGetFiltering struct {
//ProductID 商品ID,查询关联商品的相应视频,仅短视频带货场景需入参
ProductID uint64 `json:"product_id,omitempty"`
// AwemeURL 抖音视频链接,可在抖音端上通过【分享】-【复制链接】获取
AwemeURL string `json:"aweme_url,omitempty"`
}

// Encode implement GetRequest interface
Expand All @@ -37,11 +37,11 @@ func (r VideoAwemeGetRequest) Encode() string {
filter, _ := json.Marshal(r.Filtering)
values.Set("filtering", string(filter))
}
if r.Cursor > 0 {
values.Set("cursor", strconv.Itoa(r.Cursor))
if r.Page > 1 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.Count > 0 {
values.Set("count", strconv.Itoa(r.Count))
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
return values.Encode()
}
Expand Down
2 changes: 2 additions & 0 deletions marketing-api/model/qianchuan/file/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package file 素材管理API models
package file
62 changes: 62 additions & 0 deletions marketing-api/model/qianchuan/file/video_aweme_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package file

import (
"encoding/json"
"net/url"
"strconv"

"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/model/file"
)

// VideoAwemeGetRequest 获取抖音号下的视频 API Request
type VideoAwemeGetRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// AwemeID 需拉取视频的抖音号
AwemeID uint64 `json:"aweme_id,omitempty"`
// Filtering 视频过滤条件
Filtering *VideoAwemeGetFiltering `json:"filtering,omitempty"`
// Cursor 页码游标值,第一次拉取,无需入参
Cursor int `json:"cursor,omitempty"`
// Count 页面大小,默认值30,限制1-50
Count int `json:"count,omitempty"`
}

// VideoAwemeGetFiltering 筛选条件
type VideoAwemeGetFiltering struct {
//ProductID 商品ID,查询关联商品的相应视频,仅短视频带货场景需入参
ProductID uint64 `json:"product_id,omitempty"`
}

// Encode implement GetRequest interface
func (r VideoAwemeGetRequest) Encode() string {
values := &url.Values{}
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("aweme_id", strconv.FormatUint(r.AwemeID, 10))
if r.Filtering != nil {
filter, _ := json.Marshal(r.Filtering)
values.Set("filtering", string(filter))
}
if r.Cursor > 0 {
values.Set("cursor", strconv.Itoa(r.Cursor))
}
if r.Count > 0 {
values.Set("count", strconv.Itoa(r.Count))
}
return values.Encode()
}

// VideoAwemeGetResponse 获取抖音号下的视频 API Response
type VideoAwemeGetResponse struct {
model.BaseResponse
Data *VideoAwemeGetResponseData `json:"data,omitempty"`
}

// VideoAwemeGetResponseData json返回值
type VideoAwemeGetResponseData struct {
// List 视频列表
List []file.Video `json:"video_list,omitempty"`
// PageInfo 分页信息
PageInfo *model.PageInfo `json:"page_info,omitempty"`
}

0 comments on commit dbbb344

Please sign in to comment.