Skip to content

Commit

Permalink
feat(ad): 增加创建广告计划API
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Dec 24, 2021
1 parent d54ed71 commit 1035cbd
Show file tree
Hide file tree
Showing 7 changed files with 264 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- 修改广告组 [ Update(clt *core.SDKClient, accessToken string, req *campaign.UpdateRequest) (uint64, error) ]
- 广告组更新状态 [ UpdateStatus(clt *core.SDKClient, accessToken string, req *campaign.UpdateStatusRequest) (*campaign.UpdateResponseData, error) ]
- 广告计划模块 (api/ad)
- 创建广告计划 [ Create(clt *core.SDKClient, accessToken string, req *ad.CreateRequest) (uint64, error) ]
- 获取广告计划 [ Get(clt *core.SDKClient, accessToken string, req *ad.GetRequest) (*ad.GetResponseData, error) ]
- 修改计划 [ Update(clt *core.SDKClient, accessToken string, req *ad.UpdateRequest) (*ad.UpdateResponseData, error) ]
- 更新计划状态 [ UpdateStatus(clt *core.SDKClient, accessToken string, req *ad.UpdateStatusRequest) (*ad.UpdateResponseData, error) ]
Expand Down
1 change: 1 addition & 0 deletions marketing-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- 修改广告组 [ Update(clt *core.SDKClient, accessToken string, req *campaign.UpdateRequest) (uint64, error) ]
- 广告组更新状态 [ UpdateStatus(clt *core.SDKClient, accessToken string, req *campaign.UpdateStatusRequest) (*campaign.UpdateResponseData, error) ]
- 广告计划模块 (api/ad)
- 创建广告计划 [ Create(clt *core.SDKClient, accessToken string, req *ad.CreateRequest) (uint64, error) ]
- 获取广告计划 [ Get(clt *core.SDKClient, accessToken string, req *ad.GetRequest) (*ad.GetResponseData, error) ]
- 修改计划 [ Update(clt *core.SDKClient, accessToken string, req *ad.UpdateRequest) (*ad.UpdateResponseData, error) ]
- 更新计划状态 [ UpdateStatus(clt *core.SDKClient, accessToken string, req *ad.UpdateStatusRequest) (*ad.UpdateResponseData, error) ]
Expand Down
23 changes: 23 additions & 0 deletions marketing-api/api/ad/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package ad

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

// Create 创建广告计划
// 计划包括了计划名称、投放范围、投放目标、用户定向、预算与出价,对于其中的概念解释可以参考:【广告计划】
// 计划创建涉及了多个资产管理:应用管理、落地页管理、转化目标管理、定向包管理、DMP人群管理等;开发者需要提前根据开放接口构建这些资产功能,以免创建计划卡住
// 新版营销链路广告计划差异点

// 新版计划中去除投放内容中落地页信息(旧版计划中在计划维度)
// 新版计划中新增广告位信息(旧版计划中在创意维度)
// 新版计划中增加监测链接内容(旧版计划中在创意维度)
func Create(clt *core.SDKClient, accessToken string, req *ad.CreateRequest) (uint64, error) {
var resp ad.CreateResponse
err := clt.Post("2/ad/create/", req, &resp, accessToken)
if err != nil {
return 0, err
}
return resp.Data.AdID, nil
}
232 changes: 232 additions & 0 deletions marketing-api/model/ad/create.go

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion marketing-api/model/audiencepackage/audience_package.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package audiencepackage

import "github.com/bububa/oceanengine/marketing-api/enum"

// AudiencePackage 定向包信息
type AudiencePackage struct {
// AdvertiserID 广告主ID
Expand All @@ -17,7 +19,7 @@ type AudiencePackage struct {
// ConvertedTimeDuration 过滤时间范围,详见, 【附录-过滤时间范围】,当过滤已转化用户类型选择"公司账户"时填写,教育行业专属,非教育行业不会生效
ConvertedTimeDuration string `json:"converted_time_duration,omitempty"`
// DeliveryRange 广告投放范围【附录:广告投放范围】
DeliverRange string `json:"deliver_range,omitempty"`
DeliverRange enum.AdDeliveryRange `json:"deliver_range,omitempty"`
// HideIfExists 已安装用户,0表示不限,1表示过滤,2表示定向;过滤表示投放时不给安装客户展示广告,支持应用推广;定向表示投放时给安装客户展示广告;投放时优先获取直达链接,无直达链接时使用应用包名进行投放;如果无直达链接或应用包名,定向安装选项实际不生效;定向仅对Android链接生效。
HideIfExists int `json:"hide_if_exists,omitempty"`
// Audience
Expand Down
3 changes: 2 additions & 1 deletion marketing-api/model/audiencepackage/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package audiencepackage
import (
"encoding/json"

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

Expand All @@ -18,7 +19,7 @@ type CreateRequest struct {
// LandingType 定向包推广类型
LandingType string `json:"landing_type,omitempty"`
// DeliveryRange 广告投放范围【附录:广告投放范围】
DeliverRange string `json:"deliver_range,omitempty"`
DeliverRange enum.AdDeliveryRange `json:"deliver_range,omitempty"`
// HideIfExists 已安装用户,0表示不限,1表示过滤,2表示定向;过滤表示投放时不给安装客户展示广告,支持应用推广;定向表示投放时给安装客户展示广告;投放时优先获取直达链接,无直达链接时使用应用包名进行投放;如果无直达链接或应用包名,定向安装选项实际不生效;定向仅对Android链接生效。
HideIfExists int `json:"hide_if_exists,omitempty"`
}
Expand Down
3 changes: 2 additions & 1 deletion marketing-api/model/audiencepackage/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/url"
"strconv"

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

Expand All @@ -25,7 +26,7 @@ type GetFiltering struct {
// LandingType 定向包类型
LandingType string `json:"landing_type,omitempty"`
// DeliveryRange 广告投放范围
DeliveryRange string `json:"delivery_range,omitempty"`
DeliveryRange enum.AdDeliveryRange `json:"delivery_range,omitempty"`
}

// Encode implement GetRequest interface
Expand Down

0 comments on commit 1035cbd

Please sign in to comment.