Skip to content

Commit

Permalink
Merge branch 'release/v1.21.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Nov 14, 2023
2 parents 9c0f0d5 + 01df0f9 commit 6199060
Show file tree
Hide file tree
Showing 17 changed files with 479 additions and 6 deletions.
4 changes: 4 additions & 0 deletions marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
- 批量上传资质附件 [ AttachmentUpload(clt *core.SDKClient, accessToken string, req *advertiser.AttachmentUploadRequest) (uint64, error)]
- 投放资质查询 [ DeliveryQualificationList(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryQualificationListRequest) (*advertiser.DeliveryQualificationListData, error) ]
- 投放资质提交 [ DeliveryQualificationSubmit(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryQualificationSubmitRequest) error ]
- 查询推广产品资质规则配置 [ DeliveryPkgConfig(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryPkgConfigRequest) (*advertiser.IndustryConfig, error) ]
- 查询推广产品资质 [ DeliveryPkgGet(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryPkgGetRequest) (*advertiser.DeliveryPkg, error) ]
- 提交/编辑推广产品资质 [ DeliveryPkgSubmit(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryPkgSubmitRequest) (*advertiser.DeliveryPkgSubmitResult, error) ]
- 代理商账号管理 (api/agent)
- 广告主列表 [ AdvertiserSelect(clt *core.SDKClient, accessToken string, req *agent.AdvertiserSelectRequest) (*agent.AdvertiserSelectResponseData, error) ]
- 修改广告主 [ AdvertiserUpdate(clt *core.SDKClient, accessToken string, req *agent.AdvertiserUpdateRequest) (*agent.AdvertiserUpdateResponseData, error) ]
Expand Down Expand Up @@ -215,6 +218,7 @@
- 创建素材清理任务 [ VideoMaterialClearTaskCreate(clt *core.SDKClient, accessToken string, req *file.VideoMaterialClearTaskCreateRequest) (uint64, error) ]
- 获取清理任务列表 [ VideoMaterialClearTaskGet(clt *core.SDKClient, accessToken string, req *file.VideoMaterialClearTaskGetRequest) (*file.VideoMaterialClearTaskGetData, error) ]
- 下载清理任务结果 [ VideoMaterialClearTaskResultGet(clt *core.SDKClient, accessToken string, req *file.VideoMaterialClearTaskResultGetRequest) (*file.VideoMaterialClearTaskResultGetData, error) ]
- 上传图文内的音频素材 [ AudioAd(clt *core.SDKClient, accessToken string, req *file.AudioAdRequest) (*file.Audio, error) ]
- 上传图集 [ CarouselCreate(clt *core.SDKClient, accessToken string, req *file.CarouselCreateRequest) (*file.Carousel, error) ]
- 获取图集素材 [ CarouselList(clt *core.SDKClient, accessToken string, req *file.CarouselListRequest) (*file.CarouselListResult, error) ]
- 更新图集信息 [ CarouselUpdate(clt *core.SDKClient, accessToken string, req *file.CarouselUpdateRequest) ([]file.CarouselUpdateResult, error) ]
Expand Down
16 changes: 16 additions & 0 deletions marketing-api/api/advertiser/delivery_pkg_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package advertiser

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

