Skip to content

Commit c1995ec

Browse files
authored
Merge pull request #77 from flowerbin/master
2 parents 6d3f1ba + a53a8b4 commit c1995ec

2 files changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package ebp
2+
3+
import (
4+
"context"
5+
6+
"github.com/bububa/oceanengine/marketing-api/core"
7+
"github.com/bububa/oceanengine/marketing-api/model/ebp"
8+
)
9+
10+
// AdvertiserList 获取升级版巨量引擎工作台下账户列表
11+
func AdvertiserList(ctx context.Context, clt *core.SDKClient, accessToken string, req *ebp.AdvertiserListRequest) (*ebp.AdvertiserListResponseData, error) {
12+
var resp ebp.AdvertiserListResponse
13+
if err := clt.Get(ctx, "2/ebp/advertiser/list/", req, &resp, accessToken); err != nil {
14+
return nil, err
15+
}
16+
return resp.Data, nil
17+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package ebp
2+
3+
import (
4+
"encoding/json"
5+
"strconv"
6+
7+
"github.com/bububa/oceanengine/marketing-api/model"
8+
"github.com/bububa/oceanengine/marketing-api/util"
9+
)
10+
11+
// https://open.oceanengine.com/labels/7/docs/1829550825614739?origin=left_nav
12+
13+
// AdvertiserSelectRequest 获取升级版巨量引擎工作台下账户列表 API Request
14+
type AdvertiserListRequest struct {
15+
// EnterpriseOrganizationID 升级版巨量引擎工作台ID【必填】
16+
EnterpriseOrganizationID uint64 `json:"enterprise_organization_id"`
17+
// AccountSource 账户类型【必填】
18+
// 枚举值:AD 巨量营销客户账号、LOCAL 本地推账户
19+
AccountSource string `json:"account_source"`
20+
// Filtering 过滤器
21+
Filtering *AdvertiserListFilter `json:"filtering,omitempty"`
22+
// Page 页码.默认值: 1
23+
Page int `json:"page,omitempty"`
24+
// PageSize 页面数据量[1,100].默认值: 10
25+
PageSize int `json:"page_size,omitempty"`
26+
}
27+
28+
// Encode implement GetRequest interface
29+
func (r AdvertiserListRequest) Encode() string {
30+
values := util.GetUrlValues()
31+
values.Set("enterprise_organization_id", strconv.FormatUint(r.EnterpriseOrganizationID, 10))
32+
values.Set("account_source", r.AccountSource)
33+
if r.Filtering != nil {
34+
bs, _ := json.Marshal(r.Filtering)
35+
values.Set("filtering", string(bs))
36+
}
37+
if r.Page > 1 {
38+
values.Set("page", strconv.Itoa(r.Page))
39+
}
40+
if r.PageSize > 0 {
41+
values.Set("page_size", strconv.Itoa(r.PageSize))
42+
}
43+
ret := values.Encode()
44+
util.PutUrlValues(values)
45+
return ret
46+
}
47+
48+
type AdvertiserListFilter struct {
49+
// AccountName 广告主名称
50+
AccountName string `json:"account_name,omitempty"`
51+
// ActiveAccount 是否是活跃账户
52+
ActiveAccount bool `json:"active_account,omitempty"`
53+
}
54+
55+
// AdvertiserListResponse 获取升级版巨量引擎工作台下账户列表 API Response
56+
type AdvertiserListResponse struct {
57+
model.BaseResponse
58+
// Data json返回值
59+
Data *AdvertiserListResponseData `json:"data,omitempty"`
60+
}
61+
62+
// AdvertiserListResponseData json返回值
63+
type AdvertiserListResponseData struct {
64+
// AccountList 广告主账户列表
65+
AccountList []AdvertiserListResponseAccount `json:"account_list,omitempty"`
66+
// PageInfo 分页信息
67+
PageInfo *model.PageInfo `json:"page_info,omitempty"`
68+
}
69+
70+
type AdvertiserListResponseAccount struct {
71+
// AccountID 账户id
72+
AccountID uint64 `json:"account_id,omitempty"`
73+
// AccountType 账户类型
74+
// 枚举值:AD_NORMAL 普通客户账号、DOU_PLUSDOU+ 类客户账号、LOCAL 本地推客户账号
75+
AccountType string `json:"account_type,omitempty"`
76+
// AccountName 账户名称
77+
AccountName string `json:"account_name,omitempty"`
78+
}

0 commit comments

Comments
 (0)