-
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
9 changed files
with
221 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
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,17 @@ | ||
package material | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/material" | ||
) | ||
|
||
// AdGet 获取素材关联计划 | ||
func AdGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.AdGetRequest) (*material.AdGetResult, error) { | ||
var resp material.AdGetResponse | ||
if err := clt.GetAPI(ctx, "v1.0/qianchuan/material/ad/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package material | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/material" | ||
) | ||
|
||
// Suggestion 计划下素材审核建议 | ||
func Suggestion(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.SuggestionRequest) (*material.SuggestionResult, error) { | ||
var resp material.SuggestionResponse | ||
if err := clt.GetAPI(ctx, "v1.0/qianchuan/ad/material/suggestion/", 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,94 @@ | ||
package material | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/enum" | ||
"github.com/bububa/oceanengine/marketing-api/enum/qianchuan" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/report" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// AdGetRequest 获取素材关联计划 API Request | ||
type AdGetRequest struct { | ||
// AdvertiserID 广告主id | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// MaterialID 素材id | ||
MaterialID uint64 `json:"material_id,omitempty"` | ||
// MaterialType 素材类型,可选值: | ||
// IMAGE 图片,图文 | ||
// LIVE_ROOM 直播间画面 | ||
// TITLE 标题 | ||
// VIDEO 视频 | ||
MaterialType MaterialType `json:"material_type,omitempty"` | ||
// MarketingScene 广告类型,可选值: | ||
// FEED 通投 | ||
// SEARCH 搜索 | ||
// SHOPPING_MALL 商城广告 | ||
MarketingScene qianchuan.MarketingScene `json:"marketing_scene,omitempty"` | ||
// MarketingGoal 营销场景,可选值: | ||
// VIDEO_PROM_GOODS:推商品 | ||
// LIVE_PROM_GOODS:推直播间 | ||
MarketingGoal enum.MarketingGoal `json:"marketing_goal,omitempty"` | ||
// StartTime 计划数据开始时间,格式“YYYY-MM-DD” | ||
// 注意:最早开始时间不大于“当前时间-180天” | ||
StartTime string `json:"start_time,omitempty"` | ||
// EndTime 计划数据结束时间,格式“YYYY-MM-DD” | ||
EndTime string `json:"end_time,omitempty"` | ||
// Fields 需要查询的消耗指标,取值见返回值中metric相关指标 | ||
Fields []string `json:"fields,omitempty"` | ||
// OrderField 排序字段 | ||
OrderField string `json:"order_field,omitempty"` | ||
// OrderType 排序方式 可选值: | ||
// ASC 升序 | ||
// DESC 降序 | ||
OrderType enum.OrderType `json:"order_type,omitempty"` | ||
} | ||
|
||
// Encode implements GetRequest interface | ||
func (r AdGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("material_id", strconv.FormatUint(r.MaterialID, 10)) | ||
values.Set("material_type", string(r.MaterialType)) | ||
values.Set("marketing_scene", string(r.MarketingScene)) | ||
values.Set("marketing_goal", string(r.MarketingGoal)) | ||
values.Set("start_time", r.StartTime) | ||
values.Set("end_time", r.EndTime) | ||
if len(r.Fields) > 0 { | ||
values.Set("fields", string(util.JSONMarshal(r.Fields))) | ||
} | ||
if r.OrderField != "" { | ||
values.Set("order_field", r.OrderField) | ||
} | ||
if r.OrderType != "" { | ||
values.Set("order_type", string(r.OrderType)) | ||
} | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// AdGetResponse 获取素材关联计划 API Response | ||
type AdGetResponse struct { | ||
Data *AdGetResult `json:"data,omitempty"` | ||
model.BaseResponse | ||
} | ||
|
||
type AdGetResult struct { | ||
// PageInfo 分页信息 | ||
PageInfo *model.PageInfo `json:"page_info,omitempty"` | ||
// AdList 计划列表 | ||
AdList []MaterialAd `json:"ad_list,omitempty"` | ||
} | ||
|
||
// MaterialAd 素材关联计划 | ||
type MaterialAd struct { | ||
// AdID 计划id | ||
AdID uint64 `json:"ad_id,omitempty"` | ||
// AdName 计划名称 | ||
AdName string `json:"ad_name,omitempty"` | ||
// Metrics 指标 | ||
Metrics *report.Metrics `json:"metrics,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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package material | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// SuggestionRequest 计划下素材审核建议 API Request | ||
type SuggestionRequest struct { | ||
// MaterialIDs 素材id列表 | ||
MaterialIDs []uint64 `json:"material_ids,omitempty"` | ||
// AdvertiserID 广告主id | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AdID 计划id | ||
AdID uint64 `json:"ad_id,omitempty"` | ||
} | ||
|
||
// Encode implements GetRequest interface | ||
func (r SuggestionRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("ad_id", strconv.FormatUint(r.AdID, 10)) | ||
values.Set("material_ids", string(util.JSONMarshal(r.MaterialIDs))) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// SuggestionResponse 计划下素材审核建议 API Response | ||
type SuggestionResponse struct { | ||
Data *SuggestionResult `json:"data,omitempty"` | ||
model.BaseResponse | ||
} | ||
|
||
type SuggestionResult struct { | ||
List []Suggestion `json:"list,omitempty"` | ||
} | ||
|
||
// Suggestion 素材审核建议 | ||
type Suggestion struct { | ||
// AuditRecords 审核列表 | ||
AuditRecords []AuditRecord `json:"audit_records,omitempty"` | ||
// MaterialID 素材id | ||
MaterialID uint64 `json:"material_id,omitempty"` | ||
} | ||
|
||
// AuditPlatform 审核平台 | ||
type AuditPlatform string | ||
|
||
const ( | ||
// AuditPlatform_UNKNOWN 未知 | ||
AuditPlatform_UNKNOWN AuditPlatform = "UNKNOWN" | ||
// AuditPlatform_AD 广告审核 | ||
AuditPlatform_AD AuditPlatform = "AD" | ||
// AuditPlatform_CONTENT 内容审核 | ||
AuditPlatform_CONTENT AuditPlatform = "CONTENT" | ||
) | ||
|
||
// AuditRecord 审核列表 | ||
type AuditRecord struct { | ||
// AuditPlatform 审核平台:可选值: | ||
// UNKNOWN:未知 | ||
// AD:广告审核 | ||
// CONTENT:内容审核 | ||
AuditPlatform AuditPlatform `json:"audit_platform,omitempty"` | ||
// RejectReason 拒绝原因 | ||
RejectReason []string `json:"reject_reason,omitempty"` | ||
// Suggestions 建议 | ||
Suggestions []string `json:"suggestions,omitempty"` | ||
} |