From d56bc19a063f60a7bfec09ea4307588d1ee74dd9 Mon Sep 17 00:00:00 2001 From: Syd Xu Date: Mon, 2 Oct 2023 15:46:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AD=97=E8=8A=82=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E8=B5=84=E4=BA=A7=E5=8C=96=E6=94=B9=E9=80=A0=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=EF=BC=88=E5=88=9B=E5=BB=BA=E9=A1=B9=E7=9B=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=B0=86=E4=BA=8E=2010.30=20=E5=B0=86=E5=AD=97?= =?UTF-8?q?=E8=8A=82=E5=B0=8F=E7=A8=8B=E5=BA=8F/=E5=B0=8F=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E8=B5=84=E4=BA=A7id=E8=AE=BE=E4=B8=BA=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=BF=85=E5=A1=AB=E5=AD=97=E6=AE=B5=EF=BC=8C=E8=AF=B7?= =?UTF-8?q?=E6=B6=89=E5=8F=8A=E5=88=B0=E8=AF=A5=E6=8A=95=E6=94=BE=E9=93=BE?= =?UTF-8?q?=E8=B7=AF=E7=9A=84=E5=BC=80=E5=8F=91=E8=80=85=E6=8F=90=E5=89=8D?= =?UTF-8?q?=E6=84=9F=E7=9F=A5=E6=94=B9=E9=80=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- marketing-api/OCEANENGINE.md | 4 + marketing-api/api/tools/asset_link_list.go | 16 ++++ marketing-api/api/tools/micro_app_list.go | 16 ++++ marketing-api/api/tools/micro_game_list.go | 16 ++++ marketing-api/enum/micro_app_audit_status.go | 15 +++ marketing-api/enum/micro_app_search_type.go | 11 +++ marketing-api/model/eventmanager/asset.go | 21 +++- .../model/eventmanager/assets_create.go | 4 + marketing-api/model/time_range.go | 7 ++ marketing-api/model/tools/asset_link_list.go | 82 ++++++++++++++++ marketing-api/model/tools/micro_app_list.go | 96 +++++++++++++++++++ marketing-api/model/v3/project/create.go | 6 ++ 12 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 marketing-api/api/tools/asset_link_list.go create mode 100644 marketing-api/api/tools/micro_app_list.go create mode 100644 marketing-api/api/tools/micro_game_list.go create mode 100644 marketing-api/enum/micro_app_audit_status.go create mode 100644 marketing-api/enum/micro_app_search_type.go create mode 100644 marketing-api/model/time_range.go create mode 100644 marketing-api/model/tools/asset_link_list.go create mode 100644 marketing-api/model/tools/micro_app_list.go diff --git a/marketing-api/OCEANENGINE.md b/marketing-api/OCEANENGINE.md index 5dcf5137..3ac73124 100644 --- a/marketing-api/OCEANENGINE.md +++ b/marketing-api/OCEANENGINE.md @@ -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) ] diff --git a/marketing-api/api/tools/asset_link_list.go b/marketing-api/api/tools/asset_link_list.go new file mode 100644 index 00000000..ff510b08 --- /dev/null +++ b/marketing-api/api/tools/asset_link_list.go @@ -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 +} diff --git a/marketing-api/api/tools/micro_app_list.go b/marketing-api/api/tools/micro_app_list.go new file mode 100644 index 00000000..9be50a9d --- /dev/null +++ b/marketing-api/api/tools/micro_app_list.go @@ -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 +} diff --git a/marketing-api/api/tools/micro_game_list.go b/marketing-api/api/tools/micro_game_list.go new file mode 100644 index 00000000..14894b09 --- /dev/null +++ b/marketing-api/api/tools/micro_game_list.go @@ -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 +} diff --git a/marketing-api/enum/micro_app_audit_status.go b/marketing-api/enum/micro_app_audit_status.go new file mode 100644 index 00000000..d0617472 --- /dev/null +++ b/marketing-api/enum/micro_app_audit_status.go @@ -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" +) diff --git a/marketing-api/enum/micro_app_search_type.go b/marketing-api/enum/micro_app_search_type.go new file mode 100644 index 00000000..85e292d6 --- /dev/null +++ b/marketing-api/enum/micro_app_search_type.go @@ -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" +) diff --git a/marketing-api/model/eventmanager/asset.go b/marketing-api/model/eventmanager/asset.go index 63a302ae..91be7641 100644 --- a/marketing-api/model/eventmanager/asset.go +++ b/marketing-api/model/eventmanager/asset.go @@ -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"` @@ -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"` } diff --git a/marketing-api/model/eventmanager/assets_create.go b/marketing-api/model/eventmanager/assets_create.go index 91709ba5..07e6125e 100644 --- a/marketing-api/model/eventmanager/assets_create.go +++ b/marketing-api/model/eventmanager/assets_create.go @@ -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 diff --git a/marketing-api/model/time_range.go b/marketing-api/model/time_range.go new file mode 100644 index 00000000..b403726c --- /dev/null +++ b/marketing-api/model/time_range.go @@ -0,0 +1,7 @@ +package model + +// DateRange 日期范围 +type DateRange struct { + StartTime string `json:"start_time,omitempty"` + EndTime string `json:"end_time,omitempty"` +} diff --git a/marketing-api/model/tools/asset_link_list.go b/marketing-api/model/tools/asset_link_list.go new file mode 100644 index 00000000..23f951dc --- /dev/null +++ b/marketing-api/model/tools/asset_link_list.go @@ -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"` +} diff --git a/marketing-api/model/tools/micro_app_list.go b/marketing-api/model/tools/micro_app_list.go new file mode 100644 index 00000000..87d233df --- /dev/null +++ b/marketing-api/model/tools/micro_app_list.go @@ -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"` +} diff --git a/marketing-api/model/v3/project/create.go b/marketing-api/model/v3/project/create.go index 934cf96d..d07a19b5 100644 --- a/marketing-api/model/v3/project/create.go +++ b/marketing-api/model/v3/project/create.go @@ -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时有效且必填