Files
IUQT/weMedia/idl/moment.thrift
2025-08-14 19:41:27 +08:00

447 lines
12 KiB
Thrift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace go moment
enum Code {
Success = 1
ParamInvalid = 2
DBErr = 3
ServerError = 4
}
// 动态可见性枚举
enum MomentVisibility {
VISIBILITY_PUBLIC = 1 // 公开
VISIBILITY_FANS_ONLY = 2 // 仅关注可见
VISIBILITY_SELF_ONLY = 3 // 仅自己可见
}
// 动态/评论状态枚举
enum ContentStatus {
CONTENT_STATUS_DELETED = 0 // 已删除
CONTENT_STATUS_NORMAL = 1 // 正常
}
// 动态图片结构体
struct MomentFile {
1: i64 id // ID
2: i64 moment_id // 所属动态ID
3: string file_url // 文件URL
4: string file_type // 文件类型
5: i8 sort_order //文件顺序
}
// 动态点赞结构体
struct MomentLike {
1: i64 id // 点赞ID
2: i64 moment_id // 动态ID
3: string user_id // 点赞用户ID
4: string created_at // 点赞时间
}
// 评论文件结构体
struct CommentFile {
1: i64 id // ID
2: i64 comment_id // 所属评论ID
3: string file_url // 文件URL
4: string file_type // 文件类型
5: i8 sort_order //文件顺序
}
// 动态评论结构体
struct MomentComment {
1: i64 id // 评论ID
2: i64 moment_id // 动态ID
3: string user_id // 评论用户ID
4: string content // 评论内容
5: i64 parent_id // 父评论ID用于回复
6: string created_at // 创建时间
7: list<CommentFile> files //评论文件
}
// 动态结构体
struct Moment {
1: i64 id // 动态ID
2: string user_id // 发布者用户ID
5: string content // 动态内容
6: MomentVisibility visibility // 可见性
7: string location // 发布地点
8: ContentStatus status // 状态
9: i32 like_count // 点赞数
10: i32 comment_count // 评论数
11: list<MomentFile> files // 动态文件列表
12: string created_at // 创建时间
13: string updated_at // 更新时间
}
// 发布动态请求
struct CreateMomentRequest {
1: string user_id // 发布者用户ID
2: string content // 动态内容
3: MomentVisibility visibility // 可见性,默认公开
4: string location // 发布地点
5: list<MomentFile> file_urls // 图片URL列表
}
// 发布动态响应
struct CreateMomentResponse {
1: Code code
2: string msg
}
// 获取动态列表请求
struct ListMomentsRequest {
1: string user_id // 当前用户ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取动态列表响应
struct ListMomentsResponse {
1: Code code
2: list<Moment> moments // 动态列表
3: i32 total // 总数量
}
// 删除动态请求
struct DeleteMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 删除动态响应
struct DeleteMomentResponse {
1: Code code
2: string msg
}
// 点赞动态请求
struct LikeMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 点赞动态响应
struct LikeMomentResponse {
1: Code code
2: string msg // 提示信息
}
// 取消点赞请求
struct UnlikeMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 取消点赞响应
struct UnlikeMomentResponse {
1: Code code
2: string msg
}
// 获取动态点赞列表请求
struct ListMomentLikesRequest {
1: i64 moment_id // 动态ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认20
}
// 获取动态点赞列表响应
struct ListMomentLikesResponse {
1: Code code
2: list<string> likes // 点赞列表
3: i32 total // 总数量
}
//获取指定用户喜欢动态列表请求
struct ListUserLikesRequest{
1: i64 user_id // ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认20
}
// 获取指定用户喜欢动态列表响应
struct ListUserLikesResponse {
1: Code code
2: list<Moment> likes // 点赞列表
3: i32 total // 总数量
}
// 收藏动态请求
struct CollectMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 收藏动态响应
struct CollectMomentResponse {
1: Code code
2: string msg // 提示信息
}
// 取消收藏动态请求
struct UnCollectMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
}
// 取消收藏动态响应
struct UnCollectMomentResponse {
1: Code code
2: string msg // 提示信息
}
//获取指定用户收藏动态列表请求
struct ListUserCollectsRequest{
1: i64 user_id // ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认20
}
// 获取指定用户收藏动态列表响应
struct ListUserCollectsResponse {
1: Code code
2: list<Moment> likes // 点赞列表
3: i32 total // 总数量
}
// 评论动态请求
struct CommentMomentRequest {
1: string user_id // 当前用户ID
2: i64 moment_id // 动态ID
3: string content // 评论内容
4: i64 parent_id // 父评论ID用于回复
5: list<CommentFile> files //评论文件
}
// 评论动态响应
struct CommentMomentResponse {
1: Code code // 是否成功
2: string msg // 提示信息
}
// 获取动态评论列表请求
struct ListMomentCommentsRequest {
1: i64 moment_id // 动态ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取动态评论列表响应
struct ListMomentCommentsResponse {
1: Code code
2: list<MomentComment> comments // 评论列表
3: i32 total // 总数量
4: string msg // 提示信息
}
// 删除评论请求
struct DeleteCommentRequest {
1: string user_id // 当前用户ID
2: i64 comment_id // 评论ID
}
// 删除评论响应
struct DeleteCommentResponse {
1: Code code
2: string msg
}
struct ListMomentsAppointRequest {
1: string user_id // 当前用户ID
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取动态列表响应
struct ListMomentsAppointResponse {
1: Code code
2: list<Moment> moments // 动态列表
3: i32 total // 总数量
}
struct TagInfo{
1: i32 id
2: string tag_name
}
struct CreateTagResponse {
1: Code code
2: string msg
}
struct CreateTagRequest {
1: string tag_name
2: string user_id
}
struct DeleteTagResponse {
1: Code code
2: string msg
}
struct DeleteTagRequest {
1: string tag_name
2: string user_id
}
struct ListTagResponse{
1: Code code
2: string msg
3: list<TagInfo> tags
4: i32 total
}
struct ListTagRequest{
1: string user_id
2: i32 page // 页码默认1
3: i32 page_size // 每页数量
}
struct FindTagRequest{
1: string keyword // 关键字
2: i32 page // 页码默认1
3: i32 page_size // 每页数量
}
struct FindTagResponse{
1: Code code
2: list<TagInfo> tags
3: i32 total
}
struct BindTagResponse{
1: Code code
2: string msg
}
struct BindTagRequest{
1: i32 moment_id
2: list<i32> tag_id
}
// 获取指定tag动态列表请求
struct ListMomentsByTagRequest {
1: i32 tag_id
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取指定tag动态列表响应
struct ListMomentsByTagResponse {
1: Code code
2: list<Moment> moments // 动态列表
3: i32 total // 总数量
}
struct CategoryInfo{
1: i32 id
2: string category_name
}
struct ListCategoryResponse{
1: Code code
2: string msg
3: list<CategoryInfo> categorys
}
struct ListCategoryRequest{
1: string user_id
}
struct BindCategoryResponse{
1: Code code
2: string msg
}
struct BindCategoryRequest{
1: i32 moment_id
2: list<i32> category_id
}
// 获取指定分类动态列表请求
struct ListMomentsByCategoryRequest {
1: i32 category_id
2: i32 page // 页码默认1
3: i32 page_size // 每页数量默认10
}
// 获取指定分类动态列表响应
struct ListMomentsByCategoryResponse {
1: Code code
2: list<Moment> moments // 动态列表
3: i32 total // 总数量
}
// 动态服务接口
service MomentsService {
// 发布动态
CreateMomentResponse CreateMoment(1: CreateMomentRequest req)(api.post="/v1/weMedia/moments/")
// 获取动态列表
ListMomentsResponse ListMoments(1: ListMomentsRequest req)(api.get="/v1/weMedia/moments/list/")
//获取指定用户动态列表
ListMomentsAppointResponse ListMomentsAppoint(1: ListMomentsAppointRequest req)(api.get="/v1/weMedia/moments/user/list/")
// 删除动态
DeleteMomentResponse DeleteMoment(1: DeleteMomentRequest req)(api.delete="/v1/weMedia/moments/")
// 点赞动态
LikeMomentResponse LikeMoment(1: LikeMomentRequest req)(api.post="/v1/weMedia/moments/like/")
// 取消点赞
UnlikeMomentResponse UnlikeMoment(1: UnlikeMomentRequest req)(api.post="/v1/weMedia/moments/dislike/")
// 获取动态点赞列表
ListMomentLikesResponse ListMomentLikes(1: ListMomentLikesRequest req)(api.get="/v1/weMedia/moments/like/list/")
//获取指定用户喜欢列表
ListUserLikesResponse ListUserLikes(1: ListUserLikesRequest req)(api.get="/v1/weMedia/moments/userlike/list/")
// 收藏动态
CollectMomentResponse CollectMoment(1: CollectMomentRequest req)(api.post="/v1/weMedia/moments/collect/")
// 取消收藏
UnCollectMomentResponse UnCollectMoment(1: UnCollectMomentRequest req)(api.post="/v1/weMedia/moments/unCollect/")
//获取指定用户喜欢列表
ListUserCollectsResponse ListUserCollects(1: ListUserCollectsRequest req)(api.get="/v1/weMedia/moments/userCollects/list/")
// 评论动态
CommentMomentResponse CommentMoment(1: CommentMomentRequest req)(api.post="/v1/weMedia/moments/comment/")
// 获取动态评论列表
ListMomentCommentsResponse ListMomentComments(1: ListMomentCommentsRequest req)(api.get="/v1/weMedia/moments/comment/list/")
// 删除评论
DeleteCommentResponse DeleteComment(1: DeleteCommentRequest req)(api.delete="/v1/weMedia/moments/comment/")
//新增tag
CreateTagResponse CreateTag(1: CreateTagRequest req)(api.post="/v1/weMedia/moments/tag/")
//删除tag
DeleteTagResponse DeleteTag(1: DeleteTagRequest req)(api.delete="/v1/weMedia/moments/tag/")
//获取tag列表
ListTagResponse ListTag(1: ListTagRequest req)(api.get="/v1/weMedia/moments/tag/")
//获取tag列表
FindTagResponse FandTag(1: FindTagRequest req)(api.get="/v1/weMedia/moments/tag/find/")
//绑定tag
BindTagResponse BindTag(1: BindTagRequest req)(api.post="/v1/weMedia/moments/tag/bind/")
//通过tag获取文章列表
ListMomentsByTagResponse ListMomentsByTag(1: ListMomentsByTagRequest req)(api.get="/v1/weMedia/moments/tag/list/")
//获取分类列表
ListCategoryResponse ListCategory(1: ListCategoryRequest req)(api.get="/v1/weMedia/moments/category/")
//绑定分类
BindCategoryResponse BindCategory(1: BindCategoryRequest req)(api.post="/v1/weMedia/moments/category/")
//通过分类获取文章列表
ListMomentsByCategoryResponse ListMomentsByCategory(1: ListMomentsByCategoryRequest req)(api.get="/v1/weMedia/moments/category/list/")
}