Skip to content

Commit

Permalink
Merge branch 'release/v1.21.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Jan 3, 2024
2 parents 76bf948 + 4abb804 commit f22fdae
Show file tree
Hide file tree
Showing 20 changed files with 496 additions and 18 deletions.
4 changes: 4 additions & 0 deletions marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,11 @@
- 查询优选起量任务数据 [ DataGet(clt *core.SDKClient, accessToken string, req *taskraise.DataGetRequest) (*taskraise.DataGetResponseData, error) ]
- 原生锚点管理 (tools/nativeanchor)
- 获取账户下原生锚点 [ Get(clt *core.SDKClient, accessToken string, req *nativeanchor.GetRequest) (*nativeanchor.GetResponseData, error) ]
- 获取原生锚点详情 [ GetDetail(clt *core.SDKClient, accessToken string, req *nativeanchor.GetDetailRequest) (*nativeanchor.GetDetailResult, error)]
- 批量获取锚点预览url [ QrcodePreviewGet(clt *core.SDKClient, accessToken string, req *nativeanchor.QrcodePreviewGetRequest) (*nativeanchor.QrcodePreviewGetResult, error) ]
- 原生锚点创建 [ Create(clt *core.SDKClient, accessToken string, req *nativeanchor.CreateRequest) (*nativeanchor.CreateResponseData, error) ]
- 更新原生锚点 [ Update(clt *core.SDKClient, accessToken string, req *nativeanchor.UpdateRequest) (*nativeanchor.UpdateResponseData, error) ]
- 删除原生锚点 [ Delete(clt *core.SDKClient, accessToken string, req *nativeanchor.DeleteRequest) error ]
- 微信小程序/小游戏管理 (tools/wechat)
- 获取微信小程序列表 [ AppletList(clt *core.SDKClient, accessToken string, req *wechat.AppletListRequest) (*wechat.AppletListResult, error) ]
- 获取微信小游戏列表 [ GameList(clt *core.SDKClient, accessToken string, req *wechat.GameListRequest) (*wechat.GameListResult, error) ]
Expand Down
1 change: 1 addition & 0 deletions marketing-api/QIANCHUAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- 获取千川账户类型 [ TypeGet(clt *core.SDKClient, accessToken string, req *advertiser.TypeGetRequest) ([]advertiser.Advertiser, error) ]
- 资金管理(api/qianchuan/finance)
- 获取账户钱包信息 [ WalletGet(clt *core.SDKClient, accessToken string, req *finance.WalletGetRequest) (*finance.Wallet, error) ]
- 获取账户余额 [ advertiser.BalanceGet(clt *core.SDKClient, accessToken string, req *advertiser.BalanceGetRequest) (*advertiser.Balance, error) ]
- 获取财务流水信息 [ DetailGet(clt *core.SDKClient, accessToken string, req *finance.DetailGetRequest) (*finance.DetailGetResult, error) ]
- 创建转账交易号(方舟) [ advertiser.FundTransferSeqCreate(clt *core.SDKClient, accessToken string, req *agent.FundTransferSeqCreateRequest) (string, error) ]
- 提交转账交易号(方舟) [ advertiser.FundTransferSeqCommit(clt *core.SDKClient, accessToken string, req *agent.FundTransferSeqCommitRequest) (string, error) ]
Expand Down
16 changes: 16 additions & 0 deletions marketing-api/api/qianchuan/advertiser/balance_get.go
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
}
11 changes: 11 additions & 0 deletions marketing-api/api/tools/nativeanchor/delete.go
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)
}
17 changes: 17 additions & 0 deletions marketing-api/api/tools/nativeanchor/get_detail.go
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 marketing-api/api/tools/nativeanchor/qrcode_preview_get.go
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
}
15 changes: 15 additions & 0 deletions marketing-api/api/tools/nativeanchor/update.go
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
}
6 changes: 0 additions & 6 deletions marketing-api/api/track/click.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ var DEFAULT_CLICK_FIELDS = []string{
"callback_url",
"model",
"union_site",
"caid1",
"caid2",
}

// Click 生成击检测链接
Expand Down Expand Up @@ -101,10 +99,6 @@ func Click(baseUrl string, fields []string, adVersion model.AdVersion) string {
values.Set("model", "__MODEL__")
case "union_site":
values.Set("union_site", "__UNION_SITE__")
case "caid1":
values.Set("caid1", "__CAID1__")
case "caid2":
values.Set("caid2", "__CAID2__")
}
}
parsedUrl.RawQuery = values.Encode()
Expand Down
11 changes: 11 additions & 0 deletions marketing-api/enum/anchor_share_type.go
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"
)
17 changes: 17 additions & 0 deletions marketing-api/enum/net_service_type.go
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"
)
17 changes: 17 additions & 0 deletions marketing-api/enum/private_chat_anchor_button.go
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"
)
2 changes: 2 additions & 0 deletions marketing-api/enum/qianchuan/ad_opt_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ const (
AdOptStatus_DISABLE AdOptStatus = "DISABLE"
// AdOptStatus_DELETE 删除
AdOptStatus_DELETE AdOptStatus = "DELETE"
// AdOptStatus_SYSTEM_DISABLE 系统暂停
AdOptStatus_SYSTEM_DISABLE AdOptStatus = "SYSTEM_DISABLE"
)
72 changes: 72 additions & 0 deletions marketing-api/model/qianchuan/advertiser/balance_get.go
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"`
}
4 changes: 4 additions & 0 deletions marketing-api/model/tools/aweme_auth_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type AwemeAuthListFilter struct {
// AuthStatus 授权状态, 可选值:
// AUTHRIZED: 授权中、AUTHRIZING: 待授权确认、INVALID: 授权失效
AuthStatus []enum.AwemeAuthStatus `json:"auth_status,omitempty"`
// AwemeIDs 按抖音号id过滤结果,最长传入50个
AwemeIDs []string `json:"aweme_ids,omitempty"`
// ItemIDs 按抖音视频id过滤结果,一次最多允许查询50个
ItemIDs []uint64 `json:"item_ids,omitempty"`
}

// Encode implement GetRequest interface
Expand Down
21 changes: 21 additions & 0 deletions marketing-api/model/tools/nativeanchor/delete.go
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)
}
67 changes: 67 additions & 0 deletions marketing-api/model/tools/nativeanchor/get_detail.go
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)
}
Loading

0 comments on commit f22fdae

Please sign in to comment.