Skip to content

Commit

Permalink
Merge branch 'release/v1.20.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Oct 23, 2023
2 parents de87a02 + 9d0efcd commit 8b51e02
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 1 deletion.
12 changes: 12 additions & 0 deletions marketing-api/api/qianchuan/aweme/order_budget_add.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package aweme

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

// OrderBudgetAdd 追加随心推订单预算
// 可以使用该接口进行投放中订单的续费和续期操作
func OrderBudgetAdd(clt *core.SDKClient, accessToken string, req *aweme.OrderBudgetAddRequest) error {
return clt.Post("v1.0/qianchuan/aweme/order/budget/add/", req, nil, accessToken)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package aweme

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

// OrderSuggestDeliveryTimeGet 获取建议延长时长
// 在追加随心推订单预算时,支持该订单的获取建议投放时长
func OrderSuggestDeliveryTimeGet(clt *core.SDKClient, accessToken string, req *aweme.OrderSuggestDeliveryTimeGetRequest) (float64, error) {
var resp aweme.OrderSuggestDeliveryTimeGetResponse
if err := clt.Get("v1.0/qianchuan/aweme/order/suggest/delivery_time/get/", req, &resp, accessToken); err != nil {
return 0, err
}
return resp.Data.SuggestDeliveryTime, nil
}
4 changes: 3 additions & 1 deletion marketing-api/model/qianchuan/aweme/delivery_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ type DeliverySetting struct {
// AD_CONVERT_TYPE_SHOPPING: 商品购买
// AD_CONVERT_TYPE_LIVE_ROI: 商品支付ROI
ExternalAction qianchuan.ExternalAction `json:"external_action,omitempty"`
// DeliveryTime 期望曝光时长,允许值:0.5、1、1.5、2、2.5、3、3.5、4、4.5、5、5.5、6、12、24注意:当营销目标为VIDEO_PROM_GOODS时,仅支持2、6、12、24
// 期望曝光时长,允许值:
// 当营销目标为VIDEO_PROM_GOODS时,支持2、6、12、24、72、120
// 当营销目标为LIVE_PROM_GOODS时,支持0.5、1、1.5、2、2.5、3、3.5、4、4.5、5、5.5、6、12、24
DeliveryTime float64 `json:"delivery_time,omitempty"`
// BidMode 出价模式,可选值:
// PRICING_ACTION: 按优化目标出价
Expand Down
22 changes: 22 additions & 0 deletions marketing-api/model/qianchuan/aweme/order_budget_add.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package aweme

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

// OrderBudgetAddRequest 追加随心推订单预算 API Request
type OrderBudgetAddRequest struct {
// AdvertiserID 广告主id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// OrderID 需要追加预算的订单id
OrderID uint64 `json:"order_id,omitempty"`
// RenewalBudget 追加的预算
RenewalBudget float64 `json:"renewal_budget,omitempty"`
// RenewvalDeliverySeconds 延长的投放时间
// 短视频订单,0-7天(步进单位为1天)
// 直播订单,0-24小时(步进单位为0.5小时)
RenewvalDeliverySeconds float64 `json:"renewval_delivery_seconds,omitempty"`
}

// Encode implement PostRequest interface
func (r OrderBudgetAddRequest) Encode() []byte {
return util.JSONMarshal(r)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package aweme

import (
"strconv"

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

// OrderSuggestDeliveryTimeGetRequest 获取建议延长时长 API Request
type OrderSuggestDeliveryTimeGetRequest struct {
// AdvertiserID 广告主id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// OrderID 需要追加预算的订单id
OrderID uint64 `json:"order_id,omitempty"`
// AddAmount 追加的预算
AddAmount float64 `json:"add_amount,omitempty"`
}

// Encode implement GetRequest interface
func (r OrderSuggestDeliveryTimeGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("order_id", strconv.FormatUint(r.OrderID, 10))
values.Set("add_amount", strconv.FormatFloat(r.AddAmount, 'f', -1, 64))
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// OrderSuggestDeliveryTimeGetResponse 获取建议延长时长 API Response
type OrderSuggestDeliveryTimeGetResponse struct {
model.BaseResponse
Data struct {
// SuggestDeliveryTime 建议追加投放时长
// 短视频:xx天
// 直播:xx小时
SuggestDeliveryTime float64 `json:"suggest_delivery_time,omitempty"`
} `json:"data,omitempty"`
}

0 comments on commit 8b51e02

Please sign in to comment.