-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package file 素材管理相关API | ||
package file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package file 素材管理API models | ||
package file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
} |