// DeliveryPkgConfig 查询推广产品资质规则配置
// 根据商业化行业获取不同行业下对应的资质提交规则。需注意:每个行业下的资质提交规则可能会因平台及外部监管的要求而发生变化,当规则发生变更时,规则的版本号+1
func DeliveryPkgConfig(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryPkgConfigRequest) (*advertiser.IndustryConfig, error) {
var resp advertiser.DeliveryPkgConfigResponse
if err := clt.Get("v3.0/advertiser/delivery_pkg_config/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.IndustryConfig, nil
}
16 changes: 16 additions & 0 deletions marketing-api/api/advertiser/delivery_pkg_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package advertiser

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

// DeliveryPkgGet 查询推广产品资质
// 用于查询广告主以推广产品形式提交的投放资质,可以获取到资质审核状态等信息
func DeliveryPkgGet(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryPkgGetRequest) (*advertiser.DeliveryPkg, error) {
var resp advertiser.DeliveryPkgGetResponse
if err := clt.Get("v3.0/advertiser/delivery_pkg/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.DeliveryPkg, nil
}
16 changes: 16 additions & 0 deletions marketing-api/api/advertiser/delivery_pkg_submit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package advertiser

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

// DeliveryPkgSubmit 提交/编辑推广产品资质
// 用于提交以推广产品形式整组提交的投放资质,该接口可以同时用于新增和编辑。针对审核不通过的推广产品资质支持编辑提交
func DeliveryPkgSubmit(clt *core.SDKClient, accessToken string, req *advertiser.DeliveryPkgSubmitRequest) (*advertiser.DeliveryPkgSubmitResult, error) {
var resp advertiser.DeliveryPkgSubmitResponse
if err := clt.Post("v3.0/advertiser/delivery_pkg/submit/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
16 changes: 16 additions & 0 deletions marketing-api/api/file/audio_ad.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package file

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

// AudioAd 上传图文内的音频素材
// 通过此接口,用户可以上传和广告相关的音频图片,例如图文中的音频。
func AudioAd(clt *core.SDKClient, accessToken string, req *file.AudioAdRequest) (*file.Audio, error) {
var resp file.AudioAdResponse
if err := clt.Upload("2/file/video/ad/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.AudioInfo, nil
}
17 changes: 17 additions & 0 deletions marketing-api/enum/delivery_pkg_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package enum

// DeliveryPkgStatus 推广产品整组的审核状态,标识该推广产品是否审核通过
type DeliveryPkgStatus string

const (
// DeliveryPkgStatus_STATUS_CONFIRM 审核通过
DeliveryPkgStatus_STATUS_CONFIRM DeliveryPkgStatus = "STATUS_CONFIRM"
// DeliveryPkgStatus_STATUS_CONFIRM_FAIL 审核不通过
DeliveryPkgStatus_STATUS_CONFIRM_FAIL DeliveryPkgStatus = "STATUS_CONFIRM_FAIL"
// DeliveryPkgStatus_STATUS_NOT_SUBMIT 未提交
DeliveryPkgStatus_STATUS_NOT_SUBMIT DeliveryPkgStatus = "STATUS_NOT_SUBMIT"
// DeliveryPkgStatus_STATUS_PENDING_CONFIRM 审核中
DeliveryPkgStatus_STATUS_PENDING_CONFIRM DeliveryPkgStatus = "STATUS_PENDING_CONFIRM"
// DeliveryPkgStatus_STATUS_WAIT_CONFIRM 待审核
DeliveryPkgStatus_STATUS_WAIT_CONFIRM DeliveryPkgStatus = "STATUS_WAIT_CONFIRM"
)
11 changes: 11 additions & 0 deletions marketing-api/enum/industry_config_rule_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package enum

// IndustryConfigRuleType 规则的资质组成类型
type IndustryConfigRuleType string

const (
// IndustryConfigRuleType_CHOICE 选择(资质规则内资质类型任选>1个类型填写提交)
IndustryConfigRuleType_CHOICE IndustryConfigRuleType = "CHOICE"
// IndustryConfigRuleType_COMPOSE 组合(资质规则内资质类型必须全部填写提交)
IndustryConfigRuleType_COMPOSE IndustryConfigRuleType = "COMPOSE"
)
11 changes: 11 additions & 0 deletions marketing-api/enum/industry_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package enum

// IndustryStatus 行业状态
type IndustryStatus string

const (
// IndystryStatus_NONVALID 禁投
IndystryStatus_NONVALID IndustryStatus = "NONVALID"
// IndustryStatus_VALID 生效
IndustryStatus_VALID IndustryStatus = "VALID"
)
89 changes: 89 additions & 0 deletions marketing-api/model/advertiser/delivery_pkg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package advertiser

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

// DeliveryPkg 推广产品资质信息
type DeliveryPkg struct {
// PkgID 推广产品组id
PkgID uint64 `json:"pkg_id,omitempty"`
// ConfigID 来自【推广产品资质规则配置查询接口】,行业的资质规则中的config_id
ConfigID uint64 `json:"config_id,omitempty"`
// ProductName 用户提交的推广产品名称
ProductName string `json:"product_name,omitempty"`
// Status 推广产品整组的审核状态,标识该推广产品是否审核通过 可选值:
// STATUS_CONFIRM 审核通过
// STATUS_CONFIRM_FAIL 审核不通过
// STATUS_NOT_SUBMIT 未提交
// STATUS_PENDING_CONFIRM 审核中
// STATUS_WAIT_CONFIRM 待审核
Status enum.DeliveryPkgStatus `json:"status,omitempty"`
// IndustryID 一级到三级行业id
IndustryID []uint64 `json:"industry_id,omitempty"`
// IndustryName 一级到三级行业名称
IndustryName []string `json:"industry_name,omitempty"`
// NecessaryCombine 必填资质模块
NecessaryCombine []DeliveryPkgCombine `json:"necessary_combine,omitempty"`
// UnnecessaryCombine 选填资质模块
UnnecessaryCombine []DeliveryPkgCombine `json:"unnecessary_combine,omitempty"`
// Permission 权限信息
Permission *DeliveryPkgPermission `json:"permission,omitempty"`
}

// DeliveryPkgCombine 资质模块
type DeliveryPkgCombine struct {
// CombineID 推广类型id,来自【推广产品资质规则配置查询接口】,行业的资质规则中的promotion_type_id
CombineID uint64 `json:"combine_id,omitempty"`
// Description 推广类型描述
Description string `json:"description,omitempty"`
// DeliveryRules 资质规则
DeliveryRules []DeliveryRule `json:"delivery_rules,omitempty"`
}

// DeliveryRules 资质规则
type DeliveryRule struct {
// RuleID 原子规则id
RuleID uint64 `json:"rule_id,omitempty"`
// Deliveries 资质的具体信息
Deliveries []Delivery `json:"deliveries,omitempty"`
}

// Delivery 资质的具体信息
type Delivery struct {
// QualificationID 资质id
QualificationID uint64 `json:"qualification_id,omitempty"`
// QualType 资质类型id
QualType uint64 `json:"qual_type,omitempty"`
// QualTypeName 资质类型名称
QualTypeName string `json:"qual_type_name,omitempty"`
// Status 资质审核状态 可选值:
// STATUS_CONFIRM 审核通过
// STATUS_CONFIRM_FAIL 审核不通过
// STATUS_NOT_SUBMIT 未提交
// STATUS_PENDING_CONFIRM 审核中
// STATUS_WAIT_CONFIRM 待审核
Status enum.DeliveryPkgStatus `json:"status,omitempty"`
// Attachments 资质图片附件
Attachments []DeliveryAttachment `json:"attachments,omitempty"`
// RejectReason 拒绝理由,若资质被拒绝,则会有拒绝理由
RejectReason string `json:"reject_reason,omitempty"`
}

// DeliveryAttachment 资质图片附件
type DeliveryAttachment struct {
// AttachmentID 附件id
AttachmentID uint64 `json:"attachment_id,omitempty"`
// PictureURL 图片链接
PictureURL string `json:"picture_url,omitempty"`
}

// DeliveryPkgPermission 权限信息
type DeliveryPkgPermission struct {
// CanEdit 是否支持编辑
CanEdit bool `json:"can_edit,omitempty"`
// CantEditReason 不支持编辑的原因
CantEditReason string `json:"cant_edit_reason,omitempty"`
// CanDelete 是否支持删除
CanDelete bool `json:"can_delete,omitempty"`
// CantDeleteReason 不支持删除的原因
CantDeleteReason string `json:"cant_delete_reason,omitempty"`
}
41 changes: 41 additions & 0 deletions marketing-api/model/advertiser/delivery_pkg_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package advertiser

import (
"strconv"

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

// DeliveryPkgConfigRequest 查询推广产品资质规则配置 API Request
type DeliveryPkgConfigRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// FirstIndustryID 一级行业id
FirstIndustryID uint64 `json:"first_industry_id,omitempty"`
// SecondIndustryID 二级行业id
SecondIndustryID uint64 `json:"second_industry_id,omitempty"`
// ThirdIndustryID 三级行业id
ThirdIndustryID uint64 `json:"third_industry_id,omitempty"`
}

// Encode implement GetRequest interface
func (r DeliveryPkgConfigRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("first_industry_id", strconv.FormatUint(r.FirstIndustryID, 10))
values.Set("second_industry_id", strconv.FormatUint(r.SecondIndustryID, 10))
values.Set("third_industry_id", strconv.FormatUint(r.ThirdIndustryID, 10))
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// DeliveryPkgConfigResponse 查询推广产品资质规则配置 API Response
type DeliveryPkgConfigResponse struct {
model.BaseResponse
Data struct {
// IndustryConfig 资质规则
IndustryConfig *IndustryConfig `json:"industry_config,omitempty"`
} `json:"data,omitempty"`
}
36 changes: 36 additions & 0 deletions marketing-api/model/advertiser/delivery_pkg_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package advertiser

import (
"strconv"

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

// DeliveryPkgGetRequest 查询推广产品资质 API Request
type DeliveryPkgGetRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// PkgID 推广产品组id,是推广产品的组标识
PkgID uint64 `json:"pkg_id,omitempty"`
}

// Encode implement GetRequest interface
func (r DeliveryPkgGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("pkg_id", strconv.FormatUint(r.PkgID, 10))
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// DeliveryPkgGetResponse 查询推广产品资质 API Response
type DeliveryPkgGetResponse struct {
model.BaseResponse
// Data json返回值
Data struct {
// DeliveryPkg 推广产品资质信息
DeliveryPkg *DeliveryPkg `json:"delivery_pkg,omitempty"`
} `json:"data,omitempty"`
}
32 changes: 32 additions & 0 deletions marketing-api/model/advertiser/delivery_pkg_submit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package advertiser

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

// DeliveryPkgSubmitRequest 提交推广产品资质 API Request
type DeliveryPkgSubmitRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// DeliveryPkg 推广产品资质信息
DeliveryPkg *DeliveryPkg `json:"delivery_pkg,omitempty"`
}

// Encode implement PostRequest interface
func (r DeliveryPkgSubmitRequest) Encode() []byte {
return util.JSONMarshal(r)
}

// DeliverPkgSubmitResponse 提交推广产品资质 API Response
type DeliveryPkgSubmitResponse struct {
model.BaseResponse
Data *DeliveryPkgSubmitResult `json:"data,omitempty"`
}

type DeliveryPkgSubmitResult struct {
// PkgID 推广产品组id,可用于后续的查询或编辑
PkgID uint64 `json:"pkg_id,omitempty"`
// QualificationIDs 系统生成的资质id,每份资质对应一个id
QualificationIDs []uint64 `json:"qualification_ids,omitempty"`
}
63 changes: 63 additions & 0 deletions marketing-api/model/advertiser/industry_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package advertiser

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

// IndustryConfig 资质规则
type IndustryConfig struct {
// ConfigID 资质规则id
ConfigID uint64 `json:"config_id,omitempty"`
// IndustryStatus 行业状态:1 生效 、2 禁投(不允许提交该行业的资质) 可选值:
// NONVALID 禁投
// VALID 生效
IndustryStatus enum.IndustryStatus `json:"industry_status,omitempty"`
// IndustryIDs 第一级到第三级行业id
IndustryIDs []uint64 `json:"industry_ids,omitempty"`
// IndustryNames 第一级到第三级行业名称
IndustryNames []string `json:"industry_names,omitempty"`
// Necessaries 必填资质模块配置
Necessaries []IndustryConfigNecessary `json:"necessaries,omitempty"`
// Unnecessaries 选填资质模块配置
Unnecessaries []IndustryConfigUnnecessary `json:"unnecessaries,omitempty"`
}

// IndustryConfigNecessary 必填资质模块配置
type IndustryConfigNecessary struct {
// PromotionTypeID 推广类型id
PromotionTypeID uint64 `json:"promotion_type_id,omitempty"`
// PromotionTypeName 推广类名称
PromotionTypeName string `json:"promotion_type_name,omitempty"`
// Rules 具体的资质规则
Rules []IndustryConfigRule `json:"rules,omitempty"`
}

// IndustryConfigUnnecessary 选填资质模块配置
type IndustryConfigUnnecessary struct {
// CombineID 规则组合id
CombineID uint64 `json:"combine_id,omitempty"`
// Description 选填资质场景描述,用于引导用户提交
Description string `json:"description,omitempty"`
// Rules 具体的资质规则
Rules []IndustryConfigRule `json:"rules,omitempty"`
}

// IndustryConfigRule 具体的资质规则
type IndustryConfigRule struct {
// RuleID 原子规则id
RuleID uint64 `json:"rule_id,omitempty"`
// Type 规则的资质组成类型:1 组合资质 2 多选一资质 可选值:
// CHOICE 选择(资质规则内资质类型任选>1个类型填写提交)
// COMPOSE 组合(资质规则内资质类型必须全部填写提交)
Type enum.IndustryConfigRuleType `json:"type,omitempty"`
// Description 原子规则描述,用于引导用户提交
Description string `json:"description,omitempty"`
// QualTypes 资质类型
QualTypes []IndustryConfigQualType `json:"qual_types,omitempty"`
}

// IndustryConfigQualType 资质类型
type IndustryConfigQualType struct {
// QualType 资质类型id
QualType uint64 `json:"qual_type,omitempty"`
// QualTypeName 资质类型名称
QualTypeName string `json:"qual_type_name,omitempty"`
}
Loading

0 comments on commit 6199060

Please sign in to comment.