-
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
11 changed files
with
288 additions
and
0 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,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 | ||
} |
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,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 | ||
} |
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,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 | ||
} |
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,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" | ||
) |
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 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" | ||
) |
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,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" | ||
) |
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,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"` | ||
} |
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,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"` | ||
} |
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,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"` | ||
} |