Skip to content

Commit

Permalink
feat(star): 完善星图相关API
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Nov 27, 2024
1 parent 3c5bd1d commit 9adf874
Show file tree
Hide file tree
Showing 21 changed files with 337 additions and 62 deletions.
15 changes: 9 additions & 6 deletions marketing-api/STAR.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- 刷新 Token [ RefreshToken(clt *core.SDKClient, refreshToken string) (*oauth.AccessTokenResponseData, error)]
- 账号服务
- 广告主信息与资质管理
- 获取星图账户信息 [ Info(clt *core.SDKClient, accessToken string, req *star.InfoRequest) ([]star.Info, error) ]
- 修改广告主 [ agent.AdvertiserUpdate(clt *core.SDKClient, accessToken string, req *agent.AdvertiserUpdateRequest) (*agent.AdvertiserUpdateResponseData, error) ]
- 代理商账号管理 (api/agent)
- 广告主列表 [ AdvertiserSelect(clt *core.SDKClient, accessToken string, req *agent.AdvertiserSelectRequest) (*agent.AdvertiserSelectResponseData, error) ]
Expand All @@ -15,9 +16,11 @@
- 获取星广联投(星图版)任务列表 [ task.List(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.ListRequest) (*task.ListResult, error) ]
- 获取星广联投(星图版)任务维度数据 [ task.Detail(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.DetailRequest) (*task.Demand, error) ]
- 获取星广联投(星图版)视频维度数据 [ task.ItemList(ctx context.Context, clt *core.SDKClient, accessToken string, req *task.ItemListRequest) ([]task.ItemStatInfo, error) ]
- 获取星图客户任务列表 [ DemandList(clt *core.SDKClient, accessToken string, req *star.DemandListRequest) (*star.DemandListResponseData, error) ]
- 获取星图客户任务订单列表 [ DemandOrderList(clt *core.SDKClient, accessToken string, req *star.DemandOrderListRequest) (*star.DemandOrderListResponseData, error) ]
- 获取订单投后分析报表 [ ReportOrderOverviewGet(clt *core.SDKClient, accessToken string, req *star.ReportOrderOverviewGetRequest) (*star.ReportOrderOverviewGetResponseData, error) ]
- 获取订单投后受众报表 [ ReportOrderUserDistributionGet(clt *core.SDKClient, accessToken string, req *star.ReportOrderUserDistributionGetRequest) (*star.ReportOrderUserDistributionGetResponseData, error) ]
- 获取星图订单投后线索 [ ClueList(clt *core.SDKClient, accessToken string, req *star.ClueListRequest) (*star.ClueListResponseData, error) ]
- 获取星图账户信息 [ Info(clt *core.SDKClient, accessToken string, req *star.InfoRequest) ([]star.Info, error) ]
- 获取星图客户任务列表 [ DemandList(clt *core.SDKClient, accessToken string, req *star.DemandListRequest) (*star.DemandListResult, error) ]
- 获取星图客户任务订单列表 [ DemandOrderList(clt *core.SDKClient, accessToken string, req *star.DemandOrderListRequest) (*star.DemandOrderListResult, error) ]
- 获取订单投后分析报表 [ ReportOrderOverviewGet(clt *core.SDKClient, accessToken string, req *star.ReportOrderOverviewGetRequest) (*star.ReportOrderOverviewGetResult, error) ]
- 获取订单投后受众报表 [ ReportOrderUserDistributionGet(clt *core.SDKClient, accessToken string, req *star.ReportOrderUserDistributionGetRequest) (*star.ReportOrderUserDistributionGetResult, error) ]
- 获取星图订单投后线索 [ ClueGet(clt *core.SDKClient, accessToken string, req *star.ClueGetRequest) (*star.ClueGetResult, error) ]
- 获取任务下累计可查询的数据指标 [ ReportDataTopicConfig(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportDataTopicConfigRequest) ([]star.DataTopicConfig, error) ]
- 获取投后数据主题累计数据 [ ReportCustomDataTopicConfig(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportDataTopicConfigRequest) (*star.ReportCustomDataTopicConfigResult, error) ]
- 获取投后每日趋势数据(短视频) [ ReportCustomDataTopicDailyReport(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportCustomDataTopicDailyReportRequest) ([]star.ReportCustomDataTopicDailyReport, error) ]
7 changes: 3 additions & 4 deletions marketing-api/api/star/clue_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import (
// ClueList 获取星图订单投后线索
// 此接口用于根据星图id和订单id,获取星图客户的投后线索;
// 若星图客户所发布的抖音传播任务,为线索收集类任务,则星图客户或代理商,可通过此接口,获取达人接单视频中所收集的线索列表。
func ClueList(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ClueListRequest) (*star.ClueListResponseData, error) {
var resp star.ClueListResponse
err := clt.Get(ctx, "2/star/clue/list/", req, &resp, accessToken)
if err != nil {
func ClueList(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ClueGetRequest) (*star.ClueGetResult, error) {
var resp star.ClueGetResponse
if err := clt.Get(ctx, "2/star/clue/list/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
Expand Down
2 changes: 1 addition & 1 deletion marketing-api/api/star/demand_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// DemandList 获取星图客户任务列表
// 此接口用于根据星图ID,获取星图客户账号下的全部任务,包含星图任务id、任务名称、结算方式、组件类型、任务创建时间。
func DemandList(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.DemandListRequest) (*star.DemandListResponseData, error) {
func DemandList(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.DemandListRequest) (*star.DemandListResult, error) {
var resp star.DemandListResponse
err := clt.Get(ctx, "2/star/demand/list/", req, &resp, accessToken)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions marketing-api/api/star/demand_order_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

// DemandOrderList 获取星图客户任务订单列表
// 此接口用于根据星图id和星图任务id,获取星图客户所发布任务的订单列表,包含订单总数、订单id、订单创建时间、订单状态、作品名称、作品封面图、视频id、视频链接、接单的达人id、达人名称、达人头像。
func DemandOrderList(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.DemandOrderListRequest) (*star.DemandOrderListResponseData, error) {
func DemandOrderList(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.DemandOrderListRequest) (*star.DemandOrderListResult, error) {
var resp star.DemandOrderListResponse
err := clt.Get(ctx, "2/star/demand/order/list/", req, &resp, accessToken)
err := clt.GetAPI(ctx, "2/star/demand/order/list/", req, &resp, accessToken)
if err != nil {
return nil, err
}
Expand Down
17 changes: 17 additions & 0 deletions marketing-api/api/star/report_custom_data_topic_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package star

import (
"context"

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

// ReportCustomDataTopicConfig 获取投后数据主题累计数据
func ReportCustomDataTopicConfig(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportDataTopicConfigRequest) (*star.ReportCustomDataTopicConfigResult, error) {
var resp star.ReportCustomDataTopicConfigResponse
if err := clt.GetAPI(ctx, "2/star/report/custom_data_topic_config/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
20 changes: 20 additions & 0 deletions marketing-api/api/star/report_custom_data_topic_daily_report.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package star

import (
"context"

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

// ReportCustomDataTopicDailyReport 获取投后每日趋势数据(短视频)
func ReportCustomDataTopicDailyReport(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportCustomDataTopicDailyReportRequest) ([]star.ReportCustomDataTopicDailyReport, error) {
var resp star.ReportCustomDataTopicDailyReportResponse
if err := clt.GetAPI(ctx, "2/star/report/custom_data_topic_daily_report/", req, &resp, accessToken); err != nil {
return nil, err
}
if resp.Data == nil {
return nil, nil
}
return resp.Data.Stats, nil
}
21 changes: 21 additions & 0 deletions marketing-api/api/star/report_data_topic_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package star

import (
"context"

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

// ReportDataTopicConfig 获取任务下累计可查询的数据指标
func ReportDataTopicConfig(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportDataTopicConfigRequest) ([]star.DataTopicConfig, error) {
var resp star.ReportDataTopicConfigResponse
err := clt.GetAPI(ctx, "2/star/report/data_topic_config/", req, &resp, accessToken)
if err != nil {
return nil, err
}
if resp.Data == nil {
return nil, nil
}
return resp.Data.Stat, nil
}
5 changes: 2 additions & 3 deletions marketing-api/api/star/report_order_overview_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import (
// 结果中所有的rate均为*100后的结果,如five_s_play_rate=2750,表示有效播放率27.5%。
// 数据为非实时更新,一般在次日凌晨产出前一天的数据;
// 一般历史数据都不会变,除了数据有问题有校对的情况会更新历史数据。
func ReportOrderOverviewGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportOrderOverviewGetRequest) (*star.ReportOrderOverviewGetResponseData, error) {
func ReportOrderOverviewGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportOrderOverviewGetRequest) (*star.ReportOrderOverviewGetResult, error) {
var resp star.ReportOrderOverviewGetResponse
err := clt.Get(ctx, "2/star/report/order_overview/get/", req, &resp, accessToken)
if err != nil {
if err := clt.GetAPI(ctx, "2/star/report/order_overview/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
Expand Down
5 changes: 2 additions & 3 deletions marketing-api/api/star/report_order_user_distribution_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import (
// 此接口用于根据订单id,获取星图客户所发布任务的接单达人作品的受众分析数据,包含性别、年龄、省份、城市、设备、兴趣、活跃度分布。
// 数据为非实时更新,一般在次日凌晨产出前一天的数据;
// 一般历史数据都不会变,除了数据有问题有校对的情况会更新历史数据。
func ReportOrderUserDistributionGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportOrderUserDistributionGetRequest) (*star.ReportOrderUserDistributionGetResponseData, error) {
func ReportOrderUserDistributionGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *star.ReportOrderUserDistributionGetRequest) (*star.ReportOrderUserDistributionGetResult, error) {
var resp star.ReportOrderUserDistributionGetResponse
err := clt.Get(ctx, "2/star/report/order_user_distribution/get/", req, &resp, accessToken)
if err != nil {
if err := clt.GetAPI(ctx, "2/star/report/order_user_distribution/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
Expand Down
25 changes: 25 additions & 0 deletions marketing-api/enum/star_report_topic.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package enum

// StarReportTopic 数据主题
type StarReportTopic string

const (
// StarReportTopic_BASIC_DATA 基础信息
StarReportTopic_BASIC_DATA StarReportTopic = "BASIC_DATA"
// StarReportTopic_FLOW_DATA 流量表现
StarReportTopic_FLOW_DATA StarReportTopic = "FLOW_DATA"
// StarReportTopic_CONVERT_DATA 转化表现
StarReportTopic_CONVERT_DATA StarReportTopic = "CONVERT_DATA"
// StarReportTopic_SEARCH_DATA 搜索表现
StarReportTopic_SEARCH_DATA StarReportTopic = "SEARCH_DATA"
// StarReportTopic_RECOMMEND_DATA 种草表现
StarReportTopic_RECOMMEND_DATA StarReportTopic = "RECOMMEND_DATA"
// StarReportTopic_DY_SHOP_DATA 抖音进店
StarReportTopic_DY_SHOP_DATA StarReportTopic = "DY_SHOP_DATA"
// StarReportTopic_USER_DISTRIBUTION_DATA 用户画像、
StarReportTopic_USER_DISTRIBUTION_DATA StarReportTopic = "USER_DISTRIBUTION_DATA"
// StarReportTopic_INDEX_SCORE_DATA 指数得分
StarReportTopic_INDEX_SCORE_DATA StarReportTopic = "INDEX_SCORE_DATA"
// StarReportTopic_COMMENT_DATA 评论数据
StarReportTopic_COMMENT_DATA StarReportTopic = "COMMENT_DATA"
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/bububa/oceanengine/marketing-api/util"
)

// ClueListRequest 获取星图订单投后线索 API Request
type ClueListRequest struct {
// ClueGetRequest 获取星图订单投后线索 API Request
type ClueGetRequest struct {
// StarID 星图id,星图客户授权后,通过“获取已授权账户”接口,查询到账号角色为”6-星图账号“的账户id,即为星图id
StarID uint64 `json:"star_id,omitempty"`
// DemandID 任务id
Expand All @@ -22,7 +22,7 @@ type ClueListRequest struct {
}

// Encode implement GetRequest interface
func (r ClueListRequest) Encode() string {
func (r ClueGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("star_id", strconv.FormatUint(r.StarID, 10))
if r.DemandID > 0 {
Expand All @@ -42,15 +42,15 @@ func (r ClueListRequest) Encode() string {
return ret
}

// ClueListResponse 获取星图客户任务列表 API Response
type ClueListResponse struct {
model.BaseResponse
// ClueGetResponse 获取星图客户任务列表 API Response
type ClueGetResponse struct {
// Data json返回值
Data *ClueListResponseData `json:"data,omitempty"`
Data *ClueGetResult `json:"data,omitempty"`
model.BaseResponse
}

// ClueListResponseData json返回值
type ClueListResponseData struct {
// ClueGetResult json返回值
type ClueGetResult struct {
List []Clue `json:"list,omitempty"`
PageInfo model.PageInfo `json:"page_info"`
}
8 changes: 4 additions & 4 deletions marketing-api/model/star/demand.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import "github.com/bububa/oceanengine/marketing-api/enum"

// Demand 星图客户任务
type Demand struct {
// ID 任务id
ID uint64 `json:"demand_id,omitempty"`
// Name 任务名称
Name string `json:"name,omitempty"`
// DemandID 任务id
DemandID uint64 `json:"demand_id,omitempty"`
// DemandName 任务名称
DemandName string `json:"name,omitempty"`
// TaskCategory 所创建的星图任务类型。枚举值详见【附录-枚举值-星图任务类型】
TaskCategory enum.StarTaskCategory `json:"task_category,omitempty"`
// ComponentType 组件类型
Expand Down
16 changes: 10 additions & 6 deletions marketing-api/model/star/demand_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (

// DemandListRequest 获取星图客户任务列表 API Request
type DemandListRequest struct {
// StarID 星图id,星图客户授权后,通过“获取已授权账户”接口,查询到账号角色为”6-星图账号“的账户id,即为星图id
StarID uint64 `json:"star_id,omitempty"`
// Filtering 过滤条件,若此字段不传,或传空则视为无限制条件
Filtering *DemandListFilter `json:"filtering,omitempty"`
// StarID 星图id,星图客户授权后,通过“获取已授权账户”接口,查询到账号角色为”6-星图账号“的账户id,即为星图id
StarID uint64 `json:"star_id,omitempty"`
// Page 页码,默认为1
Page int `json:"page,omitempty"`
// PageSize 页面大小,默认10,最大值50
Expand All @@ -23,6 +23,10 @@ type DemandListRequest struct {

// DemandListFilter 过滤条件
type DemandListFilter struct {
// QueryTimeRange 查询时间范围内创建的任务。
// 筛选时间时,开始时间必须与结束时间同时传入,开始时间必须小于等于结束时间。
// 若缺省默认查询全时间范围任务,若出现超时等情况请缩小查询时间范围。
QueryTimeRange *model.DateRange `json:"query_time_range,omitempty"`
// ComponentType 组件类型
ComponentType enum.StarComponentType `json:"component_type,omitempty"`
// TaskCategory 星图任务类型,允许值详见【附录-枚举值-星图任务类型】
Expand Down Expand Up @@ -56,13 +60,13 @@ func (r DemandListRequest) Encode() string {

// DemandListResponse 获取星图客户任务列表 API Response
type DemandListResponse struct {
model.BaseResponse
// Data json返回值
Data *DemandListResponseData `json:"data,omitempty"`
Data *DemandListResult `json:"data,omitempty"`
model.BaseResponse
}

// DemandListResponseData json返回值
type DemandListResponseData struct {
// DemandListResult json返回值
type DemandListResult struct {
List []Demand `json:"list,omitempty"`
PageInfo model.PageInfo `json:"page_info"`
}
14 changes: 8 additions & 6 deletions marketing-api/model/star/demand_order_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import (

// DemandOrderListRequest 获取星图客户任务列表 API Request
type DemandOrderListRequest struct {
// StarID 星图id,星图客户授权后,通过“获取已授权账户”接口,查询到账号角色为”6-星图账号“的账户id,即为星图id
StarID uint64 `json:"star_id,omitempty"`
// Filtering 过滤条件,若此字段不传,或传空则视为无限制条件
Filtering *DemandOrderListFilter `json:"filtering,omitempty"`
// StarID 星图id,星图客户授权后,通过“获取已授权账户”接口,查询到账号角色为”6-星图账号“的账户id,即为星图id
StarID uint64 `json:"star_id,omitempty"`
// DemandID 任务id,可通过“获取星图客户任务列表”获取
DemandID uint64 `json:"demand_id,omitempty"`
// Page 页码,默认为1
Page int `json:"page,omitempty"`
// PageSize 页面大小,默认10,最大值50
Expand Down Expand Up @@ -48,13 +50,13 @@ func (r DemandOrderListRequest) Encode() string {

// DemandOrderListResponse 获取星图客户任务列表 API Response
type DemandOrderListResponse struct {
model.BaseResponse
// Data json返回值
Data *DemandOrderListResponseData `json:"data,omitempty"`
Data *DemandOrderListResult `json:"data,omitempty"`
model.BaseResponse
}

// DemandOrderListResponseData json返回值
type DemandOrderListResponseData struct {
// DemandOrderListResult json返回值
type DemandOrderListResult struct {
List []Order `json:"list,omitempty"`
PageInfo model.PageInfo `json:"page_info"`
}
4 changes: 2 additions & 2 deletions marketing-api/model/star/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ type Info struct {

// IndustryInfo 行业信息
type IndustryInfo struct {
// IndustryID 行业id
IndustryID uint64 `json:"industry_id,omitempty"`
// IndustryName 行业名称
IndustryName string `json:"industry_name,omitempty"`
// IndustryID 行业id
IndustryID uint64 `json:"industry_id,omitempty"`
}
16 changes: 10 additions & 6 deletions marketing-api/model/star/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "github.com/bububa/oceanengine/marketing-api/enum"

// Order 星图客户任务订单
type Order struct {
// ID 订单id
ID uint64 `json:"order_id,omitempty"`
// OrderID 订单id
OrderID uint64 `json:"order_id,omitempty"`
// Title 作品名称
Title string `json:"title,omitempty"`
// UniversalOrderStatus 订单状态
Expand All @@ -14,18 +14,22 @@ type Order struct {
AuthorID uint64 `json:"author_id,omitempty"`
// AuthorName 达人名称
AuthorName string `json:"author_name,omitempty"`
// AvatarURL 达人头像
AvatarURL string `json:"avatar_url,omitempty"`
// AvatarURI 达人头像
AvatarURI string `json:"avatar_uri,omitempty"`
// CreateTime 订单创建时间,格式:%Y-%m-%d %H:%M:%S
CreateTime string `json:"create_time,omitempty"`
// DemandID 任务id
DemandID uint64 `json:"demand_id,omitempty"`
// HeadImageURL 封面图
HeadImageURL string `json:"head_image_url,omitempty"`
// HeadImageURI 封面图
HeadImageURI string `json:"head_image_uri,omitempty"`
// VideoID 视频id,每个视频唯一(建议使用item_id)
VideoID string `json:"video_id,omitempty"`
// ItemID 视频id,与星图平台前端video_url中展现的视频id一致,每个视频唯一
ItemID uint64 `json:"item_id,omitempty"`
// VideoURL 视频链接
VideoURL string `json:"video_url,omitempty"`
// CampaignID 需求id
CampaignID uint64 `json:"campaign_id,omitempty"`
// ReleaseTime 指派任务产出物发布时间
ReleaseTime string `json:"release_time,omitempty"`
}
18 changes: 18 additions & 0 deletions marketing-api/model/star/report_custom_data_topic_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package star

import "github.com/bububa/oceanengine/marketing-api/model"

// ReportCustomDataTopicConfigResponse 获取投后数据主题累计数据 API Response
type ReportCustomDataTopicConfigResponse struct {
Data *ReportCustomDataTopicConfigResult `json:"data,omitempty"`
model.BaseResponse
}

type ReportCustomDataTopicConfigResult struct {
// Data 对应请求的数据主题数组
Data []DataTopicConfig `json:"data,omitempty"`
// ItemID 请求的交付物Id
ItemID uint64 `json:"item_id,omitempty"`
// DemandID 请求的任务Id
DemandID uint64 `json:"demand_id,omitempty"`
}
Loading

0 comments on commit 9adf874

Please sign in to comment.