Skip to content

Commit

Permalink
Merge branch 'release/v1.20.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Oct 2, 2023
2 parents f4e4cba + d56bc19 commit 4bd7b44
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 1 deletion.
4 changes: 4 additions & 0 deletions marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@
- 设置微信小游戏/小程序共享 [ BpAssetManagementShare(clt *core.SDKClient, accessToken string, req *wechat.BpAssetManagementShareRequest) ([]wechat.BpAssetManagementShareError, error) ]
- 取消微信小游戏/小程序共享关系 [ BpAssetManagementShareCancel(clt *core.SDKClient, accessToken string, req *wechat.BpAssetManagementShareRequest) ([]wechat.BpAssetManagementShareError, error) ]
- 查看微信小游戏/小程序共享范围 [ BpAssetManagementShareGet(clt *core.SDKClient, accessToken string, req *wechat.BpAssetManagementShareGetRequest) (*wechat.BpAssetManagementShareList, error) ]
- 字节小程序/小游戏管理 (tools)
- 获取字节小游戏 [ MicroGameList(clt *core.SDKClient, accessToken string, req *tools.MicroAppListRequest) (*tools.MicroAppListResult, error) ]
- 获取字节小程序 [ MicroAppList(clt *core.SDKClient, accessToken string, req *tools.MicroAppListRequest) (*tools.MicroAppListResult, error) ]
- 获取字节小程序/小游戏详情内容 [ AssetLinkList(clt *core.SDKClient, accessToken string, req *tools.AssetLinkListRequest) (*tools.AssetLinkListResult, error) ]
- 应用市场 (api/servemarket)
- 获取应用订单数据 [ OrderGet(clt *core.SDKClient, accessToken string, req *servemarket.OrderGetRequest) (*servemarket.OrderGetResponseData, error) ]
- 获取用户已购功能点列表 [ ActiveFuncGet(clt *core.SDKClient, accessToken string, req *servemarket.ActiveFuncGetRequest) ([]servemarket.OrderFunction, error) ]
16 changes: 16 additions & 0 deletions marketing-api/api/tools/asset_link_list.go
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"
)

