From 5cecd9868f5b046993ecd4e314dcd69abc32c8fc Mon Sep 17 00:00:00 2001 From: Syd Xu Date: Thu, 6 Jan 2022 20:08:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(tools):=20=E5=A2=9E=E5=8A=A0=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E7=AE=A1=E7=90=86=E7=9B=B8=E5=85=B3API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++ marketing-api/README.md | 11 +++ .../api/tools/comment/aweme_banded_create.go | 17 +++++ .../api/tools/comment/aweme_banded_delete.go | 17 +++++ .../api/tools/comment/aweme_banded_list.go | 17 +++++ marketing-api/api/tools/comment/doc.go | 2 + marketing-api/api/tools/comment/get.go | 16 ++++ marketing-api/api/tools/comment/operate.go | 17 +++++ marketing-api/api/tools/comment/reply_get.go | 17 +++++ .../api/tools/comment/terms_banded_add.go | 14 ++++ .../api/tools/comment/terms_banded_delete.go | 14 ++++ .../api/tools/comment/terms_banded_get.go | 17 +++++ .../api/tools/comment/terms_banded_update.go | 15 ++++ marketing-api/enum/comment_operate_type.go | 19 +++++ marketing-api/enum/comment_reply_status.go | 11 +++ .../tools/comment/aweme_banded_create.go | 46 ++++++++++++ .../model/tools/comment/aweme_banded_list.go | 74 +++++++++++++++++++ marketing-api/model/tools/comment/comment.go | 41 ++++++++++ marketing-api/model/tools/comment/doc.go | 2 + marketing-api/model/tools/comment/get.go | 66 +++++++++++++++++ marketing-api/model/tools/comment/operate.go | 63 ++++++++++++++++ marketing-api/model/tools/comment/reply.go | 25 +++++++ .../model/tools/comment/reply_get.go | 52 +++++++++++++ .../model/tools/comment/terms_banded_add.go | 19 +++++ .../tools/comment/terms_banded_delete.go | 19 +++++ .../model/tools/comment/terms_banded_get.go | 46 ++++++++++++ .../tools/comment/terms_banded_update.go | 21 ++++++ 27 files changed, 689 insertions(+) create mode 100644 marketing-api/api/tools/comment/aweme_banded_create.go create mode 100644 marketing-api/api/tools/comment/aweme_banded_delete.go create mode 100644 marketing-api/api/tools/comment/aweme_banded_list.go create mode 100644 marketing-api/api/tools/comment/doc.go create mode 100644 marketing-api/api/tools/comment/get.go create mode 100644 marketing-api/api/tools/comment/operate.go create mode 100644 marketing-api/api/tools/comment/reply_get.go create mode 100644 marketing-api/api/tools/comment/terms_banded_add.go create mode 100644 marketing-api/api/tools/comment/terms_banded_delete.go create mode 100644 marketing-api/api/tools/comment/terms_banded_get.go create mode 100644 marketing-api/api/tools/comment/terms_banded_update.go create mode 100644 marketing-api/enum/comment_operate_type.go create mode 100644 marketing-api/enum/comment_reply_status.go create mode 100644 marketing-api/model/tools/comment/aweme_banded_create.go create mode 100644 marketing-api/model/tools/comment/aweme_banded_list.go create mode 100644 marketing-api/model/tools/comment/comment.go create mode 100644 marketing-api/model/tools/comment/doc.go create mode 100644 marketing-api/model/tools/comment/get.go create mode 100644 marketing-api/model/tools/comment/operate.go create mode 100644 marketing-api/model/tools/comment/reply.go create mode 100644 marketing-api/model/tools/comment/reply_get.go create mode 100644 marketing-api/model/tools/comment/terms_banded_add.go create mode 100644 marketing-api/model/tools/comment/terms_banded_delete.go create mode 100644 marketing-api/model/tools/comment/terms_banded_get.go create mode 100644 marketing-api/model/tools/comment/terms_banded_update.go diff --git a/README.md b/README.md index 6675b572..9b47d26d 100644 --- a/README.md +++ b/README.md @@ -160,3 +160,14 @@ - 获取起量的后验数据 [ Result(clt *core.SDKClient, accessToken string, req *adraise.ResultRequest) (*adraise.Result, error) ] - 获取一键起量报告 [ Report(clt *core.SDKClient, accessToken string, req *adraise.ReportRequest) (*adraise.ReportResponseData, error) ] - 获取起量版本信息 [ Version(clt *core.SDKClient, accessToken string, req *adraise.VersionRequest) (*adraise.VersionResponseData, error) ] + - 评论管理 (tools/comment) + - 获取评论列表 [ Get(clt *core.SDKClient, accessToken string, req *comment.GetRequest) (*comment.GetResponseData, error) ] + - 获取评论回复列表 [ ReplyGet(clt *core.SDKClient, accessToken string, req *comment.ReplyGetRequest) (*comment.ReplyGetResponseData, error) ] + - 评论操作 [ Operate(clt *core.SDKClient, accessToken string, req *comment.OperateRequest) (*comment.OperateResponseData, error) ] + - 获取屏蔽词列表 [ TermsBandedGet(clt *core.SDKClient, accessToken string, req *comment.TermsBandedGetRequest) (*comment.TermsBandedGetResponseData, error) ] + - 添加屏蔽词 [ TermsBandedAdd(clt *core.SDKClient, accessToken string, req *comment.TermsBandedAddRequest) error ] + - 更新屏蔽词 [ TermsBandedUpdate(clt *core.SDKClient, accessToken string, req *comment.TermsBandedUpdateRequest) error ] + - 删除屏蔽词 [ TermsBandedDelete(clt *core.SDKClient, accessToken string, req *comment.TermsBandedDeleteRequest) error ] + - 获取屏蔽用户列表 [ AwemeBandedList(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedListRequest) (*comment.AwemeBandedListResponseData, error) ] + - 添加屏蔽用户 [ AwemeBandedCreate(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedCreateRequest) (*comment.AwemeBandedCreateResponseData, error) ] + - 删除屏蔽用户 [ AwemeBandedDelete(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedCreateRequest) (*comment.AwemeBandedCreateResponseData, error) ] diff --git a/marketing-api/README.md b/marketing-api/README.md index 6675b572..9b47d26d 100644 --- a/marketing-api/README.md +++ b/marketing-api/README.md @@ -160,3 +160,14 @@ - 获取起量的后验数据 [ Result(clt *core.SDKClient, accessToken string, req *adraise.ResultRequest) (*adraise.Result, error) ] - 获取一键起量报告 [ Report(clt *core.SDKClient, accessToken string, req *adraise.ReportRequest) (*adraise.ReportResponseData, error) ] - 获取起量版本信息 [ Version(clt *core.SDKClient, accessToken string, req *adraise.VersionRequest) (*adraise.VersionResponseData, error) ] + - 评论管理 (tools/comment) + - 获取评论列表 [ Get(clt *core.SDKClient, accessToken string, req *comment.GetRequest) (*comment.GetResponseData, error) ] + - 获取评论回复列表 [ ReplyGet(clt *core.SDKClient, accessToken string, req *comment.ReplyGetRequest) (*comment.ReplyGetResponseData, error) ] + - 评论操作 [ Operate(clt *core.SDKClient, accessToken string, req *comment.OperateRequest) (*comment.OperateResponseData, error) ] + - 获取屏蔽词列表 [ TermsBandedGet(clt *core.SDKClient, accessToken string, req *comment.TermsBandedGetRequest) (*comment.TermsBandedGetResponseData, error) ] + - 添加屏蔽词 [ TermsBandedAdd(clt *core.SDKClient, accessToken string, req *comment.TermsBandedAddRequest) error ] + - 更新屏蔽词 [ TermsBandedUpdate(clt *core.SDKClient, accessToken string, req *comment.TermsBandedUpdateRequest) error ] + - 删除屏蔽词 [ TermsBandedDelete(clt *core.SDKClient, accessToken string, req *comment.TermsBandedDeleteRequest) error ] + - 获取屏蔽用户列表 [ AwemeBandedList(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedListRequest) (*comment.AwemeBandedListResponseData, error) ] + - 添加屏蔽用户 [ AwemeBandedCreate(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedCreateRequest) (*comment.AwemeBandedCreateResponseData, error) ] + - 删除屏蔽用户 [ AwemeBandedDelete(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedCreateRequest) (*comment.AwemeBandedCreateResponseData, error) ] diff --git a/marketing-api/api/tools/comment/aweme_banded_create.go b/marketing-api/api/tools/comment/aweme_banded_create.go new file mode 100644 index 00000000..e5926902 --- /dev/null +++ b/marketing-api/api/tools/comment/aweme_banded_create.go @@ -0,0 +1,17 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// AwemeBandedCreate 添加屏蔽用户 +// 添加屏蔽用户接口用于添加屏蔽抖音用户,抖音用户屏蔽需要广告主绑定抖音账号,每个绑定的抖音账号最多屏蔽5000个抖音id与5000个昵称关键词,广告主当前可添加屏蔽的抖音id和昵称关键词以绑定的抖音账号中已屏蔽最多的抖音账号为准。 +func AwemeBandedCreate(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedCreateRequest) (*comment.AwemeBandedCreateResponseData, error) { + var resp comment.AwemeBandedCreateResponse + err := clt.Post("2/tools/comment/aweme_banded/create/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/aweme_banded_delete.go b/marketing-api/api/tools/comment/aweme_banded_delete.go new file mode 100644 index 00000000..b7e6e871 --- /dev/null +++ b/marketing-api/api/tools/comment/aweme_banded_delete.go @@ -0,0 +1,17 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// AwemeBandedDelete 删除屏蔽用户 +// 删除屏蔽用户接口用于删除已屏蔽的抖音用户,抖音用户屏蔽需要广告主绑定抖音账号。 +func AwemeBandedDelete(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedCreateRequest) (*comment.AwemeBandedCreateResponseData, error) { + var resp comment.AwemeBandedCreateResponse + err := clt.Post("2/tools/comment/aweme_banded/delete/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/aweme_banded_list.go b/marketing-api/api/tools/comment/aweme_banded_list.go new file mode 100644 index 00000000..77157dfd --- /dev/null +++ b/marketing-api/api/tools/comment/aweme_banded_list.go @@ -0,0 +1,17 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// AwemeBandedList 获取屏蔽用户列表 +// 获取屏蔽用户列表用于获取广告主绑定的抖音账号(第一个绑定的抖音账号)屏蔽的抖音id列表或昵称关键词列表。 +func AwemeBandedList(clt *core.SDKClient, accessToken string, req *comment.AwemeBandedListRequest) (*comment.AwemeBandedListResponseData, error) { + var resp comment.AwemeBandedListResponse + err := clt.Get("2/tools/comment/aweme_banded/list/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/doc.go b/marketing-api/api/tools/comment/doc.go new file mode 100644 index 00000000..b700be08 --- /dev/null +++ b/marketing-api/api/tools/comment/doc.go @@ -0,0 +1,2 @@ +// Package comment 评论管理 +package comment diff --git a/marketing-api/api/tools/comment/get.go b/marketing-api/api/tools/comment/get.go new file mode 100644 index 00000000..0edaf9f4 --- /dev/null +++ b/marketing-api/api/tools/comment/get.go @@ -0,0 +1,16 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// Get 获取评论列表 +func Get(clt *core.SDKClient, accessToken string, req *comment.GetRequest) (*comment.GetResponseData, error) { + var resp comment.GetResponse + err := clt.Get("2/tools/comment/get/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/operate.go b/marketing-api/api/tools/comment/operate.go new file mode 100644 index 00000000..36aa565b --- /dev/null +++ b/marketing-api/api/tools/comment/operate.go @@ -0,0 +1,17 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// Operate 操作广告计划的评论 +// 为保证接口使用的安全性,避免操作他人的评论信息,该接口只可用于操作广告主自身计划下的评论信息,即需查询的广告主账号的主体需与APPID对应开发者的主体保持一致,才可操作评论的信息,否则会报错! 说明:评论回复会经过审核,一般有10s的审核时间,如果审核未通过的评论将无法展现和查询出来,并且无拒审理由,意味着10S后回复列表没有查出来那回复内容大概率就是被审核拒绝了。 +func Operate(clt *core.SDKClient, accessToken string, req *comment.OperateRequest) (*comment.OperateResponseData, error) { + var resp comment.OperateResponse + err := clt.Post("2/tools/comment/operate/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/reply_get.go b/marketing-api/api/tools/comment/reply_get.go new file mode 100644 index 00000000..638c1b0e --- /dev/null +++ b/marketing-api/api/tools/comment/reply_get.go @@ -0,0 +1,17 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// ReplyGet 获取评论回复列表 +// 说明:评论回复会经过审核,一般有10s的审核时间,如果审核未通过的评论将无法展现和查询出来,并且无拒审理由,意味着10S后回复列表没有查出来那回复内容大概率就是被审核拒绝了。 +func ReplyGet(clt *core.SDKClient, accessToken string, req *comment.ReplyGetRequest) (*comment.ReplyGetResponseData, error) { + var resp comment.ReplyGetResponse + err := clt.Get("2/tools/comment_reply/get/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/terms_banded_add.go b/marketing-api/api/tools/comment/terms_banded_add.go new file mode 100644 index 00000000..db2798fc --- /dev/null +++ b/marketing-api/api/tools/comment/terms_banded_add.go @@ -0,0 +1,14 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// TermsBandedAdd 添加屏蔽词 +// 本接口用于添加评论屏蔽词。该屏蔽词针对该广告主下的所有评论生效,命中屏蔽词的抖音评论将直接隐藏,不对外进行展示。屏蔽词管理模块目前只针对“抖音”广告位生效。屏蔽词数量最多500个。 +func TermsBandedAdd(clt *core.SDKClient, accessToken string, req *comment.TermsBandedAddRequest) error { + var resp model.BaseResponse + return clt.Post("2/tools/comment/terms_banded/add/", req, &resp, accessToken) +} diff --git a/marketing-api/api/tools/comment/terms_banded_delete.go b/marketing-api/api/tools/comment/terms_banded_delete.go new file mode 100644 index 00000000..19063eb5 --- /dev/null +++ b/marketing-api/api/tools/comment/terms_banded_delete.go @@ -0,0 +1,14 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// TermsBandedDelete 删除屏蔽词 +// 本接口用于删除评论屏蔽词。屏蔽词会针对该广告主下的所有评论生效,命中屏蔽词的抖音评论将直接隐藏,不对外进行展示,删除后后续评论可正常展示。屏蔽词管理模块目前只针对“抖音”广告位生效。屏蔽词数量最多500个。 +func TermsBandedDelete(clt *core.SDKClient, accessToken string, req *comment.TermsBandedDeleteRequest) error { + var resp model.BaseResponse + return clt.Post("2/tools/comment/terms_banded/delete/", req, &resp, accessToken) +} diff --git a/marketing-api/api/tools/comment/terms_banded_get.go b/marketing-api/api/tools/comment/terms_banded_get.go new file mode 100644 index 00000000..c6709f1e --- /dev/null +++ b/marketing-api/api/tools/comment/terms_banded_get.go @@ -0,0 +1,17 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// TermsBandedGet 获取屏蔽词列表 +// 本接口用于获取广告主下的屏蔽词列表。该屏蔽词针对该广告主下的所有评论生效,命中屏蔽词的抖音评论将直接隐藏,不对外进行展示。屏蔽词管理模块目前只针对“抖音”广告位生效。屏蔽词数量最多500个。 +func TermsBandedGet(clt *core.SDKClient, accessToken string, req *comment.TermsBandedGetRequest) (*comment.TermsBandedGetResponseData, error) { + var resp comment.TermsBandedGetResponse + err := clt.Get("2/tools/comment/terms_banded/get/", req, &resp, accessToken) + if err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/marketing-api/api/tools/comment/terms_banded_update.go b/marketing-api/api/tools/comment/terms_banded_update.go new file mode 100644 index 00000000..945d9b62 --- /dev/null +++ b/marketing-api/api/tools/comment/terms_banded_update.go @@ -0,0 +1,15 @@ +package comment + +import ( + "github.com/bububa/oceanengine/marketing-api/core" + "github.com/bububa/oceanengine/marketing-api/model" + "github.com/bububa/oceanengine/marketing-api/model/tools/comment" +) + +// TermsBandedUpdate 更新屏蔽词 +// 本接口用于对单一评论屏蔽词进行更新,可以选择指定的屏蔽词进行更新,效果等同于删除老屏蔽词后再添加新屏蔽词。该屏蔽词针对该广告主下的所有评论生效,命中屏蔽词的抖音评论将直接隐藏,不对外进行展示。屏蔽词管理模块目前只针对“抖音”广告位生效。屏蔽词数量最多500个。 +// 如果new_terms已存在,则等同于删除origin_terms;如果origin_terms不存在,则等同于新增new_terms +func TermsBandedUpdate(clt *core.SDKClient, accessToken string, req *comment.TermsBandedUpdateRequest) error { + var resp model.BaseResponse + return clt.Post("2/tools/comment/terms_banded/update/", req, &resp, accessToken) +} diff --git a/marketing-api/enum/comment_operate_type.go b/marketing-api/enum/comment_operate_type.go new file mode 100644 index 00000000..f7a198d6 --- /dev/null +++ b/marketing-api/enum/comment_operate_type.go @@ -0,0 +1,19 @@ +package enum + +// CommentOperateType 评论操作类型 +type CommentOperateType string + +const ( + // CommentOperateType_REPLY 回复评论,可批量 + CommentOperateType_REPLY CommentOperateType = "REPLY" + // CommentOperateType_REPLY_TO_REPLY 二级回复,回复该评论下的其他回复 + CommentOperateType_REPLY_TO_REPLY CommentOperateType = "REPLY_TO_REPLY" + // CommentOperateType_STICK_ON_TOP 置顶 + CommentOperateType_STICK_ON_TOP CommentOperateType = "STICK_ON_TOP" + // CommentOperateType_CANCEL_STICK 取消置顶 + CommentOperateType_CANCEL_STICK CommentOperateType = "CANCEL_STICK" + // CommentOperateType_HIDE 隐藏评论,仅评论者自己可见 + CommentOperateType_HIDE CommentOperateType = "HIDE" + // CommentOperateType_BLOCK_USERS 屏蔽用户,将用户加入黑名单,该用户之后的评论自动设置为仅评论者自见 + CommentOperateType_BLOCK_USERS CommentOperateType = "BLOCK_USERS" +) diff --git a/marketing-api/enum/comment_reply_status.go b/marketing-api/enum/comment_reply_status.go new file mode 100644 index 00000000..f5b4b7af --- /dev/null +++ b/marketing-api/enum/comment_reply_status.go @@ -0,0 +1,11 @@ +package enum + +// CommentReplyStatus 评论回复状态 +type CommentReplyStatus string + +const ( + // CommentReplyStatus_REPLIED 已回复 + CommentReplyStatus_REPLIED CommentReplyStatus = "REPLIED" + // CommentReplyStatus_NO_REPLY 未回复 + CommentReplyStatus_NO_REPLY CommentReplyStatus = "NO_REPLY" +) diff --git a/marketing-api/model/tools/comment/aweme_banded_create.go b/marketing-api/model/tools/comment/aweme_banded_create.go new file mode 100644 index 00000000..80ad37ea --- /dev/null +++ b/marketing-api/model/tools/comment/aweme_banded_create.go @@ -0,0 +1,46 @@ +package comment + +import ( + "encoding/json" + + "github.com/bububa/oceanengine/marketing-api/model" +) + +// AwemeBandedCreateRequest 添加屏蔽用户 API Request +type AwemeBandedCreateRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // BandedType 屏蔽类型,; 允许值:CUSTOM_TYPE:自定义规则,根据昵称关键词屏蔽;AWEME_TYPE:根据抖音id屏蔽。 + BandedType string `json:"banded_type,omitempty"` + // AwemeIDs 抖音id列表,抖音id为抖音页面展示id;当banned_type为AWEME_TYPE时必填;每次最多传50个抖音id,抖音id限制长度20,纯数字id不能以0开头;最多屏蔽5000个抖音ID。 + AwemeIDs []string `json:"aweme_ids,omitempty"` + // NicknameKeywords 抖音昵称关键词列表,当banned_type为CUSTOM_TYPE时必填;关键词长度不大于40个字符,中文算2个字符;每次最多传50个关键词;最多屏蔽5000个关键词。 + NicknameKeywords []string `json:"nickname_keywords,omitempty"` +} + +// Encode implement PostRequest interface +func (r AwemeBandedCreateRequest) Encode() []byte { + js, _ := json.Marshal(r) + return js +} + +// AwemeBandedCreateResponse 添加屏蔽用户 API Response +type AwemeBandedCreateResponse struct { + model.BaseResponse + // Data json 返回值 + Data *AwemeBandedCreateResponseData `json:"data,omitempty"` +} + +type AwemeBandedCreateResponseData struct { + // Success 屏蔽成功的昵称关键词列表或抖音id列表 + Success []string `json:"success,omitempty"` + // Fail 屏蔽失败的昵称关键词列表或抖音id列表 + Fail []FailItem `json:"fail,omitempty"` +} + +type FailItem struct { + // Message 失败原因 + Message string `json:"message,omitempty"` + // ResultKey 屏蔽失败的昵称关键词列表或抖音id + ResultKey string `json:"result_key,omitempty"` +} diff --git a/marketing-api/model/tools/comment/aweme_banded_list.go b/marketing-api/model/tools/comment/aweme_banded_list.go new file mode 100644 index 00000000..ffdbd2db --- /dev/null +++ b/marketing-api/model/tools/comment/aweme_banded_list.go @@ -0,0 +1,74 @@ +package comment + +import ( + "encoding/json" + "net/url" + "strconv" + + "github.com/bububa/oceanengine/marketing-api/model" +) + +// AwemeBandedList 获取屏蔽用户列表 API Request +type AwemeBandedListRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // Filtering 筛选条件 + Filtering *AwemeBandedListFiltering `json:"filtering,omitempty"` + // Page 页数 默认值: 1 + Page int `json:"page,omitempty"` + // PageSize 页面大小默认值: 10 + PageSize int `json:"page_size,omitempty"` +} + +type AwemeBandedListFiltering struct { + // BandType 屏蔽类型,允许值:CUSTOM_TYPE:自定义规则,根据昵称关键词屏蔽;AWEME_TYPE:根据抖音id屏蔽。 + BandType string `json:"band_type,omitempty"` + // AwemeID 抖音id,抖音id限制长度20,纯数字id不能以0开头。 + AwemeID string `json:"aweme_id,omitempty"` + // NicknameKeyword 昵称关键词,关键词长度不大于40个字符,中文算2个字符。 + NicknameKeyword string `json:"nickname_keyword,omitempty"` +} + +// Encode implement GetRequest interface +func (r AwemeBandedListRequest) Encode() string { + values := &url.Values{} + values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) + if r.Filtering != nil { + filter, _ := json.Marshal(r.Filtering) + values.Set("filtering", string(filter)) + } + if r.Page > 0 { + values.Set("page", strconv.Itoa(r.Page)) + } + if r.PageSize > 0 { + values.Set("page_size", strconv.Itoa(r.PageSize)) + } + return values.Encode() +} + +// AwemeBandedListResponse 获取屏蔽用户列表 API Response +type AwemeBandedListResponse struct { + model.BaseResponse + // Data json 返回值 + Data *AwemeBandedListResponseData `json:"data,omitempty"` +} + +// AwemeBandedListResponseData json 返回值 +type AwemeBandedListResponseData struct { + // PageInfo 分页信息 + PageInfo *model.PageInfo `json:"page_info,omitempty"` + // List 结果列表 + List []BandedAweme `json:"list,omitempty"` +} + +// BandedAweme 屏蔽用户 +type BandedAweme struct { + // AwemeID 抖音id + AwemeID string `json:"aweme_id,omitempty"` + // AwemeName 抖音昵称 + AwemeName string `json:"aweme_name,omitempty"` + // BandedType 屏蔽类型,CUSTOM_TYPE:自定义规则,根据昵称关键词屏蔽;AWEME_TYPE:根据抖音id屏蔽。 + BandedType string `json:"banded_type,omitempty"` + // NicknameKeyword 昵称关键词 + NicknameKeyword string `json:"nickname_keyword,omitempty"` +} diff --git a/marketing-api/model/tools/comment/comment.go b/marketing-api/model/tools/comment/comment.go new file mode 100644 index 00000000..0761ba4a --- /dev/null +++ b/marketing-api/model/tools/comment/comment.go @@ -0,0 +1,41 @@ +package comment + +import "github.com/bububa/oceanengine/marketing-api/enum" + +// Comment 评论 +type Comment struct { + // ID 评论ID + ID uint64 `json:"id,omitempty"` + // AppName app名 + AppName string `json:"app_name,omitempty"` + // UserInfo 评论用户信息 + UserInfo UserInfo `json:"user_info,omitempty"` + // AdID 计划ID + AdID uint64 `json:"ad_id,omitempty"` + // AdName 计划名 + AdName string `json:"ad_name,omitempty"` + // CreativeID 评论所属创意id + CreativeID uint64 `json:"creative_id,omitempty"` + // Text 评论内容 + Text string `json:"text,omitempty"` + // LikeCount 点赞数 + LikeCount int `json:"like_count,omitempty"` + // ReplyCount 评论的回复数量 + ReplyCount int `json:"reply_count,omitempty"` + // Stick 是否置顶,0:表示不置顶,1:表示置顶 + Stick int `json:"stick,omitempty"` + // InBlackList 评论发布者是否在黑名单内,0表示不在,1表示在 + InBlackList int `json:"in_black_list,omitempty"` + // ReplyStatus 评论回复状态,REPLIED表示已回复,NO_REPLY表示未回复 + ReplyStatus enum.CommentReplyStatus `json:"reply_status,omitempty"` + // CreateTime 评论创建时间 + CreateTime string `json:"create_time,omitempty"` +} + +// UserInfo 评论用户信息 +type UserInfo struct { + // UserScreenName 评论用户昵称 + UserScreenName string `json:"user_screen_name,omitempty"` + // AwemeAccount 评论用户抖音号 + AwemeAccount string `json:"aweme_account,omitempty"` +} diff --git a/marketing-api/model/tools/comment/doc.go b/marketing-api/model/tools/comment/doc.go new file mode 100644 index 00000000..b700be08 --- /dev/null +++ b/marketing-api/model/tools/comment/doc.go @@ -0,0 +1,2 @@ +// Package comment 评论管理 +package comment diff --git a/marketing-api/model/tools/comment/get.go b/marketing-api/model/tools/comment/get.go new file mode 100644 index 00000000..4c350e04 --- /dev/null +++ b/marketing-api/model/tools/comment/get.go @@ -0,0 +1,66 @@ +package comment + +import ( + "encoding/json" + "net/url" + "strconv" + + "github.com/bububa/oceanengine/marketing-api/model" +) + +// GetRequest 获取评论列表 API Request +type GetRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // AdIDs 计划id列表,一次最多10个 + AdIDs []uint64 `json:"ad_ids,omitempty"` + // InventoryType 广告位 允许值:"INVENTORY_AWEME_FEED"(抖音) + InventoryType string `json:"inventory_type,omitempty"` + // StartTime 查询起始时间,格式:yyyy-MM-dd,若不填,默认6天前(即获取最近七天的内容) + StartTime string `json:"start_time,omitempty"` + // EndTime 查询截止时间,格式:yyyy-MM-dd,若不填,默认当天 + EndTime string `json:"end_time,omitempty"` + // Page 页数 默认值: 1 + Page int `json:"page,omitempty"` + // PageSize 页面大小默认值: 10 + PageSize int `json:"page_size,omitempty"` +} + +// Encode implement GetRequest interface +func (r GetRequest) Encode() string { + values := &url.Values{} + values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) + if len(r.AdIDs) > 0 { + ids, _ := json.Marshal(r.AdIDs) + values.Set("ad_ids", string(ids)) + } + values.Set("inventory_type", r.InventoryType) + if r.StartTime != "" { + values.Set("start_time", r.StartTime) + } + if r.EndTime != "" { + values.Set("end_time", r.EndTime) + } + if r.Page > 0 { + values.Set("page", strconv.Itoa(r.Page)) + } + if r.PageSize > 0 { + values.Set("page_size", strconv.Itoa(r.PageSize)) + } + return values.Encode() +} + +// GetResponse 获取评论列表 API Response +type GetResponse struct { + model.BaseResponse + // Data json 返回值 + Data *GetResponseData `json:"data,omitempty"` +} + +// GetResponseData json 返回值 +type GetResponseData struct { + // PageInfo 分页信息 + PageInfo *model.PageInfo `json:"page_info,omitempty"` + // CommentsList 评论列表 + CommentsList []Comment `json:"comments_list,omitempty"` +} diff --git a/marketing-api/model/tools/comment/operate.go b/marketing-api/model/tools/comment/operate.go new file mode 100644 index 00000000..0f0f86d1 --- /dev/null +++ b/marketing-api/model/tools/comment/operate.go @@ -0,0 +1,63 @@ +package comment + +import ( + "encoding/json" + + "github.com/bububa/oceanengine/marketing-api/enum" + "github.com/bububa/oceanengine/marketing-api/model" +) + +// OperateRequest 评论操作 API Request +type OperateRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // CommentIDs 评论id列表; operate_type类型为"REPLY_TO_REPLY"、"STICK"、"CANCEL_STICK"时只允许传入1个评论ID;operate_type类型为"REPLY"时,只允许传入小于等于20个评论ID;operate_type类型为"HIDE"时,只允许传入小于等于50个评论ID + CommentIDs []uint64 `json:"comment_ids,omitempty"` + // InventoryType 广告位 允许值:"INVENTORY_AWEME_FEED"(抖音) + InventoryType string `json:"inventory_type,omitempty"` + // OperateType 操作类型,详情见【附录-评论操作类型】;允许值:"REPLY"、"REPLY_TO_REPLY"、"STICK_ON_TOP"、"CANCEL_STICK"、"HIDE"、"BLOCK_USERS"(屏蔽用户目前只支持抖音) + OperateType enum.CommentOperateType `json:"operate_type,omitempty"` + // ReplyText 回复内容,当operate_type为"REPLY","REPLY_TO_REPLY"时必填 + ReplyText string `json:"reply_text,omitempty"` + // ReplyID 回复的id,回复二级评论时传入, 用户可从reply_infos中获取,当operate_type为"REPLY_TO_REPLY"时必填 + ReplyID uint64 `json:"reply_id,omitempty"` +} + +// Encode implement PostRequest interface +func (r OperateRequest) Encode() []byte { + js, _ := json.Marshal(r) + return js +} + +// OperateResponse 评论操作 API Response +type OperateResponse struct { + model.BaseResponse + // Data json 返回值 + Data *OperateResponseData `json:"data,omitempty"` +} + +// OperateResponseData json 返回值 +type OperateResponseData struct { + // ReplyInfos 评论列表 + ReplyInfos []OperateReply `json:"reply_infos,omitempty"` + // SuccessCommentIDs 回复成功的comment_id + SuccessCommentIDs []uint64 `json:"success_comment_ids,omitempty"` +} + +// OperateReply 评论回复 +type OperateReply struct { + // ReplyToCommentID 回复的一级评论ID + ReplyToCommentID json.Number `json:"reply_to_comment_id,omitempty"` + // ID 回复ID + ID json.Number `json:"id,omitempty"` + // ReplyToReplyID 二级回复所属的上级回复ID,只有二级回复才有。二级回复:表示回复“评论中其他回复内容” + ReplyToReplyID json.Number `json:"reply_to_reply_id,omitempty"` + // UserID 回复用户ID + UserID uint64 `json:"user_id,omitempty"` + // ReplyToUserID 回复的那条回复的用户ID,只有二级回复才有 + ReplyToUserID uint64 `json:"reply_to_user_id,omitempty"` + // Text 回复内容 + Text string `json:"text,omitempty"` + // CreateTime 回复创建时间 + CreateTime string `json:"create_time,omitempty"` +} diff --git a/marketing-api/model/tools/comment/reply.go b/marketing-api/model/tools/comment/reply.go new file mode 100644 index 00000000..573d3c20 --- /dev/null +++ b/marketing-api/model/tools/comment/reply.go @@ -0,0 +1,25 @@ +package comment + +import "encoding/json" + +// Reply 评论回复 +type Reply struct { + // ReplyToCommentID 回复的一级评论ID + ReplyToCommentID json.Number `json:"reply_to_comment_id,omitempty"` + // ReplyID 回复ID + ReplyID json.Number `json:"reply_id,omitempty"` + // ReplyToReplyID 二级回复所属的上级回复ID,只有二级回复才有。二级回复:表示回复“评论中其他回复内容” + ReplyToReplyID json.Number `json:"reply_to_reply_id,omitempty"` + // UserInfo 回复用户信息 + UserInfo ReplyUserInfo `json:"user_info,omitempty"` + // ReplyText 回复内容 + ReplyText string `json:"reply_text,omitempty"` + // CreateTime 回复创建时间 + CreateTime string `json:"create_time,omitempty"` +} + +// ReplyUserInfo 回复用户信息 +type ReplyUserInfo struct { + // ScreenName 回复用户昵称 + ScreenName string `json:"screen_name,omitempty"` +} diff --git a/marketing-api/model/tools/comment/reply_get.go b/marketing-api/model/tools/comment/reply_get.go new file mode 100644 index 00000000..f95ea5e3 --- /dev/null +++ b/marketing-api/model/tools/comment/reply_get.go @@ -0,0 +1,52 @@ +package comment + +import ( + "net/url" + "strconv" + + "github.com/bububa/oceanengine/marketing-api/model" +) + +// ReplyGetRequest 获取评论回复列表 API Request +type ReplyGetRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // CommentID 父评论id + CommentID uint64 `json:"comment_id,omitempty"` + // InventoryType 广告位 允许值:"INVENTORY_AWEME_FEED"(抖音) + InventoryType string `json:"inventory_type,omitempty"` + // Page 页数 默认值: 1 + Page int `json:"page,omitempty"` + // PageSize 页面大小默认值: 10 + PageSize int `json:"page_size,omitempty"` +} + +// Encode implement GetRequest interface +func (r ReplyGetRequest) Encode() string { + values := &url.Values{} + values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) + values.Set("comment_id", strconv.FormatUint(r.CommentID, 10)) + values.Set("inventory_type", r.InventoryType) + if r.Page > 0 { + values.Set("page", strconv.Itoa(r.Page)) + } + if r.PageSize > 0 { + values.Set("page_size", strconv.Itoa(r.PageSize)) + } + return values.Encode() +} + +// ReplyGetResponse 获取评论回复列表 API Response +type ReplyGetResponse struct { + model.BaseResponse + // Data json 返回值 + Data *ReplyGetResponseData `json:"data,omitempty"` +} + +// ReplyGetResponseData json 返回值 +type ReplyGetResponseData struct { + // PageInfo 分页信息 + PageInfo *model.PageInfo `json:"page_info,omitempty"` + // ReplyList 评论列表 + ReplyList []Reply `json:"reply_list,omitempty"` +} diff --git a/marketing-api/model/tools/comment/terms_banded_add.go b/marketing-api/model/tools/comment/terms_banded_add.go new file mode 100644 index 00000000..88f46224 --- /dev/null +++ b/marketing-api/model/tools/comment/terms_banded_add.go @@ -0,0 +1,19 @@ +package comment + +import ( + "encoding/json" +) + +// TermsBandedAddRequest 添加屏蔽词 API Request +type TermsBandedAddRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // Terms 待添加的屏蔽词列表; 若添加的屏蔽词已存在,不会再次新增,同一个屏蔽词只会在屏蔽词中记录一次;一次最多添加500个,单个屏蔽词长度范围为0-100 + Terms []string `json:"terms,omitempty"` +} + +// Encode implement PostRequest interface +func (r TermsBandedAddRequest) Encode() []byte { + js, _ := json.Marshal(r) + return js +} diff --git a/marketing-api/model/tools/comment/terms_banded_delete.go b/marketing-api/model/tools/comment/terms_banded_delete.go new file mode 100644 index 00000000..1ac6cef2 --- /dev/null +++ b/marketing-api/model/tools/comment/terms_banded_delete.go @@ -0,0 +1,19 @@ +package comment + +import ( + "encoding/json" +) + +// TermsBandedDeleteRequest 删除屏蔽词 API Request +type TermsBandedDeleteRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // Terms 待删除的屏蔽词列表; 如果删除的屏蔽词不存在也会显示成功; 一次最多操作500个词,单个屏蔽词长度范围为0-100 + Terms []string `json:"terms,omitempty"` +} + +// Encode implement PostRequest interface +func (r TermsBandedDeleteRequest) Encode() []byte { + js, _ := json.Marshal(r) + return js +} diff --git a/marketing-api/model/tools/comment/terms_banded_get.go b/marketing-api/model/tools/comment/terms_banded_get.go new file mode 100644 index 00000000..d65af085 --- /dev/null +++ b/marketing-api/model/tools/comment/terms_banded_get.go @@ -0,0 +1,46 @@ +package comment + +import ( + "net/url" + "strconv" + + "github.com/bububa/oceanengine/marketing-api/model" +) + +// TermsBandedGetRequest 获取屏蔽词列表 API Request +type TermsBandedGetRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // Page 页数 默认值: 1 + Page int `json:"page,omitempty"` + // PageSize 页面大小默认值: 10 + PageSize int `json:"page_size,omitempty"` +} + +// Encode implement GetRequest interface +func (r TermsBandedGetRequest) Encode() string { + values := &url.Values{} + values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) + if r.Page > 0 { + values.Set("page", strconv.Itoa(r.Page)) + } + if r.PageSize > 0 { + values.Set("page_size", strconv.Itoa(r.PageSize)) + } + return values.Encode() +} + +// TermsBandedGetResponse 获取屏蔽词列表 API Response +type TermsBandedGetResponse struct { + model.BaseResponse + // Data json 返回值 + Data *TermsBandedGetResponseData `json:"data,omitempty"` +} + +// TermsBandedGetResponseData json 返回值 +type TermsBandedGetResponseData struct { + // PageInfo 分页信息 + PageInfo *model.PageInfo `json:"page_info,omitempty"` + // Terms 屏蔽词列表 + Terms []string `json:"terms,omitempty"` +} diff --git a/marketing-api/model/tools/comment/terms_banded_update.go b/marketing-api/model/tools/comment/terms_banded_update.go new file mode 100644 index 00000000..6be2af14 --- /dev/null +++ b/marketing-api/model/tools/comment/terms_banded_update.go @@ -0,0 +1,21 @@ +package comment + +import ( + "encoding/json" +) + +// TermsBandedUpdateRequest 更新屏蔽词 API Request +type TermsBandedUpdateRequest struct { + // AdvertiserID 广告主ID + AdvertiserID uint64 `json:"advertiser_id,omitempty"` + // OriginTerms 待更新的屏蔽词; 屏蔽词长度范围为0-100 + OriginTerms []string `json:"origin_terms,omitempty"` + // 更新后的屏蔽词; 如果new_terms已存在,则等同于删除origin_terms;如果origin_terms不存在,则等同于新增new_terms; 屏蔽词长度范围为0-100 + NewTerms []string `json:"new_terms,omitempty"` +} + +// Encode implement PostRequest interface +func (r TermsBandedUpdateRequest) Encode() []byte { + js, _ := json.Marshal(r) + return js +}