-
Notifications
You must be signed in to change notification settings - Fork 45
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
20 changed files
with
496 additions
and
18 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
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 advertiser | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/qianchuan/advertiser" | ||
) | ||
|
||
// BalanceGet 获取账户余额 | ||
// 获取账户余额,包含通用,竞价,品牌余额 | ||
func BalanceGet(clt *core.SDKClient, accessToken string, req *advertiser.BalanceGetRequest) (*advertiser.Balance, error) { | ||
var resp advertiser.BalanceGetResponse | ||
if err := clt.Get("v1.0/qianchuan/account/balance/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,11 @@ | ||
package nativeanchor | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/nativeanchor" | ||
) | ||
|
||
// Delete 删除原生锚点 | ||
func Delete(clt *core.SDKClient, accessToken string, req *nativeanchor.DeleteRequest) error { | ||
return clt.Post("v3.0/native_anchor/delete/", req, nil, accessToken) | ||
} |
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,17 @@ | ||
package nativeanchor | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/nativeanchor" | ||
) | ||
|
||
// GetDetail 获取原生锚点详情 | ||
// 根据锚点唯一id,获取到锚点详情,支持查询账户下锚点的详情(包括被共享和自有锚点) | ||
// 暂不支持获取「高级在线预约」、「字节小程序」锚点详情 | ||
func GetDetail(clt *core.SDKClient, accessToken string, req *nativeanchor.GetDetailRequest) (*nativeanchor.GetDetailResult, error) { | ||
var resp nativeanchor.GetDetailResponse | ||
if err := clt.Get("v3.0/native_anchor/get/detail/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
18 changes: 18 additions & 0 deletions
18
marketing-api/api/tools/nativeanchor/qrcode_preview_get.go
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,18 @@ | ||
package nativeanchor | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/nativeanchor" | ||
) | ||
|
||
// QrcodePreviewGet 批量获取锚点预览url | ||
// 获取锚点的预览链接,您需将返回的预览url转成二维码,使用抖音APP扫码才可预览 | ||
// 预览url在您请求接口时生成,可预览多次,有效期24小时 | ||
// 只有当锚点关联广告时,才可查询到预览url | ||
func QrcodePreviewGet(clt *core.SDKClient, accessToken string, req *nativeanchor.QrcodePreviewGetRequest) (*nativeanchor.QrcodePreviewGetResult, error) { | ||
var resp nativeanchor.QrcodePreviewGetResponse | ||
if err := clt.Get("v3.0/native_anchor/qrcode_preview/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,15 @@ | ||
package nativeanchor | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/nativeanchor" | ||
) | ||
|
||
// Update 更新原生锚点 | ||
func Update(clt *core.SDKClient, accessToken string, req *nativeanchor.UpdateRequest) (*nativeanchor.UpdateResponseData, error) { | ||
var resp nativeanchor.UpdateResponse | ||
if err := clt.Post("v3.0/native_anchor/update/", 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
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,11 @@ | ||
package enum | ||
|
||
// AnchorShareType 锚点共享关系 | ||
type AnchorShareType string | ||
|
||
const ( | ||
// AnchorShareType_OWN_ANCHOR 自有锚点 | ||
AnchorShareType_OWN_ANCHOR AnchorShareType = "OWN_ANCHOR" | ||
// AnchorShareType_SHARE_ANCHOR 共享锚点 | ||
AnchorShareType_SHARE_ANCHOR AnchorShareType = "SHARE_ANCHOR" | ||
) |
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,17 @@ | ||
package enum | ||
|
||
// NetServiceType 推广内容 | ||
type NetServiceType string | ||
|
||
const ( | ||
// NetServiceType_GENERAL 常规应用下载 | ||
NetServiceType_GENERAL NetServiceType = "GENERAL" | ||
// NetServiceType_WECHAT_PACKAGE 跳转场景=添加微信号 | ||
NetServiceType_WECHAT_PACKAGE NetServiceType = "WECHAT_PACKAGE" | ||
// NetServiceType_MICRO_APP 跳转场景=进入微信小程序 | ||
NetServiceType_MICRO_APP NetServiceType = "MICRO_APP" | ||
// NetServiceType_WECOM_PACKAGE 跳转场景=企业微信客服 | ||
NetServiceType_WECOM_PACKAGE NetServiceType = "WECOM_PACKAGE" | ||
// NetServiceType_QUICK_APP 快应用 | ||
NetServiceType_QUICK_APP NetServiceType = "QUICK_APP" | ||
) |
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,17 @@ | ||
package enum | ||
|
||
// PrivateChatAnchorButton 按钮文案,可选私信商家、立即咨询、咨询顾问、咨询设计师、问问老师 | ||
type PrivateChatAnchorButton string | ||
|
||
const ( | ||
// PrivateChatAnchorButton_PRIVATE_MESSAGE 私信商家 | ||
PrivateChatAnchorButton_PRIVATE_MESSAGE PrivateChatAnchorButton = "PRIVATE_MESSAGE" | ||
// PrivateChatAnchorButton_CONSULT_NOW 立即咨询 | ||
PrivateChatAnchorButton_CONSULT_NOW PrivateChatAnchorButton = "CONSULT_NOW" | ||
// PrivateChatAnchorButton_CONSULT_ADVISOR 咨询顾问 | ||
PrivateChatAnchorButton_CONSULT_ADVISOR PrivateChatAnchorButton = "CONSULT_ADVISOR" | ||
// PrivateChatAnchorButton_CONSULT_DESIGNER 咨询设计师 | ||
PrivateChatAnchorButton_CONSULT_DESIGNER PrivateChatAnchorButton = "CONSULT_DESIGNER" | ||
// PrivateChatAnchorButton_ASK_TEACHER 问问老师 | ||
PrivateChatAnchorButton_ASK_TEACHER PrivateChatAnchorButton = "ASK_TEACHER" | ||
) |
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,72 @@ | ||
package advertiser | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// BalanceGetRequest 获取账户余额 API Request | ||
type BalanceGetRequest struct { | ||
// AdvertiserID 广告主ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
} | ||
|
||
// Encode implement GetRequest interface | ||
func (r BalanceGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// BalanceGetResponse 获取账户余额 API Response | ||
type BalanceGetResponse struct { | ||
model.BaseResponse | ||
Data *Balance `json:"data,omitempty"` | ||
} | ||
|
||
type Balance struct { | ||
// AdvertiserID 广告主ID或代理商ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AccountTotal 账户总余额 | ||
AccountTotal float64 `json:"account_total,omitempty"` | ||
// AccountValid 账户可用总余额 | ||
AccountValid float64 `json:"account_valid,omitempty"` | ||
// AccountFrozen 账户冻结总余额 | ||
AccountFrozen float64 `json:"account_frozen,omitempty"` | ||
// AccountGeneralTotal 通用总余额 | ||
AccountGeneralTotal float64 `json:"account_general_total,omitempty"` | ||
// AccountGeneralValid 通用可用余额 | ||
AccountGeneralValid float64 `json:"account_general_valid,omitempty"` | ||
// AccountGeneralFrozen 通用冻结余额 | ||
AccountGeneralFrozen float64 `json:"account_general_frozen,omitempty"` | ||
// AccountBiddingTotal 竞价总余额 | ||
AccountBiddingTotal float64 `json:"account_bidding_total,omitempty"` | ||
// AccountBiddingValid 竞价可用余额 | ||
AccountBiddingValid float64 `json:"account_bidding_valid,omitempty"` | ||
// AccountBiddingFrozen 竞价冻结余额 | ||
AccountBiddingFrozen float64 `json:"account_bidding_frozen,omitempty"` | ||
// AccountBrandTotal 账户品牌总余额 | ||
AccountBrandTotal float64 `json:"account_brand_total,omitempty"` | ||
// AccountBrandValid 账户品牌可用余额 | ||
AccountBrandValid float64 `json:"account_brand_valid,omitempty"` | ||
// AccountBrandFrozen 账户品牌冻结余额 | ||
AccountBrandFrozen float64 `json:"account_brand_frozen,omitempty"` | ||
// ShareGrantTotal 总共享赠款 | ||
ShareGrantTotal float64 `json:"share_grant_total,omitempty"` | ||
// ShareWalletGeneralValid 共享钱包通用可用余额 | ||
ShareWalletGeneralValid float64 `json:"share_wallet_general_valid,omitempty"` | ||
// ShareWalletBiddingValid 共享钱包竞价可用余额 | ||
ShareWalletBiddingValid float64 `json:"share_wallet_bidding_valid,omitempty"` | ||
// ShareWalletBrandValid 共享钱包品牌可用余额 | ||
ShareWalletBrandValid float64 `json:"share_wallet_brand_valid,omitempty"` | ||
// ShareWalletID 共享钱包id | ||
ShareWalletID string `json:"share_wallet_id,omitempty"` | ||
// ShareWalletName 共享钱包名称 | ||
ShareWalletName string `json:"share_wallet_name,omitempty"` | ||
// ShareWalletTotal 共享钱包可用总余额 | ||
ShareWalletTotal float64 `json:"share_wallet_total,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
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,21 @@ | ||
package nativeanchor | ||
|
||
import ( | ||
"github.com/bububa/oceanengine/marketing-api/enum" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// DeleteRequest 删除原生锚点 API Request | ||
type DeleteRequest struct { | ||
// AdvertiserID 广告主ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AnchorID 原生锚点ID | ||
AnchorID string `json:"anchor_id,omitempty"` | ||
// AnchorType 原生锚点类型 | ||
AnchorType enum.AnchorType `json:"anchor_type,omitempty"` | ||
} | ||
|
||
// Encode implement PostRequest interface | ||
func (r DeleteRequest) Encode() []byte { | ||
return util.JSONMarshal(r) | ||
} |
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,67 @@ | ||
package nativeanchor | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/enum" | ||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// GetDetailRequest 获取原生锚点详情 API Request | ||
type GetDetailRequest struct { | ||
// AdvertiserID 广告主账户ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// AnchorIDs 锚点id列表,list长度为20,注意只允许传入同一类(anchor_type)查询详情,否则报错 | ||
// 您可从「获取原生锚点列表」获取锚点的anchor_type | ||
AnchorIDs []string `json:"anchor_ids,omitempty"` | ||
// AnchorType 锚点类型,同时只能查询一种锚点类型,可选值: | ||
// APP_GAME游戏 | ||
// APP_INTERNET_SERVICE网服 | ||
// APP_SHOP 电商 | ||
// PRIVATE_CHAT 咨询 | ||
// SHOPPING_CART 购物 | ||
// INSURANCE外跳锚点 | ||
AnchorType enum.AnchorType `json:"anchor_type,omitempty"` | ||
} | ||
|
||
// Encode implement GetRequest interface | ||
func (r GetDetailRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("anchor_ids", string(util.JSONMarshal(r.AnchorIDs))) | ||
values.Set("anchor_type", string(r.AnchorType)) | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// GetDetailResponse 获取原生锚点详情 API Response | ||
type GetDetailResponse struct { | ||
model.BaseResponse | ||
Data *GetDetailResult `json:"data,omitempty"` | ||
} | ||
|
||
type GetDetailResult struct { | ||
// List 锚点详情列表 | ||
List []NativeAnchor `json:"list,omitempty"` | ||
// ErrorList 查询失败的锚点及查询失败原因 | ||
ErrorList []Error `json:"error_list,omitempty"` | ||
} | ||
|
||
type Error struct { | ||
// AnchorID 锚点id | ||
AnchorID string `json:"anchor_id,omitempty"` | ||
// Message 查询失败的原因 | ||
Message string `json:"message,omitempty"` | ||
// ErrorMessage 查询失败的原因 | ||
ErrorMessage string `json:"error_message,omitempty"` | ||
} | ||
|
||
func (e Error) Error() string { | ||
message := e.Message | ||
if e.ErrorMessage != "" { | ||
message = e.ErrorMessage | ||
} | ||
return util.StringsJoin("锚点ID: ", e.AnchorID, ", 错误信息: ", message) | ||
} |
Oops, something went wrong.