Skip to content

Commit

Permalink
Merge branch 'release/v1.29.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Dec 5, 2024
2 parents a94a02b + bb52c5a commit c2f8983
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 11 deletions.
2 changes: 2 additions & 0 deletions marketing-api/QIANCHUAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
- 获取账户下素材列表 [ Get(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.GetRequest) (*material.GetResult, error) ]
- 获取计划下素材列表 [ AdMaterialGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.AdMaterialGetRequest) (*material.AdMaterialGetResult, error) ]
- 删除广告计划下素材 [ AdMaterialDelete(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.AdMaterialDeleteRequest) error ]
- 计划下素材审核建议 [ Suggestion(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.SuggestionRequest) (*material.SuggestionResult, error) ]
- 获取素材关联计划 [ AdGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *material.AdGetRequest) (*material.AdGetResult, error) ]
- 商品/直播间管理
- 获取可投商品列表 [ AvailableGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *product.AvailableGetRequest) (*product.AvailableGetResponseData, error) ]
- 获取千川账户下已授权抖音号 [ AuthorizedGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *aweme.AuthorizedGetRequest) (*aweme.AuthorizedGetResponseData, error) ]
Expand Down
17 changes: 17 additions & 0 deletions marketing-api/api/qianchuan/material/ad_get.go
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
}
17 changes: 17 additions & 0 deletions marketing-api/api/qianchuan/material/suggestion.go
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
}
2 changes: 2 additions & 0 deletions marketing-api/model/qianchuan/ad/audience.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type Audience struct {
// 1:支持电子围栏定向
// 2:支持电子围栏定向
ElectricFenceRegion int `json:"electric_fence_region,omitempty"`
// RegionVersion 行政区域版本号,可选值:2.3.2 新版本
RegionVersion string `json:"region_version,omitempty"`
// City 具体定向的城市列表,当 district 为COUNTY,city 为必填,枚举值详见【附件-city.json】;省市传法:city: [12],district: CITY;区县的传法:city: [130102],district: COUNTY
City []uint64 `json:"city,omitempty"`
// LocationType 地域定向的用户状态类型,当 district 为COUNTY,CITY为必填,允许值:CURRENT:正在该地区的用户,HOME:居住在该地区的用户,TRAVEL;到该地区旅行的用户,ALL:该地区内的所有用户
Expand Down
6 changes: 6 additions & 0 deletions marketing-api/model/qianchuan/ad/region_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ type RegionUpdateRequest struct {
// 注意:
// 1、当地域定向类型为“不限”/地域定向的用户状态类型为“正在该地区的用户”才支持
ExcludeLimitedRegion int `json:"exclude_limited_region,omitempty"`
// ElectricFenceRegion 电子围栏定向,可选值:
// 1 不支持电子围栏地区
// 2 支持电子围栏地区
ElectricFenceRegion int `json:"electric_fence_region,omitempty"`
// RegionVersion 行政区域版本号,可选值: 2.3.3 新版本
RegionVersion string `json:"region_version,omitempty"`
}

// Encode implement PostRequest interface
Expand Down
94 changes: 94 additions & 0 deletions marketing-api/model/qianchuan/material/ad_get.go
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"`
}
11 changes: 0 additions & 11 deletions marketing-api/model/qianchuan/material/ad_material_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ import (
"github.com/bububa/oceanengine/marketing-api/util"
)

const (
// MaterialType_IMAGE 图片,图文
MaterialType_IMAGE MaterialType = "IMAGE"
// MaterialType_TITLE 标题
MaterialType_TITLE MaterialType = "TITLE"
// MaterialType_LIVE_ROOM 直播间画面
MaterialType_LIVE_ROOM MaterialType = "LIVE_ROOM"
// MaterialType_VIDEO 视频
MaterialType_VIDEO MaterialType = "VIDEO"
)

// AdMaterialGetRequest 获取计划下素材列表 API Request
type AdMaterialGetRequest struct {
// Filtering 过滤条件
Expand Down
11 changes: 11 additions & 0 deletions marketing-api/model/qianchuan/material/material.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import (
// MaterialType 素材类型
type MaterialType string

const (
// MaterialType_IMAGE 图片,图文
MaterialType_IMAGE MaterialType = "IMAGE"
// MaterialType_TITLE 标题
MaterialType_TITLE MaterialType = "TITLE"
// MaterialType_LIVE_ROOM 直播间画面
MaterialType_LIVE_ROOM MaterialType = "LIVE_ROOM"
// MaterialType_VIDEO 视频
MaterialType_VIDEO MaterialType = "VIDEO"
)

// AdMaterialInfo 素材信息
type AdMaterialInfo struct {
// MaterialInfo 素材信息
Expand Down
72 changes: 72 additions & 0 deletions marketing-api/model/qianchuan/material/suggestion.go
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"`
}

0 comments on commit c2f8983

Please sign in to comment.