app-cloudep-tweeting-service/generate/protobuf/tweeting.proto

231 lines
6.8 KiB
Protocol Buffer
Raw Normal View History

2024-08-28 09:09:01 +00:00
syntax = "proto3";
2024-08-28 14:24:47 +00:00
package tweeting;
option go_package="./tweeting";
2024-08-28 09:09:01 +00:00
// 基本回應
message OKResp {}
// 空的請求
message NoneReq {}
// 分頁信息
message Pager {
int64 total =1; // 總數量
int64 size=2; // 每頁數量
int64 index=3; // 當前頁碼
}
2024-08-29 01:08:15 +00:00
message Media{
string type =1;
string url =2;
}
2024-08-28 09:09:01 +00:00
// 新增貼文的請求
message NewPostReq {
2024-08-29 01:08:15 +00:00
string uid = 1; // 發佈貼文的用戶ID
2024-08-28 09:09:01 +00:00
string content = 2; // 貼文內容
repeated string tags = 3; // 貼文相關標籤
2024-08-29 01:08:15 +00:00
repeated Media media = 4; // 這筆文章的所有 Media URL
2024-08-28 09:09:01 +00:00
bool is_ad = 5; // 是否為廣告
}
// 貼文回應
message PostResp {
string post_id = 1; // 創建成功的貼文ID
}
// 刪除貼文的請求
message DeletePostsReq {
repeated string post_id = 1; // 貼文ID
}
// 更新貼文的請求
message UpdatePostReq {
string post_id = 1; // 貼文ID
repeated string tags = 2; // 新的標籤列表
2024-08-29 01:08:15 +00:00
repeated Media media = 3; // 這筆文章的所有 Media URL
2024-08-28 09:09:01 +00:00
optional string content = 4; // 新的貼文內容
optional int64 like_count = 5; // 喜歡數量
optional int64 dislike_count = 6; // 不喜歡數量
}
// 查詢貼文的請求
message QueryPostsReq {
2024-08-29 09:33:57 +00:00
repeated string uid = 1; // 可選根據用戶ID篩選貼文
repeated string id = 2; // 可選根據貼文ID篩選貼文
optional int32 only_ads = 4; // 可選:是否只顯示廣告 0 不篩選 1 只顯示廣告 2 不顯示廣告
2024-08-28 09:09:01 +00:00
int32 page_index = 5; // 分頁的頁碼
int32 page_size = 6; // 每頁顯示的數量
}
// 貼文詳情
message PostDetailItem {
string post_id = 1; // 貼文ID
2024-08-29 09:33:57 +00:00
string uid = 2; // 發佈用戶ID
2024-08-28 09:09:01 +00:00
string content = 3; // 貼文內容
repeated string tags = 4; // 標籤
2024-08-29 01:08:15 +00:00
repeated Media media = 5; // 圖片URL
2024-08-28 09:09:01 +00:00
bool is_ad = 6; // 是否為廣告
int64 created_at = 7; // 發佈時間
int64 update_at = 8; // 更新時間
int64 like_count = 9; // 讚數
int64 dislike_count = 10; // 不喜歡數量
}
// 貼文列表回應
message ListPostsResp {
repeated PostDetailItem posts = 1; // 貼文列表
Pager page =2;
}
// 讚/不讚請求
message LikeReq {
string target_id = 1; // 目標ID可以是貼文ID或評論ID
2024-08-29 13:26:01 +00:00
string uid = 2; // 點讚的用戶ID
2024-08-28 09:09:01 +00:00
int64 like_type = 3; // 讚或爛的類型
}
2024-08-29 13:26:01 +00:00
message GetLikeStatusReq{
string uid = 1; // 點讚的用戶ID
repeated string target_id = 2; // 目標ID可以是貼文ID或評論ID
int64 like_type = 3; // 讚或爛的類型
}
message GetLikeStatusItem{
string target_id = 1; // 目標ID可以是貼文ID或評論ID
bool status = 2; // 是否有按過
}
message GetLikeStatusResp{
repeated GetLikeStatusItem data = 1; // 目標ID可以是貼文ID或評論ID
}
2024-08-28 09:09:01 +00:00
// 讚/不讚項目
message LikeItem {
string target_id = 1; // 目標ID可以是貼文ID或評論ID
2024-08-29 13:26:01 +00:00
string uid = 2; // 點讚的用戶ID
2024-08-28 09:09:01 +00:00
int64 like_type = 3; // 讚或爛的類型
}
// 讚/不讚列表請求
message LikeListReq {
string target_id = 1; // 目標ID可以是貼文ID或評論ID
int64 like_type = 2; // 讚或爛的類型
2024-08-29 13:26:01 +00:00
int64 page_index = 3; // 當前頁碼
int64 page_size = 4; // 每頁顯示數量
2024-08-28 09:09:01 +00:00
}
// 讚/不讚列表回應
message LikeListResp {
repeated LikeItem list = 1; // 讚/不讚列表
Pager page = 2;
}
// 讚/不讚數量請求
message LikeCountReq {
string target_id = 1; // 目標ID可以是貼文ID或評論ID
int64 like_type = 2; // 讚或爛的類型
}
// 讚/不讚數量回應
message LikeCountResp {
2024-08-29 14:49:42 +00:00
int64 count = 1; // 總共按讚數量
2024-08-28 09:09:01 +00:00
}
// 評論貼文的請求
message CommentPostReq {
string post_id = 1; // 貼文ID
int64 user_id = 2; // 評論者ID
string content = 3; // 評論內容
}
// 查詢評論的請求
message GetCommentsReq {
string post_id = 1; // 貼文ID
int32 page_index = 2; // 分頁頁碼
int32 page_size = 3; // 每頁顯示數量
}
// 評論詳情
message CommentDetail {
string comment_id = 1; // 評論ID
int64 user_id = 2; // 評論者ID
string content = 3; // 評論內容
int64 created_at = 4; // 創建時間
int64 like_count = 5; // 讚數
int64 dislike_count = 6; // 不喜歡數量
}
// 評論列表回應
message GetCommentsResp {
repeated CommentDetail comments = 1; // 評論列表
Pager page = 2;
}
// 刪除評論請求
message DeleteCommentReq {
string comment_id = 1; // 評論ID
}
// 更新評論請求
message UpdateCommentReq {
string comment_id = 1; // 評論ID
string content = 2; // 更新後的評論內容
}
2024-08-29 14:49:42 +00:00
message PostReactionActionResp {
string PostID =1; // 貼文的 ID
int64 reaction_type = 2; // 用戶的反應類型,可能是讚或不讚
bool is_increment = 3; // 表示是否增加true 表示增加false 表示減少)
}
message IncDecLikeDislikeCountReq {
string PostID =1; // 貼文的 ID
int64 reaction_type = 2; // 用戶的反應類型,可能是讚或不讚
bool is_increment = 3; // 表示是否增加true 表示增加false 表示減少)
}
2024-08-28 09:09:01 +00:00
// 定義貼文服務
service PostService {
// NewPost 新增貼文
rpc NewPost(NewPostReq) returns(PostResp);
// DeletePost 刪除貼文
rpc DeletePost(DeletePostsReq) returns (OKResp);
// UpdatePost 更新貼文
rpc UpdatePost(UpdatePostReq) returns (OKResp);
// ListPosts 查詢貼文
rpc ListPosts(QueryPostsReq) returns (ListPostsResp);
2024-08-29 14:49:42 +00:00
// IncDecLikeDislikeCount 增減數量
rpc IncDecLikeDislikeCount(IncDecLikeDislikeCountReq) returns (OKResp);
2024-08-28 09:09:01 +00:00
// Like 點讚/取消讚 貼文
2024-08-29 14:49:42 +00:00
rpc Like(LikeReq) returns (PostReactionActionResp);
2024-08-28 09:09:01 +00:00
// GetLikeStatus 取得讚/不讚狀態
2024-08-29 13:26:01 +00:00
rpc GetLikeStatus(GetLikeStatusReq) returns (GetLikeStatusResp);
2024-08-28 09:09:01 +00:00
// LikeList 取得讚/不讚列表
rpc LikeList(LikeListReq) returns (LikeListResp);
// CountLike 取得讚/不讚數量
rpc CountLike(LikeCountReq) returns (LikeCountResp);
}
// 定義評論服務
service CommentService {
// NewComment 發表評論
rpc NewComment(CommentPostReq) returns (OKResp);
// GetComments 查詢評論
rpc GetComments(GetCommentsReq) returns (GetCommentsResp);
// DeleteComment 刪除評論
rpc DeleteComment(DeleteCommentReq) returns (OKResp);
// UpdateComment 更新評論
rpc UpdateComment(UpdateCommentReq) returns (OKResp);
// LikeComment 點讚/取消讚 評論
rpc LikeComment(LikeReq) returns (OKResp);
// GetLikeStatus 取得讚/不讚評論狀態
rpc GetLikeStatus(LikeReq) returns (OKResp);
// LikeList 取得讚/不讚評論列表
rpc LikeList(LikeListReq) returns (LikeListResp);
// CountLike 取得讚/不讚評論數量
rpc CountLike(LikeCountReq) returns (LikeCountResp);
}