Skip to content

Commit

Permalink
Merge branch 'v1.8.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Aug 11, 2022
2 parents cdfadd2 + 3c4a785 commit 9cc1485
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 0 deletions.
3 changes: 3 additions & 0 deletions marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@
- 行动号召字段内容获取 [ tools.ActionTextGet(clt *core.SDKClient, accessToken string, req *tools.ActionTextGetRequest) ([]string, error) ]
- 查询推广卡片推荐内容(新版) [ PromotionCardRecommendTitleGet(clt *core.SDKClient, accessToken string, req *tools.PromotionCardRecommendTitleGetRequest) ([]string, error) ]
- 获取预估点击成本 [ tools.EstimatedPriceGet(clt *core.SDKClient, accessToken string, req *tools.EstimatedPriceGetRequest) (*tools.EstimatedPrice, error) ]
- 获取抖音授权关系 [ tools.AwemeAuthList(clt *core.SDKClient, accessToken string, req *tools.AwemeAuthListRequest) (*tools.AwemeAuthListData, error) ]
- 查询视频是否挂载下载类锚点 [ tools.CheckAvailableAnchor(clt *core.SDKClient, accessToken string, req *video.CheckAvailableAnchorRequest) ([]video.AvailableAnchor, error) ]
- 获取快投推荐出价系数 [ tools.SearchBidRatioGet(clt *core.SDKClient, accessToken string, req *tools.SearchBidRatioGetRequest) (float64, error) ]
- 抖音达人 (tools/aweme)
- 查询抖音帐号和类目信息 [ AwemeInfoSearch(clt *core.SDKClient, accessToken string, req *aweme.AwemeInfoSearchRequest) (*aweme.AwemeInfoSearchResult, error) ]
- 查询抖音类似帐号 [ AwemeSimilarAuthorSearch(clt *core.SDKClient, accessToken string, req *aweme.AwemeSimilarAuthorSearchRequest) ([]aweme.Author, error) ]
Expand Down
16 changes: 16 additions & 0 deletions marketing-api/api/tools/aweme_auth_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package tools

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

