-
Notifications
You must be signed in to change notification settings - Fork 43
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
8 changed files
with
138 additions
and
5 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
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,20 @@ | ||
package file | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/file" | ||
) | ||
|
||
// CarouselAwemeGet 获取创编可用的抖音图文素材 | ||
// 该接口用于获取「巨量广告平台」创建广告时可用的抖音图文素材,您可以获取抖音图文素材的item_id,在广告创编接口使用。 | ||
// 您必须先和抖音号建立以下任意3种生效中的授权关系:抖音号授权、主页作品授权、单个作品授权,才可获取抖音图文素材 | ||
// 当抖音号下没有图文素材时,列表会返回为空 | ||
func CarouselAwemeGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *file.CarouselAwemeGetRequest) (*file.CarouselAwemeGetResult, error) { | ||
var resp file.CarouselAwemeGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/file/carousel/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package file | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// CarouselAwemeGetRequest 获取创编可用的抖音图文素材 API Request | ||
type CarouselAwemeGetRequest struct { | ||
// AdvertiserID 巨量广告广告主账户ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AwemeID 抖音号id | ||
AwemeID string `json:"aweme_id,omitempty"` | ||
// Filtering 过滤器 | ||
Filtering *CarouselAwemeGetFilter `json:"filtering,omitempty"` | ||
// Cursor 页码游标值,第一次拉取,请传入0 | ||
// 不传入或者传空字符串默认使用 | ||
Cursor string `json:"cursor,omitempty"` | ||
// Count 页面数据量,默认10,最大值100 | ||
Count int `json:"count,omitempty"` | ||
} | ||
|
||
type CarouselAwemeGetFilter struct { | ||
// ItemIDs 抖音图文唯一ID | ||
ItemIDs []uint64 `json:"item_ids,omitempty"` | ||
} | ||
|
||
// Encode implements GetRequest interface | ||
func (r CarouselAwemeGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("aweme_id", r.AwemeID) | ||
if r.Filtering != nil { | ||
values.Set("filtering", string(util.JSONMarshal(r.Filtering))) | ||
} | ||
if r.Cursor != "" { | ||
values.Set("cursor", r.Cursor) | ||
} | ||
if r.Count > 0 { | ||
values.Set("count", strconv.Itoa(r.Count)) | ||
} | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// CarouselAwemeGetResponse 获取创编可用的抖音图文素材 API Response | ||
type CarouselAwemeGetResponse struct { | ||
model.BaseResponse | ||
Data *CarouselAwemeGetResult `json:"data,omitempty"` | ||
} | ||
|
||
type CarouselAwemeGetResult struct { | ||
// CursorInfo 分页信息 | ||
CursorInfo *model.CursorInfo `json:"cursor_info,omitempty"` | ||
// AwemeCarouseList 抖音图文素材列表 | ||
AwemeCarouseList []AwemeCarousel `json:"aweme_carouse_list,omitempty"` | ||
} |
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
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