Skip to content

Commit cdd09ad

Browse files
committed
Merge branch 'release/v1.22.5'
2 parents edf1825 + cd0a0ae commit cdd09ad

22 files changed

+508
-1
lines changed

marketing-api/OCEANENGINE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@
8888
- 批量更新项目状态 [ StatusUpdate(clt *core.SDKClient, accessToken string, req *project.StatusUpdateRequest) (*project.UpdateResponseData, error) ]
8989
- 批量删除项目 [ Delete(clt *core.SDKClient, accessToken string, req *project.DeleteRequest) (*project.UpdateResponseData, error) ]
9090
- 批量更新项目预算 [ BudgetUpdate(clt *core.SDKClient, accessToken string, req *project.BudgetUpdateRequest) (*project.UpdateResponseData, error) ]
91+
- 批量更新项目投放时间 [ ScheduleTimeUpdate(clt *core.SDKClient, accessToken string, req *project.ScheduleTimeUpdateRequest) (*project.UpdateResponseData, error) ]
92+
- 批量更新项目投放时段 [ WeekScheduleUpdate(clt *core.SDKClient, accessToken string, req *project.WeekScheduleUpdateRequest) (*project.UpdateResponseData, error) ]
93+
- 创建预算组 [ BudgetGroupCreate(clt *core.SDKClient, accessToken string, req *project.BudgetGroupCreateRequest) (uint64, error) ]
94+
- 更新预算组 [ BudgetGroupUpdate(clt *core.SDKClient, accessToken string, req *project.BudgetGroupUpdateRequest) (uint64, error) ]
95+
- 批量删除预算组 [ BudgetGroupDelete(clt *core.SDKClient, accessToken string, req *project.BudgetGroupDeleteRequest) (*project.BudgetGroupDeleteResult, error) ]
96+
- 获取预算组列表 [ BudgetGroupList(clt *core.SDKClient, accessToken string, req *project.BudgetGroupListRequest) (*project.BudgetGroupListResult, error) ]
9197
- 广告管理模块 (api/v3/promotion)
9298
- 创建广告 [ Create(clt *core.SDKClient, accessToken string, req *promotion.CreateRequest) (uint64, error) ]
9399
- 修改广告 [ Update(clt *core.SDKClient, accessToken string, req *promotion.UpdateRequest) (*promotion.UpdateResponseData, error) ]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/core"
5+
"github.com/bububa/oceanengine/marketing-api/model/v3/project"
6+
)
7+
8+
// BudgetGroupCreate 创建预算组
9+
// 新建预算组,预算组可设置多个项目的预算(日预算)
10+
func BudgetGroupCreate(clt *core.SDKClient, accessToken string, req *project.BudgetGroupCreateRequest) (uint64, error) {
11+
var resp project.BudgetGroupCreateResponse
12+
if err := clt.Post("v3.0/budget_group/create/", req, &resp, accessToken); err != nil {
13+
return 0, err
14+
}
15+
return resp.Data.BudgetGroupID, nil
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/core"
5+
"github.com/bububa/oceanengine/marketing-api/model/v3/project"
6+
)
7+
8+
// BudgetGroupDelete 批量删除预算组
9+
func BudgetGroupDelete(clt *core.SDKClient, accessToken string, req *project.BudgetGroupDeleteRequest) (*project.BudgetGroupDeleteResult, error) {
10+
var resp project.BudgetGroupDeleteResponse
11+
if err := clt.Post("v3.0/budget_group/delete/", req, &resp, accessToken); err != nil {
12+
return nil, err
13+
}
14+
return resp.Data, nil
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/core"
5+
"github.com/bububa/oceanengine/marketing-api/model/v3/project"
6+
)
7+
8+
// BudgetGroupList 获取预算组列表
9+
func BudgetGroupList(clt *core.SDKClient, accessToken string, req *project.BudgetGroupListRequest) (*project.BudgetGroupListResult, error) {
10+
var resp project.BudgetGroupListResponse
11+
if err := clt.Get("v3.0/budget_group/list/", req, &resp, accessToken); err != nil {
12+
return nil, err
13+
}
14+
return resp.Data, nil
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/core"
5+
"github.com/bububa/oceanengine/marketing-api/model/v3/project"
6+
)
7+
8+
// BudgetGroupUpdate 更新预算组
9+
// 新建预算组,预算组可设置多个项目的预算(日预算)
10+
func BudgetGroupUpdate(clt *core.SDKClient, accessToken string, req *project.BudgetGroupUpdateRequest) (uint64, error) {
11+
var resp project.BudgetGroupUpdateResponse
12+
if err := clt.Post("v3.0/budget_group/update/", req, &resp, accessToken); err != nil {
13+
return 0, err
14+
}
15+
return resp.Data.BudgetGroupID, nil
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/core"
5+
"github.com/bububa/oceanengine/marketing-api/model/v3/project"
6+
)
7+
8+
// ScheduleTimeUpdate 批量更新项目投放时间
9+
func ScheduleTimeUpdate(clt *core.SDKClient, accessToken string, req *project.ScheduleTimeUpdateRequest) (*project.UpdateResponseData, error) {
10+
var resp project.UpdateResponse
11+
if err := clt.Post("v3.0/project/schedule_time/update/", req, &resp, accessToken); err != nil {
12+
return nil, err
13+
}
14+
return resp.Data, nil
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/core"
5+
"github.com/bububa/oceanengine/marketing-api/model/v3/project"
6+
)
7+
8+
// WeekScheduleUpdate 批量更新项目投放时段
9+
func WeekScheduleUpdate(clt *core.SDKClient, accessToken string, req *project.WeekScheduleUpdateRequest) (*project.UpdateResponseData, error) {
10+
var resp project.UpdateResponse
11+
if err := clt.Post("v3.0/project/week_schedule/update/", req, &resp, accessToken); err != nil {
12+
return nil, err
13+
}
14+
return resp.Data, nil
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package enum
2+
3+
// BudgetGroupStatus 预算组聚合状态
4+
type BudgetGroupStatus string
5+
6+
const (
7+
// BudgetGroupStatus_DELETED 已删除
8+
BudgetGroupStatus_DELETED BudgetGroupStatus = "DELETED"
9+
// BudgetGroupStatus_ENABLE 启用中
10+
BudgetGroupStatus_ENABLE BudgetGroupStatus = "ENABLE"
11+
// BudgetGroupStatus_UNDELIVERIED 未投放
12+
BudgetGroupStatus_UNDELIVERIED BudgetGroupStatus = "UNDELIVERIED"
13+
// BudgetGroupStatus_ACCOUNT_EXCEEDED 账户超出预算
14+
BudgetGroupStatus_ACCOUNT_EXCEEDED BudgetGroupStatus = "ACCOUNT_EXCEEDED"
15+
// BudgetGroupStatus_GROUP_EXCEEDED 预算组超出预算
16+
BudgetGroupStatus_GROUP_EXCEEDED BudgetGroupStatus = "GROUP_EXCEEDED"
17+
)

marketing-api/enum/delivery_type.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package enum
2+
3+
// DeliveryType 投放类型
4+
type DeliveryType string
5+
6+
const (
7+
// DeliveryType_NORMAL 常规投放
8+
DeliveryType_NORMAL DeliveryType = "NORMAL"
9+
// DeliveryType_DURATION 周期稳投(目前仅支持搜索广告)
10+
DeliveryType_DURATION DeliveryType = "DURATION"
11+
)

marketing-api/enum/schedule_scene.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package enum
2+
3+
// ScheduleScene 生效方式
4+
type ScheduleScene string
5+
6+
const (
7+
// ScheduleScene_NEXT_DAY 次日0点生效
8+
ScheduleScene_NEXT_DAY ScheduleScene = "NEXT_DAY"
9+
// ScheduleScene_REALTIME 立即生效
10+
ScheduleScene_REALTIME ScheduleScene = "REALTIME"
11+
)

marketing-api/model/eventmanager/v3/optimized_goal_get.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ type OptimizedGoalGetRequest struct {
2121
MarketingGoal enum.MarketingGoal `json:"marketing_goal,omitempty"`
2222
// AdType 广告类型,允许值: ALL
2323
AdType enum.CampaignType `json:"ad_type,omitempty"`
24+
// DeliveryType 投放类型,允许值
25+
// NORMAL 常规投放
26+
// DURATION 周期稳投
27+
// 当前仅支持搜索广告,即ad_type = SEARCH下传入该枚举值有效,否则报错
28+
DeliveryType enum.DeliveryType `json:"delivery_type,omitempty"`
2429
// AssetType 资产类型,允许值:THIRD_EXTERNAL 三方落地页、TETRIS_EXTERNAL 建站、APP 应用、QUICK_APP 快应用、MINI_PROGRAME字节小程序
2530
AssetType enum.AssetType `json:"asset_type,omitempty"`
2631
// MiniProgoramID 字节小程序资产id,当asset_type=MINI_PROGRAME时需传入
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package project
2+
3+
import (
4+
"github.com/bububa/oceanengine/marketing-api/enum"
5+
"github.com/bububa/oceanengine/marketing-api/model"
6+
"github.com/bububa/oceanengine/marketing-api/util"
7+
)
8+
9+
// BudgetGroupCreateRequest 创建预算组 API Request
10+
type BudgetGroupCreateRequest struct {
11+
// AdvertiserID 广告主ID
12+
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
13+
// BudgetGroupName 预算组名称,50个字以内,预算组之间名称不可重复,不可为空
14+
BudgetGroupName string `json:"budget_group_name,omitempty"`
15+
// BudgetGroupBudget 日预算,单位:元,范围:[300,9,999,999],预算组中的每个项目在实际消耗时,以【项目、预算组】中较低预算为准
16+
BudgetGroupBudget float64 `json:"budget_group_budget,omitempty"`
17+
// CampaignType 广告类型 可选值:
18+
// ALL 通投广告
19+
// SEARCH 搜索广告
20+
CampaignType enum.CampaignType `json:"campaign_type,omitempty"`
21+
// DeliveryMode 投放类型 可选值:
22+
// MANUAL 手动投放模式
23+
// PROCEDURAL 自动投放模式
24+
DeliveryMode enum.DeliveryMode `json:"delivery_mode,omitempty"`
25+
}
26+
27+
// Encode implement PostRequest interface
28+
func (r BudgetGroupCreateRequest) Encode() []byte {
29+
return util.JSONMarshal(r)
30+
}
31+
32+
// BudgetGroupCreateResponse 创建预算组 API Response
33+
type BudgetGroupCreateResponse struct {
34+
model.BaseResponse
35+
Data struct {
36+
// BudgetGroupID 预算组ID
37+
BudgetGroupID uint64 `json:"budget_group_id,omitempty"`
38+
} `json:"data,omitempty"`
39+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package project
2+
3+
import (
4+
"strconv"
5+
6+
"github.com/bububa/oceanengine/marketing-api/model"
7+
"github.com/bububa/oceanengine/marketing-api/util"
8+
)
9+
10+
// BudgetGroupDeleteRequest 批量删除预算组 API Request
11+
type BudgetGroupDeleteRequest struct {
12+
// AdvertiserID 广告主ID
13+
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
14+
// 要删除的预算组id列表,请注意:
15+
// 删除预算组,删除后关联的项目不受影响,继续以项目预算进行推广
16+
// 预算组删除后不可恢复、不可见
17+
// 预算组内无项目、项目均为已删除时,才支持删除预算组
18+
BudgetGroupIDs []uint64 `json:"budget_group_ids,omitempty"`
19+
}
20+
21+
// Encode implement PostRequest interface
22+
func (r BudgetGroupDeleteRequest) Encode() []byte {
23+
return util.JSONMarshal(r)
24+
}
25+
26+
// BudgetGroupDeleteResponse 批量删除预算组 API Response
27+
type BudgetGroupDeleteResponse struct {
28+
model.BaseResponse
29+
Data *BudgetGroupDeleteResult `json:"data,omitempty"`
30+
}
31+
32+
type BudgetGroupDeleteResult struct {
33+
// BudgetGroupIDs 删除成功的预算组ID
34+
BudgetGroupIDs []uint64 `json:"budget_group_ids,omitempty"`
35+
// Errors 删除失败的预算组
36+
Errors []BudgetGroupDeleteError `json:"errors,omitempty"`
37+
}
38+
39+
type BudgetGroupDeleteError struct {
40+
// BudgetGroupID 预算组ID
41+
BudgetGroupID uint64 `json:"budget_group_id,omitempty"`
42+
// ErrorMessage 错误信息
43+
ErrorMessage string `json:"error_message,omitempty"`
44+
}
45+
46+
// Error implement Error interface
47+
func (e BudgetGroupDeleteError) Error() string {
48+
return util.StringsJoin("广告项目ID:", strconv.FormatUint(e.BudgetGroupID, 10), ", ", e.ErrorMessage)
49+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package project
2+
3+
import (
4+
"strconv"
5+
6+
"github.com/bububa/oceanengine/marketing-api/enum"
7+
"github.com/bububa/oceanengine/marketing-api/model"
8+
"github.com/bububa/oceanengine/marketing-api/util"
9+
)
10+
11+
// BudgetGroupListRequest 获取预算组列表 API Request
12+
type BudgetGroupListRequest struct {
13+
// AdvertiserID 广告主ID
14+
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
15+
// Filtering 过滤条件
16+
Filtering *BudgetGroupListFilter `json:"filtering,omitempty"`
17+
// StatisticsTime 统计时间范围
18+
StatisticsTime *model.DateRange `json:"statistics_time,omitempty"`
19+
// Page 页数,默认值:1,page范围为[1,99999]
20+
Page int `json:"page,omitempty"`
21+
// PageSize 页面大小默认值:10,page_size范围为[1,100]
22+
PageSize int `json:"page_size,omitempty"`
23+
}
24+
25+
type BudgetGroupListFilter struct {
26+
// BudgetGroupIDs 预算组ID列表,一次最多传入200个ID
27+
BudgetGroupIDs []uint64 `json:"budget_group_ids,omitempty"`
28+
// BudgetGroupKeyword 预算组名称模糊搜索关键字
29+
BudgetGroupKeyword string `json:"budget_group_keyword,omitempty"`
30+
// DeliveryType 投放类型 可选值:
31+
// MANUAL 手动投放模式
32+
// PROCEDURAL 自动投放模式
33+
DeliveryType enum.DeliveryMode `json:"delivery_type,omitempty"`
34+
// AdType 广告类型 可选值:
35+
// ALL 通投广告
36+
// SEARCH 搜索广告
37+
AdType enum.CampaignType `json:"ad_type,omitempty"`
38+
// BudgetGroupStatusFirst 预算组聚合一级状态 可选值:
39+
// DELETED 已删除
40+
// ENABLE 启用中
41+
// UNDELIVERIED 未投放
42+
BudgetGroupStatusFirst enum.BudgetGroupStatus `json:"budget_group_status_first,omitempty"`
43+
// BudgetGroupStatusSecond 预算组聚合二级状态 可选值:
44+
// ACCOUNT_EXCEEDED 账户超出预算
45+
// GROUP_EXCEEDED 预算组超出预算
46+
BudgetGroupStatusSecond enum.BudgetGroupStatus `json:"budget_group_status_second,omitempty"`
47+
}
48+
49+
// Encode implement GetRequest interface
50+
func (r BudgetGroupListRequest) Encode() string {
51+
values := util.GetUrlValues()
52+
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
53+
if r.Filtering != nil {
54+
values.Set("filtering", string(util.JSONMarshal(r.Filtering)))
55+
}
56+
if r.StatisticsTime != nil {
57+
values.Set("statistics_time", string(util.JSONMarshal(r.StatisticsTime)))
58+
}
59+
if r.Page > 0 {
60+
values.Set("page", strconv.Itoa(r.Page))
61+
}
62+
if r.PageSize > 0 {
63+
values.Set("page_size", strconv.Itoa(r.PageSize))
64+
}
65+
ret := values.Encode()
66+
util.PutUrlValues(values)
67+
return ret
68+
}
69+
70+
// BudgetGroupListResponse 获取预算组列表 API Response
71+
type BudgetGroupListResponse struct {
72+
model.BaseResponse
73+
Data *BudgetGroupListResult `json:"data,omitempty"`
74+
}
75+
76+
type BudgetGroupListResult struct {
77+
// PageInfo 分页信息
78+
PageInfo *model.PageInfo `json:"page_info,omitempty"`
79+
// BudgetGroups 预算组信息
80+
BudgetGroups []BudgetGroup `json:"budget_groups,omitempty"`
81+
}
82+
83+
// BudgetGroup 预算组信息
84+
type BudgetGroup struct {
85+
// BudgetGroupID 预算组ID
86+
BudgetGroupID uint64 `json:"budget_group_id,omitempty"`
87+
// BudgetGroupName 预算组名称
88+
BudgetGroupName string `json:"budget_group_name,omitempty"`
89+
// BudgetGroupBudget 预算组预算
90+
BudgetGroupBudget float64 `json:"budget_group_budget,omitempty"`
91+
// AdType 广告类型 可选值:
92+
// ALL 通投广告
93+
// SEARCH 搜索广告
94+
AdType enum.CampaignType `json:"ad_type,omitempty"`
95+
// DeliveryType 投放类型 可选值:
96+
// MANUAL 手动投放模式
97+
// PROCEDURAL 自动投放模式
98+
DeliveryType enum.DeliveryMode `json:"delivery_type,omitempty"`
99+
// BudgetGroupStatusFirst 预算组聚合一级状态 可选值:
100+
// DELETED 已删除
101+
// ENABLE 启用中
102+
// UNDELIVERIED 未投放
103+
BudgetGroupStatusFirst enum.BudgetGroupStatus `json:"budget_group_status_first,omitempty"`
104+
// BudgetGroupStatusSecond 预算组聚合二级状态 可选值:
105+
// ACCOUNT_EXCEEDED 账户超出预算
106+
// GROUP_EXCEEDED 预算组超出预算
107+
BudgetGroupStatusSecond enum.BudgetGroupStatus `json:"budget_group_status_second,omitempty"`
108+
// NumProjects 关联的(非删除)项目个数
109+
NumProjects int `json:"num_projects,omitempty"`
110+
// Cost 预算组消耗(元)
111+
Cost float64 `json:"cost,omitempty"`
112+
}

0 commit comments

Comments
 (0)