Skip to content

Commit

Permalink
Merge branch 'release/v1.6.39'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed May 11, 2022
2 parents d2eda37 + 75d1b6c commit 83533a2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
- 转化回传 [ Conversion(req *conversion.Request) error ]
- 工具
- 查询工具
- 查询在投计划配额 [ tools.QuotaGet(clt *core.SDKClient, accessToken string, req *tools.QuotaGetRequest) (*tools.QuotaGetResult, error) ]
- 查询受众预估结果 [ tools.EstimateAudience(clt *core.SDKClient, accessToken string, req *tools.EstimateAudienceRequest) (*tools.EstimateAudienceResponseData, error) ]
- 建议日预算及预期成本 [ BidSuggest(clt *core.SDKClient, accessToken string, req *tools.BidSuggestRequest) (*tools.BidSuggest, error) ]
- 日志查询 [ tools/log.Search(clt *core.SDKClient, accessToken string, req *log.SearchRequest) (*log.SearchResponseData, error) ]
Expand Down
16 changes: 16 additions & 0 deletions marketing-api/api/tools/quota_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package tools

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

// QuotaGet 查询在投计划配额
// 该接口用于查询广告账户的在投计划配额和使用进度
func QuotaGet(clt *core.SDKClient, accessToken string, req *tools.QuotaGetRequest) (*tools.QuotaGetResult, error) {
var resp tools.QuotaGetResponse
if err := clt.Get("2/tools/quota/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
43 changes: 43 additions & 0 deletions marketing-api/model/tools/quota_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package tools

import (
"net/url"
"strconv"

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

// QuotaGetRequest 查询在投计划配额 API Request
type QuotaGetRequest struct {
// AdvertiserID 广告账户id
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// CampaignType 广告组类型,FEED:信息流 SEARCH:搜索广告
CampaignType enum.CampaignType `json:"campaign_type,omitempty"`
}

// Encode implement GetRequest interface
func (r QuotaGetRequest) Encode() string {
values := &url.Values{}
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
values.Set("campaign_type", string(r.CampaignType))
return values.Encode()
}

// QuotaGetResponse 查询在投计划配额 API Response
type QuotaGetResponse struct {
model.BaseResponse
Data *QuotaGetResult `json:"data,omitempty"`
}

// QuotaGetResult
type QuotaGetResult struct {
// UsedQuota 在投计划数
UsedQuota int64 `json:"used_quota,omitempty"`
// SumQuota 在投计划配额
SumQuota int64 `json:"sum_quota,omitempty"`
// InLearning 是否在学习期
InLearning bool `json:"in_learning,omitempty"`
// MaxCost 最高月消耗
MaxCost int64 `json:"max_cost,omitempty"`
}

0 comments on commit 83533a2

Please sign in to comment.