-
Notifications
You must be signed in to change notification settings - Fork 44
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
7 changed files
with
182 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 ad | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/ad" | ||
) | ||
|
||
// CompensateStatusGet 获取计划成本保障状态 | ||
func CompensateStatusGet(clt *core.SDKClient, accessToken string, req *ad.CompensateStatusGetRequest) ([]ad.CompensateStatus, error) { | ||
var resp ad.CompensateStatusGetResponse | ||
err := clt.Get("v1.0/qianchuan/ad/compensate_status/get/", req, &resp, accessToken) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return resp.Data.List, 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,16 @@ | ||
package ad | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/ad" | ||
) | ||
|
||
// LearningStatusGet 获取计划学习期状态 | ||
func LearningStatusGet(clt *core.SDKClient, accessToken string, req *ad.LearningStatusGetRequest) ([]ad.LearningStatus, error) { | ||
var resp ad.LearningStatusGetResponse | ||
err := clt.Get("v1.0/qianchuan/ad/learning_status/get/", req, &resp, accessToken) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return resp.Data.List, 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,29 @@ | ||
package qianchuan | ||
|
||
// CompensateRequestStatus 当前请求是否成功 | ||
type CompensateRequestStatus string | ||
|
||
const ( | ||
// CompensateRequestStatus_SUCCESS 查询成功 | ||
CompensateRequestStatus_SUCCESS CompensateRequestStatus = "SUCCESS" | ||
// CompensateRequestStatus_FAILED 查询失败,请重试 | ||
CompensateRequestStatus_FAILED CompensateRequestStatus = "FAILED" | ||
) | ||
|
||
// CompensateStatus 计划成本保障状态 | ||
type CompensateStatus string | ||
|
||
const ( | ||
// CompensateStatus_IN_EFFECT 成本保障生效中 | ||
CompensateStatus_IN_EFFECT CompensateStatus = "IN_EFFECT" | ||
// CompensateStatus_INVALID 成本保障已失效 | ||
CompensateStatus_INVALID CompensateStatus = "INVALID" | ||
// CompensateStatus_CONFIRMING 成本保障确认中 | ||
CompensateStatus_CONFIRMING CompensateStatus = "CONFIRMING" | ||
// CompensateStatus_PAID 成本保障已到账 | ||
CompensateStatus_PAID CompensateStatus = "PAID" | ||
// CompensateStatus_ENDED 成本保障已结束 | ||
CompensateStatus_ENDED CompensateStatus = "ENDED" | ||
// CompensateStatus_DEFAULT 无成本保障状态 | ||
CompensateStatus_DEFAULT CompensateStatus = "DEFAULT" | ||
) |
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,15 @@ | ||
package qianchuan | ||
|
||
// LearningStatus 学习期状态 | ||
type LearningStatus string | ||
|
||
const ( | ||
// LearningStatus_LEARNING 学习期 | ||
LearningStatus_LEARNING LearningStatus = "LEARNING" | ||
// LearningStatus_LEARNED 学习期结束 | ||
LearningStatus_LEARNED LearningStatus = "LEARNING" | ||
// LearningStatus_LEARN_FAILED 学习期失败 | ||
LearningStatus_LEARN_FAILED LearningStatus = "LEARN_FAILED" | ||
// LearningStatus_DEFAULT 无学习期状态 | ||
LearningStatus_DEFAULT LearningStatus = "DEFAULT" | ||
) |
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,56 @@ | ||
package ad | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/enum/qianchuan" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// CompensateStatusGetRequest 获取计划成本保障状态 API Request | ||
type CompensateStatusGetRequest struct { | ||
// AdvertiserID 广告主id | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AdIDs 计划id列表,每次最多传入50个 | ||
AdIDs []uint64 `json:"ad_ids,omitempty"` | ||
} | ||
|
||
func (r CompensateStatusGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("ad_ids", string(util.JSONMarshal(r.AdIDs))) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// CompensateStatusGetResponse 获取计划成本保障状态 API Response | ||
type CompensateStatusGetResponse struct { | ||
model.BaseResponse | ||
Data struct { | ||
List []CompensateStatus `json:"list,omitempty"` | ||
} `json:"data,omitempty"` | ||
} | ||
|
||
// CompensateStatus 计划成本保障状态 | ||
type CompensateStatus struct { | ||
// AdID 计划id | ||
AdID uint64 `json:"ad_id,omitempty"` | ||
// Status 当前请求是否成功, 枚举值: | ||
// SUCCESS: 查询成功 | ||
// FAILED: 查询失败,请重试 | ||
Status qianchuan.CompensateRequestStatus `json:"status,omitempty"` | ||
// CompensateStatus 计划成本保障状态,允许值 | ||
// IN_EFFECT: 成本保障生效中 | ||
// INVALID: 成本保障已失效 | ||
// CONFIRMING: 成本保障确认中 | ||
// PAID: 成本保障已到账 | ||
// ENDED: 成本保障已结束 | ||
// DEFAULT:无成本保障状态 | ||
CompensateStatus qianchuan.CompensateStatus `json:"compensate_status,omitempty"` | ||
// Reason 成本保障失效/结束原因 | ||
Reason string `json:"reason,omitempty"` | ||
// URL 赔付规则链接 | ||
URL string `json:"url,omitempty"` | ||
} |
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,48 @@ | ||
package ad | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/enum/qianchuan" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// LearningStatusGetRequest 获取计划学习期状态 API Request | ||
type LearningStatusGetRequest struct { | ||
// AdvertiserID 广告主id | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AdIDs 计划id列表,每次最多传入50个 | ||
AdIDs []uint64 `json:"ad_ids,omitempty"` | ||
} | ||
|
||
func (r LearningStatusGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("ad_ids", string(util.JSONMarshal(r.AdIDs))) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// LearningStatusGetResponse 获取计划学习期状态 API Response | ||
type LearningStatusGetResponse struct { | ||
model.BaseResponse | ||
Data struct { | ||
// List 计划列表 | ||
List []LearningStatus `json:"list,omitempty"` | ||
} `json:"data,omitempty"` | ||
} | ||
|
||
// LearingStatus 计划学习期状态 | ||
type LearningStatus struct { | ||
// AdID 计划id | ||
AdID uint64 `json:"ad_id,omitempty"` | ||
// Status 学习期状态,允许值: | ||
// LEARNING(学习期) | ||
// LEARNED(学习期结束) | ||
// LEARN_FAILED(学习期失败) | ||
// DEFAULT:无学习期状态 | ||
// 具体可以参考此文档的说明:关于学习期 | ||
Status qianchuan.LearningStatus `json:"status,omitempty"` | ||
} |