diff --git a/marketing-api/api/qianchuan/file/doc.go b/marketing-api/api/qianchuan/file/doc.go new file mode 100644 index 00000000..2b2f0568 --- /dev/null +++ b/marketing-api/api/qianchuan/file/doc.go @@ -0,0 +1,2 @@ +// Package file 素材管理相关API +package file diff --git a/marketing-api/api/qianchuan/file/video_aweme_get.go b/marketing-api/api/qianchuan/file/video_aweme_get.go new file mode 100644 index 00000000..b0d0d8d7 --- /dev/null +++ b/marketing-api/api/qianchuan/file/video_aweme_get.go @@ -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 +} diff --git a/marketing-api/model/creative/creative.go b/marketing-api/model/creative/creative.go index 40d71654..fcc763fb 100644 --- a/marketing-api/model/creative/creative.go +++ b/marketing-api/model/creative/creative.go @@ -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"` } diff --git a/marketing-api/model/file/video_aweme_get.go b/marketing-api/model/file/video_aweme_get.go index 319834b6..4f732530 100644 --- a/marketing-api/model/file/video_aweme_get.go +++ b/marketing-api/model/file/video_aweme_get.go @@ -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 @@ -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() } diff --git a/marketing-api/model/qianchuan/file/doc.go b/marketing-api/model/qianchuan/file/doc.go new file mode 100644 index 00000000..4394bdfd --- /dev/null +++ b/marketing-api/model/qianchuan/file/doc.go @@ -0,0 +1,2 @@ +// Package file 素材管理API models +package file diff --git a/marketing-api/model/qianchuan/file/video_aweme_get.go b/marketing-api/model/qianchuan/file/video_aweme_get.go new file mode 100644 index 00000000..bd7dcffe --- /dev/null +++ b/marketing-api/model/qianchuan/file/video_aweme_get.go @@ -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"` +}