// AwemeAuthList 获取抖音授权关系
// 可以获取账户下抖音号授权关系以及授权视频
func AwemeAuthList(clt *core.SDKClient, accessToken string, req *tools.AwemeAuthListRequest) (*tools.AwemeAuthListData, error) {
var resp tools.AwemeAuthListResponse
if err := clt.Get("2/tools/aweme_auth_list/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
15 changes: 15 additions & 0 deletions marketing-api/api/tools/search_bid_ratio_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tools

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

// SearchBidRatioGet 获取快投推荐出价系数
func SearchBidRatioGet(clt *core.SDKClient, accessToken string, req *tools.SearchBidRatioGetRequest) (float64, error) {
var resp tools.SearchBidRatioGetResponse
if err := clt.Get("2/tools/search_bid_ratio/get/", req, &resp, accessToken); err != nil {
return 0, err
}
return resp.Data.Ratio, nil
}
16 changes: 16 additions & 0 deletions marketing-api/api/tools/video/check_available_anchor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package video

import (
"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/tools/video"
)

// CheckAvailableAnchor 查询视频是否挂载下载类锚点
// 建议优先选择带游戏/网服/平台电商的行业锚点视频投放,更有可能获得平台优质流量补贴
func CheckAvailableAnchor(clt *core.SDKClient, accessToken string, req *video.CheckAvailableAnchorRequest) ([]video.AvailableAnchor, error) {
var resp video.CheckAvailableAnchorResponse
if err := clt.Get("2/tools/video/check_available_anchor/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.List, nil
}
13 changes: 13 additions & 0 deletions marketing-api/enum/aweme_auth_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package enum

// AwemeAuthStatus 授权状态
type AwemeAuthStatus string

const (
// AwemeAuthStatus_AUTHRIZED 授权中
AwemeAuthStatus_AUTHRIZED AwemeAuthStatus = "AUTHRIZED"
// AwemeAuthStatus_AUTHRIZING 待授权确认
AwemeAuthStatus_AUTHRIZING AwemeAuthStatus = "AUTHRIZING"
// AwemeAuthStatus_INVALID 授权失效
AwemeAuthStatus_INVALID AwemeAuthStatus = "INVALID"
)
20 changes: 20 additions & 0 deletions marketing-api/enum/aweme_auth_sub_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package enum

type AwemeAuthSubStatus string

const (
// AwemeAuthSubStatus_INVALID_CANCEL 主动操作解除授权
AwemeAuthSubStatus_INVALID_CANCEL AwemeAuthSubStatus = "INVALID_CANCEL"
// AwemeAuthSubStatus_INVALID_EXPIRED 授权期限已到
AwemeAuthSubStatus_INVALID_EXPIRED AwemeAuthSubStatus = "INVALID_EXPIRED"
// AwemeAuthSubStatus_INVALID_REJECT C端拒绝授权
AwemeAuthSubStatus_INVALID_REJECT AwemeAuthSubStatus = "INVALID_REJECT"
// AwemeAuthSubStatus_INVALID_TIME_OUT 超时未确认
AwemeAuthSubStatus_INVALID_TIME_OUT AwemeAuthSubStatus = "INVALID_TIME_OUT"
// AwemeAuthSubStatus_RENEWING 续期待确认
AwemeAuthSubStatus_RENEWING AwemeAuthSubStatus = "RENEWING"
// AwemeAuthSubStatus_RENEW_FAIL 续期申请失效
AwemeAuthSubStatus_RENEW_FAIL AwemeAuthSubStatus = "RENEW_FAIL"
// AwemeAuthSubStatus_RENEW_SUCCESS 续期成功
AwemeAuthSubStatus_RENEW_SUCCESS AwemeAuthSubStatus = "RENEW_SUCCESS"
)
11 changes: 11 additions & 0 deletions marketing-api/enum/aweme_auth_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package enum

// AwemeAuthType 授权类型
type AwemeAuthType string

const (
// AwemeAuthType_AWEME_ACCOUNT 抖音号授权
AwemeAuthType_AWEME_ACCOUNT AwemeAuthType = "AWEME_ACCOUNT"
// AwemeAuthType_VIDEO_ITEM 单视频授权
AwemeAuthType_VIDEO_ITEM AwemeAuthType = "VIDEO_ITEM"
)
104 changes: 104 additions & 0 deletions marketing-api/model/tools/aweme_auth_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package tools

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

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

// AwemeAuthListRequest 获取抖音授权关系
type AwemeAuthListRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Filtering 筛选条件
Filtering *AwemeAuthListFilter `json:"filtering,omitempty"`
// Page 页码
Page int `json:"page,omitempty"`
// PageSize 页面大小
PageSize int `json:"page_size,omitempty"`
}

// AwemeAuthListFilter 筛选条件
type AwemeAuthListFilter struct {
// AuthType 授权类型,可选值:
// AWEME_ACCOUNT: 抖音号授权、VIDEO_ITEM: 单视频授权
AuthType []enum.AwemeAuthType `json:"auth_type,omitempty"`
// AuthStatus 授权状态, 可选值:
// AUTHRIZED: 授权中、AUTHRIZING: 待授权确认、INVALID: 授权失效
AuthStatus []enum.AwemeAuthStatus `json:"auth_status,omitempty"`
}

// Encode implement GetRequest interface
func (r AwemeAuthListRequest) Encode() string {
values := &url.Values{}
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
if r.Filtering != nil {
buf, _ := json.Marshal(r.Filtering)
values.Set("filtering", string(buf))
}
if r.Page > 1 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
return values.Encode()
}

// AwemeAuthListResponse 获取抖音授权关系
type AwemeAuthListResponse struct {
model.BaseResponse
// Data json返回值
Data *AwemeAuthListData `json:"data,omitempty"`
}

// AwemeAuthListData .
type AwemeAuthListData struct {
// List .
List []AwemeAuthItem `json:"list,omitempty"`
// PageInfo .
PageInfo *model.PageInfo `json:"page_info,omitempty"`
}

type AwemeAuthItem struct {
// AuthType 授权类型
AuthType enum.AwemeAuthType `json:"auth_type,omitempty"`
// AwemeID 抖音号
AwemeID string `json:"aweme_id,omitempty"`
// AwemeName 抖音账号名称
AwemeName string `json:"aweme_name,omitempty"`
// AuthStatus 授权状态
AuthStatus enum.AwemeAuthStatus `json:"auth_status,omitempty"`
// SubStatus 授权子状态,返回值
// INVALID_CANCEL: 主动操作解除授权、INVALID_EXPIRED: 授权期限已到、INVALID_REJECT: C端拒绝授权、INVALID_TIME_OUT: 超时未确认、RENEWING: 续期待确认、RENEW_FAIL: 续期申请失效、RENEW_SUCCESS: 续期成功
SubStatus enum.AwemeAuthSubStatus `json:"sub_status,omitempty"`
// StartTime 授权开始时间,格式为yyyy-MM-dd HH:mm:ss
StartTime string `json:"start_time,omitempty"`
// EndTime 授权结束时间,格式为yyyy-MM-dd HH:mm:ss
EndTime string `json:"end_time,omitempty"`
// VideoInfo 授权视频信息,若为单视频授权会返回
VideoInfo *AwemeAuthVideo `json:"video_info,omitempty"`
}

// AwemeAuthVideo 授权视频信息,若为单视频授权会返回
type AwemeAuthVideo struct {
// ItemID 抖音视频ID
ItemID uint64 `json:"item_id,omitempty"`
// ImageMode 素材类型
ImageMode enum.ImageMode `json:"image_mode,omitempty"`
// VideoID 视频ID
VideoID string `json:"video_id,omitempty"`
// Title 视频名称
Title string `json:"title,omitempty"`
// AwemePlayURL 视频播放链接
AwemePlayURL string `json:"aweme_play_url,omitempty"`
// Duration 视频时长,单位为秒
Duration float64 `json:"duration,omitempty"`
// VideoCoverID 视频封面ID
VideoCoverID string `json:"video_cover_id,omitempty"`
// VideoCoverURL 视频封面链接
VideoCoverURL string `json:"video_cover_url,omitempty"`
}
2 changes: 2 additions & 0 deletions marketing-api/model/tools/event/convert_optimized_goal_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type ConvertOptimizedGoalGetRequest struct {
AssetID uint64 `json:"asset_id,omitempty"`
// CampaignType 广告类型,默认值信息流。允许值:FEED 信息流、SEARCH 搜索
CampaignType enum.CampaignType `json:"campaign_type,omitempty"`
// WechatAppID 微信小游戏原始id。获取方式:资产->青鸟线索通->转化组件->微信小游戏->小游戏列表,可获取小游戏原始id。
WechatAppID string `json:"wechat_app_id,omitempty"`
}

// Encode implement GetRequest interface
Expand Down
36 changes: 36 additions & 0 deletions marketing-api/model/tools/search_bid_ratio_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package tools

import (
"net/url"
"strconv"

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

// SearchBidRatioGetRequest 获取快投推荐出价系数 API Request
type SearchBidRatioGetRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// AdID 广告ID,修改广告时需要传
AdID uint64 `json:"ad_id,omitempty"`
}

// Encode implement GetRequest interface
func (r SearchBidRatioGetRequest) Encode() string {
values := &url.Values{}
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
if r.AdID > 0 {
values.Set("ad_id", strconv.FormatUint(r.AdID, 10))
}
return values.Encode()
}

// SearchBidRatioGetResponse 获取快投推荐出价系数 API Response
type SearchBidRatioGetResponse struct {
model.BaseResponse
// Data json返回值
Data struct {
// Ratio 推荐的快投出价系数
Ratio float64 `json:"ratio,omitempty"`
} `json:"data,omitempty"`
}
52 changes: 52 additions & 0 deletions marketing-api/model/tools/video/check_available_anchor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package video

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

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

// CheckAvailableAnchorRequest 查询视频是否挂载下载类锚点 API Request
type CheckAvailableAnchorRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// ItemIDs 抖音视频ID ,通过【获取抖音主页视频】 或 【获取抖音授权关系】获取主页视频或合作授权视频
ItemIDs []string `json:"item_ids,omitempty"`
// LandingApp 推广目的 可选值:APP: APP
LandingApp enum.LandingType `json:"landing_app,omitempty"`
// ExternalAction 转化目标 可选值:
// AD_CONVERT_TYPE_ACTIVE: 激活、AD_CONVERT_TYPE_ACTIVE_REGISTER: 注册、AD_CONVERT_TYPE_APP_ORDER: app内下单、AD_CONVERT_TYPE_APP_UV: app内访问、AD_CONVERT_TYPE_APP_PAY: app内付费、AD_CONVERT_TYPE_PAY: 激活且付费
ExternalAction enum.AdConvertType `json:"external_action,omitempty"`
}

// Encode implement GetRequest interface
func (r CheckAvailableAnchorRequest) Encode() string {
values := &url.Values{}
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
buf, _ := json.Marshal(r.ItemIDs)
values.Set("item_ids", string(buf))
values.Set("landing_app", string(r.LandingApp))
values.Set("external_action", string(r.ExternalAction))
return values.Encode()
}

// CheckAvailableAnchorResponse 查询视频是否挂载下载类锚点 API Response
type CheckAvailableAnchorResponse struct {
model.BaseResponse
// Data json返回值
Data struct {
// List .
List []AvailableAnchor `json:"list,omitempty"`
} `json:"data,omitempty"`
}

// AvailableAnchor 下载类锚点
type AvailableAnchor struct {
// ItemID 抖音视频ID
ItemID string `json:"item_id,omitempty"`
// Valid 是否支持双库存
Valid bool `json:"valid,omitempty"`
}

0 comments on commit 9cc1485

Please sign in to comment.