-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"` | ||
} |