// AssetLinkList 获取字节小程序/小游戏详情内容
// 获取字节小程序/小游戏详情内容
func AssetLinkList(clt *core.SDKClient, accessToken string, req *tools.AssetLinkListRequest) (*tools.AssetLinkListResult, error) {
var resp tools.AssetLinkListResponse
if err := clt.Get("v3.0/tools/asset_link/list/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
16 changes: 16 additions & 0 deletions marketing-api/api/tools/micro_app_list.go
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"
)

// MicroAppList 获取字节小程序
// 获取巨量工作台上字节小程序资产列表
func MicroAppList(clt *core.SDKClient, accessToken string, req *tools.MicroAppListRequest) (*tools.MicroAppListResult, error) {
var resp tools.MicroAppListResponse
if err := clt.Get("v3.0/tools/micro_app/list/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
16 changes: 16 additions & 0 deletions marketing-api/api/tools/micro_game_list.go
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"
)

// MicroGameList 获取字节小游戏
// 获取字节小游戏列表,对应在巨量工作台上的字节小游戏资产
func MicroGameList(clt *core.SDKClient, accessToken string, req *tools.MicroAppListRequest) (*tools.MicroAppListResult, error) {
var resp tools.MicroAppListResponse
if err := clt.Get("v3.0/tools/micro_game/list/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
15 changes: 15 additions & 0 deletions marketing-api/enum/micro_app_audit_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package enum

// MicroAppAuditStatus 审核状态
type MicroAppAuditStatus string

const (
// MicroAppAuditStatus_AUDIT_ACCEPTED 审核通过
MicroAppAuditStatus_AUDIT_ACCEPTED MicroAppAuditStatus = "AUDIT_ACCEPTED"
// MicroAppAuditStatus_AUDITING 审核中
MicroAppAuditStatus_AUDITING MicroAppAuditStatus = "AUDITING"
// MicroAppAuditStatus_AUDIT_REJECTED 审核不通过
MicroAppAuditStatus_AUDIT_REJECTED MicroAppAuditStatus = "AUDIT_REJECTED"
// MicroAppAuditStatus_ALL 全部(默认值)
MicroAppAuditStatus_ALL MicroAppAuditStatus = "ALL"
)
11 changes: 11 additions & 0 deletions marketing-api/enum/micro_app_search_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package enum

// MicroAppSearchType 搜索类型,可选值:
type MicroAppSearchType string

const (
// MicroAppSearchType_CREATE_ONLY 只查询该账户创建的应用(默认值)
MicroAppSearchType_CREATE_ONLY MicroAppSearchType = "CREATE_ONLY"
// MicroAppSearchType_SHARE_ONLY 只查询被共享的应用
MicroAppSearchType_SHARE_ONLY MicroAppSearchType = "SHARE_ONLY"
)
21 changes: 20 additions & 1 deletion marketing-api/model/eventmanager/asset.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package eventmanager

// AssetBaseInfo 资产基本数据``
import "github.com/bububa/oceanengine/marketing-api/enum"

// AssetBaseInfo 资产基本数据“
type AssetBaseInfo struct {
// AssetID 快应用资产ID
AssetID uint64 `json:"asset_id,omitempty"`
Expand Down Expand Up @@ -51,9 +53,26 @@ type App struct {
Role string `json:"role,omitempty"`
}

// Site 橙子落地页信息
type Site struct {
AssetBaseInfo
// SiteID 橙子建站站点ID,橙子落地页必填
SiteID uint64 `json:"site_id,omitempty"`
// SiteName 橙子建站站点名称,橙子落地页必填
SiteName string `json:"site_name,omitempty"`
}

// MiniProgram 字节小程序快应用资产
type MiniProgram struct {
AssetBaseInfo
// MiniProgramID 字节小程序id
MiniProgramID string `json:"mini_program_id,omitempty"`
// MicroProgramName 字节小程序的名称,需要与资产id后面信息一致
MicroProgramName string `json:"micro_program_name,omitempty"`
// InstanceID 字节小程序资产ID,通过【工具】-【获取字节小程序/小游戏】获取
InstanceID string `json:"instance_id,omitempty"`
// MiniProgramType 字节小程序类型:
// BYTE_APP:字节小程序
// BYTE_GAME:字节小游戏
MiniProgramType enum.MiniProgramType `json:"mini_program_type,omitempty"`
}
4 changes: 4 additions & 0 deletions marketing-api/model/eventmanager/assets_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ type AssetsCreateRequest struct {
QuickAppAsset *QuickApp `json:"quick_app_asset,omitempty"`
// AppAsset 应用信息
AppAsset *App `json:"app_asset,omitempty"`
// SiteAsset 橙子落地页信息
SiteAsset *Site `json:"site_asset,omitempty"`
// MiniProgramAsset 字节小程序资产信息
MiniProgramAsset *MiniProgram `json:"mini_program_asset,omitempty"`
}

// Encode implement PostRequest interface
Expand Down
7 changes: 7 additions & 0 deletions marketing-api/model/time_range.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package model

// DateRange 日期范围
type DateRange struct {
StartTime string `json:"start_time,omitempty"`
EndTime string `json:"end_time,omitempty"`
}
82 changes: 82 additions & 0 deletions marketing-api/model/tools/asset_link_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package tools

import (
"strconv"

"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)

// AssetLinkListRequest 获取字节小程序/小游戏详情内容 API Request
type AssetLinkListRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Filtering 过滤条件
Filtering *AssetLinkListFilter `json:"filtering,omitempty"`
// Page 页码,默认值:1
Page int `json:"page,omitempty"`
// PageSize 分页大小,默认值:10,最大值100
PageSize int `json:"page_size,omitempty"`
}

type AssetLinkListFilter struct {
// InstanceID 资产id
InstanceID string `json:"instance_id,omitempty"`
// CreateTime 按创建时间查询的时间范围
CreateTime *model.DateRange `json:"create_time,omitempty"`
}

// Encode implement GetRequest interface
func (r AssetLinkListRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
if r.Filtering != nil {
values.Set("filtering", string(util.JSONMarshal(r.Filtering)))
}
if r.Page > 0 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// AssetLinkListResponse 获取字节小程序/小游戏详情内容 API Response
type AssetLinkListResponse struct {
model.BaseResponse
Data *AssetLinkListResult `json:"data,omitempty"`
}

type AssetLinkListResult struct {
// PageInfo 页面信息
PageInfo *model.PageInfo `json:"page_info,omitempty"`
// List 字节小游戏/小程序列表
List []AssetLink `json:"list,omitempty"`
}

// AssetLink 字节小游戏/小程序
type AssetLink struct {
// LinkID 链接id
LinkID uint64 `json:"link_id,omitempty"`
// InstanceID 资产id
InstanceID uint64 `json:"instance_id,omitempty"`
// AppID app id
AppID string `json:"app_id,omitempty"`
// AdvertiserID 所属广告主账户ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Link 启动链接
Link string `json:"link,omitempty"`
// LinkRemark 链接备注
LinkRemark string `json:"link_remark,omitempty"`
// StartPage 启动页面
StartPage string `json:"start_page,omitempty"`
// StartParam 启动参数
StartParam string `json:"start_param,omitempty"`
// CreateTime 创建时间
CreateTime string `json:"create_time,omitempty"`
// ModifyTime 更新时间
ModifyTime string `json:"modify_time,omitempty"`
}
96 changes: 96 additions & 0 deletions marketing-api/model/tools/micro_app_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package tools

import (
"strconv"

"github.com/bububa/oceanengine/marketing-api/enum"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)

// MicroAppListRequest 获取字节小程序 API Request
type MicroAppListRequest struct {
// AdvertiserID 广告主ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// Filtering 过滤条件
Filtering *MicroAppListFilter `json:"filtering,omitempty"`
// Page 页码,默认值:1
Page int `json:"page,omitempty"`
// PageSize 分页大小,默认值:10,最大值100
PageSize int `json:"page_size,omitempty"`
}

type MicroAppListFilter struct {
// SearchType 搜索类型,可选值:
// CREATE_ONLY只查询该账户创建的应用(默认值)
// SHARE_ONLY只查询被共享的应用
SearchType enum.MicroAppSearchType `json:"search_type,omitempty"`
// SearchKey 小程序名称或备注的模糊匹配
SearchKey string `json:"search_key,omitempty"`
// AuditStatus 审核状态,可选值:
// AUDIT_ACCEPTED 审核通过
// AUDITING 审核中
// AUDIT_REJECTED 审核不通过
// ALL 全部(默认值)
AuditStatus enum.MicroAppAuditStatus `json:"audit_status,omitempty"`
// CreateTime 按创建时间查询的时间范围
CreateTime *model.DateRange `json:"create_time,omitempty"`
}

// Encode implement GetRequest interface
func (r MicroAppListRequest) Encode() string {
values := util.GetUrlValues()
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10))
if r.Filtering != nil {
values.Set("filtering", string(util.JSONMarshal(r.Filtering)))
}
if r.Page > 0 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// MicroAppListResponse 获取字节小程序 API Response
type MicroAppListResponse struct {
model.BaseResponse
Data *MicroAppListResult `json:"data,omitempty"`
}

type MicroAppListResult struct {
// PageInfo 页面信息
PageInfo *model.PageInfo `json:"page_info,omitempty"`
// List 字节小程序 列表
List []MicroApp `json:"list,omitempty"`
}

// MicroApp 字节小程序
type MicroApp struct {
// InstanceID 小程序资产id
InstanceID uint64 `json:"instance_id,omitempty"`
// Remark 字节小程序备注名称
Remark string `json:"remark,omitempty"`
// AppID 字节小程序app id
AppID string `json:"app_id,omitempty"`
// AuditStatus 审核状态:
// AUDIT_ACCEPTED
// AUDITING
// AUDIT_REJECTED
AuditStatus enum.MicroAppAuditStatus `json:"audit_status,omitempty"`
// Reason 审核拒绝原因
Reason string `json:"reason,omitempty"`
// AdvertiserID 所属广告主账户ID
AdvertiserID uint64 `json:"advertiser_id,omitempty"`
// CreateTime 创建时间
CreateTime string `json:"create_time,omitempty"`
// ModifyTime 修改时间
ModifyTime string `json:"modify_time,omitempty"`
// Category 所属账户类型
Category uint64 `json:"category,omitempty"`
// Name 字节小程序名称
Name string `json:"name,omitempty"`
}
6 changes: 6 additions & 0 deletions marketing-api/model/v3/project/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ type CreateRequest struct {
// 允许值: DPA_LINK 落地页
// 当landing_type为dpa时有效且必填
DpaAdType enum.DpaAdType `json:"dpa_adtype,omitempty"`
// 字节小程序/小游戏资产id,通过 工具-字节小程序 接口获取
// 10.30日后上线条件必填逻辑
// landing_type = MICRO_GAME下,且micro_promotion_type=BYTE_GAME字节小游戏、BYTE_APP字节小程序,必填
// landing_type=
// LINK SHOP下,若选择事件资产为字节小程序类型,则必填
MicroAppInstanceID uint64 `json:"micro_app_instance_id,omitempty"`
// OptimizeGoal 优化目标
OptimizeGoal *OptimizeGoal `json:"optimize_goal,omitempty"`
// LandingPageStayTime 店铺停留时长,单位为毫秒,当external_action为AD_CONVERT_TYPE_STAY_TIME时有效且必填
Expand Down

0 comments on commit 4bd7b44

Please sign in to comment.