| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541 |
- syntax = "v1"
- info (
- title: "SlowWildServer API"
- desc: "This is the API definition for SlowWildServer"
- version: "1.0.0"
- )
- type (
- UserEntity {
- id int64 `json:"id"`
- avatar string `json:"avatar"`
- nickname string `json:"nickname"`
- username string `json:"username"`
- phone string `json:"phone"`
- status int32 `json:"status"`
- sex int32 `json:"sex"`
- follows int64 `json:"follows"`
- followings int64 `json:"followings"`
- get_likes_count int32 `json:"get_likes_count"`
- get_collection_count int32 `json:"get_collection_count"`
- }
- UserInfo {
- id int64 `json:"id"`
- avatar string `json:"avatar"`
- nickname string `json:"nickname"`
- sex int32 `json:"sex"`
- }
- FollowUserInfo {
- user UserInfo `json:"user"`
- is_mutual_follow bool `json:"is_mutual_follow"`
- }
- LoginAndRegisterRsp {
- token string `json:"token"`
- expire int64 `json:"expire"`
- }
- LoginReq {
- phone string `json:"phone"`
- password string `json:"password"`
- code string `json:"code"`
- login_type int32 `json:"login_type"`
- login_ip string `json:"login_ip"`
- }
- RegisterReq {
- phone string `json:"phone"`
- nickname string `json:"nickname"`
- password string `json:"password"`
- avatar string `json:"avatar"`
- sex int32 `json:"sex"`
- username string `json:"username"`
- code string `json:"code"`
- }
- GetUserInfoReq {
- user_id int64 `json:"user_id"`
- query_user_id int64 `json:"query_user_id"`
- }
- GetUserInfoResp {
- id int64 `json:"id"`
- avatar string `json:"avatar"`
- nickname string `json:"nickname"`
- sex int32 `json:"sex"`
- is_follow bool `json:"is_follow"`
- }
- FindUserReq {
- username string `json:"username"`
- phone string `json:"phone"`
- ids []int64 `json:"ids"`
- }
- FindUserResp {
- user_list []UserInfo `json:"user_list"`
- }
- FollowUserReq {
- user_id int64 `json:"user_id"`
- follow_user_id int64 `json:"follow_user_id"`
- }
- FollowUserRes {
- success bool `json:"success"`
- }
- UnFollowUserReq {
- user_id int64 `json:"user_id"`
- un_follow_user_id int64 `json:"un_follow_user_id"`
- }
- UnFollowUserRes {
- success bool `json:"success"`
- }
- GetFollowingReq {
- user_id int64 `json:"user_id"`
- page_size int32 `json:"page_size"`
- page int32 `json:"page"`
- query_user_id int64 `json:"query_user_id"`
- }
- GetFollowingRes {
- list []FollowUserInfo `json:"list"`
- total int64 `json:"total"`
- }
- GetFollowReq {
- user_id int64 `json:"user_id"`
- page_size int32 `json:"page_size"`
- page int32 `json:"page"`
- query_user_id int64 `json:"query_user_id"`
- }
- GetFollowRes {
- list []FollowUserInfo `json:"list"`
- total int64 `json:"total"`
- }
- GetUserProfileReq {
- user_id int64 `json:"user_id"`
- }
- GetUserProfileRes {
- id int64 `json:"id"`
- nickname string `json:"nickname"`
- username string `json:"username"`
- status int32 `json:"status"`
- avatar string `json:"avatar"`
- phone string `json:"phone"`
- tweet_count int32 `json:"tweet_count"`
- is_following bool `json:"is_following"`
- created_on int64 `json:"created_on"`
- follows int64 `json:"follows"`
- fans int64 `json:"fans"`
- get_likes_count int32 `json:"get_likes_count"`
- get_collection_count int32 `json:"get_collection_count"`
- sex int32 `json:"sex"`
- }
- SearchUsernameReq {
- keyword string `json:"keyword"`
- page int32 `json:"page"`
- page_size int32 `json:"page_size"`
- user_id int64 `json:"user_id"`
- }
- SearchUsernameItem {
- nickname string `json:"nickname"`
- avatar string `json:"avatar"`
- id int64 `json:"id"`
- sex int32 `json:"sex"`
- is_follow bool `json:"is_follow"`
- }
- SearchUsernameRes {
- list []SearchUsernameItem `json:"list"`
- total int64 `json:"total"`
- }
- CreateTag {
- name string `json:"name"`
- id int64 `json:"id"`
- }
- CreatePostReq {
- user_id int64 `json:"user_id"`
- title string `json:"title"`
- content string `json:"content"`
- tags []CreateTag `json:"tags"`
- at_user_ids []int64 `json:"at_user_ids"`
- post_type int32 `json:"post_type"`
- visibility int32 `json:"visibility"`
- images []string `json:"images"`
- video_cover string `json:"video_cover"`
- video_url string `json:"video_url"`
- ip string `json:"ip"`
- ip_loc string `json:"ip_loc"`
- }
- CreatePostRsp {
- post_id int64 `json:"post_id"`
- }
- GetTagListReq {
- page int32 `json:"page"`
- page_size int32 `json:"page_size"`
- tag_name string `json:"tag_name"`
- sort_by int32 `json:"sort_by"`
- }
- TagItem {
- name string `json:"name"`
- hot_num int64 `json:"hot_num"`
- user UserInfo `json:"user"`
- id int64 `json:"id"`
- created_on int64 `json:"created_on"`
- }
- GetTagListRsp {
- tag_list []TagItem `json:"tag_list"`
- total int32 `json:"total"`
- }
- GetTagReq {
- tag_id int64 `json:"tag_id"`
- user_id int64 `json:"user_id"`
- }
- GetTagRsp {
- name string `json:"name"`
- hot_num int64 `json:"hot_num"`
- user UserInfo `json:"user"`
- id int64 `json:"id"`
- created_on int64 `json:"created_on"`
- post_count int64 `json:"post_count"`
- follow_count int64 `json:"follow_count"`
- is_followed bool `json:"is_followed"`
- }
- GetPostListReq {
- page int32 `json:"page"`
- page_size int32 `json:"page_size"`
- search_type int32 `json:"search_type"`
- sort_type int32 `json:"sort_type"`
- keyword string `json:"keyword"`
- user_id int64 `json:"user_id"`
- }
- GetPostListItem {
- id int64 `json:"id"`
- user UserInfo `json:"user"`
- title string `json:"title"`
- content_summary string `json:"content_summary"`
- post_type int32 `json:"post_type"`
- comment_count int64 `json:"comment_count"`
- upvote_count int64 `json:"upvote_count"`
- collection_count int64 `json:"collection_count"`
- share_count int64 `json:"share_count"`
- visibility int32 `json:"visibility"`
- ip_loc string `json:"ip_loc"`
- hot_num int64 `json:"hot_num"`
- images []string `json:"images"`
- video_url string `json:"video_url"`
- video_cover string `json:"video_cover"`
- created_on int64 `json:"created_on"`
- tags []TagItem `json:"tags"`
- is_liked bool `json:"is_liked"`
- is_collected bool `json:"is_collected"`
- is_mine bool `json:"is_mine"`
- }
- GetPostListRsp {
- list []GetPostListItem `json:"list"`
- total int64 `json:"total"`
- }
- GetPostReq {
- user_id int64 `json:"user_id"`
- post_id int64 `json:"post_id"`
- }
- GetPostRsp {
- id int64 `json:"id"`
- user UserInfo `json:"user"`
- title string `json:"title"`
- content_summary string `json:"content_summary"`
- post_type int32 `json:"post_type"`
- comment_count int64 `json:"comment_count"`
- upvote_count int64 `json:"upvote_count"`
- collection_count int64 `json:"collection_count"`
- share_count int64 `json:"share_count"`
- visibility int32 `json:"visibility"`
- ip_loc string `json:"ip_loc"`
- hot_num int64 `json:"hot_num"`
- images []string `json:"images"`
- video_url string `json:"video_url"`
- video_cover string `json:"video_cover"`
- content string `json:"content"`
- created_on int64 `json:"created_on"`
- tags []TagItem `json:"tags"`
- with_user []UserInfo `json:"with_user"`
- latest_replied_on int64 `json:"latest_replied_on"`
- is_liked bool `json:"is_liked"`
- is_collected bool `json:"is_collected"`
- is_mine bool `json:"is_mine"`
- }
- PostUpvoteReq {
- post_id int64 `json:"post_id"`
- user_id int64 `json:"user_id"`
- }
- PostUpvoteRsp {
- success bool `json:"success"`
- }
- PostCollectionReq {
- post_id int64 `json:"post_id"`
- user_id int64 `json:"user_id"`
- }
- PostCollectionRsp {
- success bool `json:"success"`
- }
- PostShareReq {
- post_id int64 `json:"post_id"`
- user_id int64 `json:"user_id"`
- }
- PostShareRsp {
- success bool `json:"success"`
- }
- PostCommentReq {
- post_id int64 `json:"post_id"`
- user_id int64 `json:"user_id"`
- content string `json:"content"`
- image string `json:"image"`
- at_user_id int64 `json:"at_user_id"`
- ip string `json:"ip"`
- ip_loc string `json:"ip_loc"`
- }
- PostCommentRsp {
- comment_id int64 `json:"comment_id"`
- }
- PostReplyReq {
- post_id int64 `json:"post_id"`
- user_id int64 `json:"user_id"`
- content string `json:"content"`
- image string `json:"image"`
- at_user_id int64 `json:"at_user_id"`
- ip string `json:"ip"`
- ip_loc string `json:"ip_loc"`
- comment_id int64 `json:"comment_id"`
- to_reply_id int64 `json:"to_reply_id"`
- }
- PostReplyRsp {
- reply_id int64 `json:"reply_id"`
- }
- GetPostCommentListReq {
- page int32 `json:"page"`
- page_size int32 `json:"page_size"`
- post_id int64 `json:"post_id"`
- user_id int64 `json:"user_id"`
- }
- RepliesItem {
- id int64 `json:"id"`
- post_id int64 `json:"post_id"`
- user UserInfo `json:"user"`
- ip_loc string `json:"ip_loc"`
- content string `json:"content"`
- image string `json:"image"`
- with_user []UserInfo `json:"with_user"`
- upvote_count int64 `json:"upvote_count"`
- is_liked bool `json:"is_liked"`
- is_mine bool `json:"is_mine"`
- created_on int64 `json:"created_on"`
- }
- CommentItem {
- id int64 `json:"id"`
- post_id int64 `json:"post_id"`
- user UserInfo `json:"user"`
- ip_loc string `json:"ip_loc"`
- content string `json:"content"`
- image string `json:"image"`
- with_user []UserInfo `json:"with_user"`
- reply_count int64 `json:"reply_count"`
- upvote_count int64 `json:"upvote_count"`
- reply_item []RepliesItem `json:"reply_item"`
- is_liked bool `json:"is_liked"`
- is_mine bool `json:"is_mine"`
- created_on int64 `json:"created_on"`
- }
- GetPostCommentListRsp {
- list []CommentItem `json:"list"`
- total int64 `json:"total"`
- }
- GetReplyListReq {
- page int32 `json:"page"`
- page_size int32 `json:"page_size"`
- comment_id int64 `json:"comment_id"`
- user_id int64 `json:"user_id"`
- }
- GetReplyListRsp {
- list []RepliesItem `json:"list"`
- total int64 `json:"total"`
- }
- PostCommentUpvoteReq {
- user_id int64 `json:"user_id"`
- comment_id int64 `json:"comment_id"`
- comment_type int32 `json:"comment_type"`
- }
- PostCommentUpvoteRsp {
- success bool `json:"success"`
- }
- PostDeleteReq {
- user_id int64 `json:"user_id"`
- post_id int64 `json:"post_id"`
- }
- PostDeleteRsp {
- success bool `json:"success"`
- }
- CommentDeleteReq {
- user_id int64 `json:"user_id"`
- comment_id int64 `json:"comment_id"`
- comment_type int32 `json:"comment_type"`
- }
- CommentDeleteRsp {
- success bool `json:"success"`
- }
- GetUserPostListReq {
- user_id int64 `json:"user_id"`
- page int64 `json:"page"`
- page_size int64 `json:"page_size"`
- query_user_id int64 `json:"query_user_id"`
- }
- GetUserPostListRsp {
- list []GetPostListItem `json:"list"`
- total int64 `json:"total"`
- }
- GetUserPostCollectionListReq {
- user_id int64 `json:"user_id"`
- page int64 `json:"page"`
- page_size int64 `json:"page_size"`
- query_user_id int64 `json:"query_user_id"`
- }
- GetUserPostCollectionListRsp {
- list []GetPostListItem `json:"list"`
- total int64 `json:"total"`
- }
- GetUserPostLikeListReq {
- user_id int64 `json:"user_id"`
- page int64 `json:"page"`
- page_size int64 `json:"page_size"`
- query_user_id int64 `json:"query_user_id"`
- }
- GetUserPostLikeListRsp {
- list []GetPostListItem `json:"list"`
- total int64 `json:"total"`
- }
- )
- @server (
- perfix: /v1
- )
- service slowwild {
- @doc "登录方法"
- @handler login
- post /api/user/login (LoginReq) returns (LoginAndRegisterRsp)
- @doc "用户注册"
- @handler register
- post /api/user/register (RegisterReq) returns (LoginAndRegisterRsp)
- }
- @server (
- perfix: /v1
- jwt: Auth // 开启 jwt 认证
- )
- service slowwild {
- @doc "获取用户信息"
- @handler getUserInfo
- get /api/user/info (GetUserInfoReq) returns (GetUserInfoResp)
- @doc "查询用户"
- @handler findUser
- post /api/user/find (FindUserReq) returns (FindUserResp)
- @doc "关注用户"
- @handler followUser
- post /api/user/follow (FollowUserReq) returns (FollowUserRes)
- @doc "取消关注用户"
- @handler unfollowUser
- post /api/user/unfollow (UnFollowUserReq) returns (UnFollowUserRes)
- @doc "获取粉丝"
- @handler getFans
- get /api/user/fans (GetFollowingReq) returns (GetFollowingRes)
- @doc "获取关注列表"
- @handler getFollows
- get /api/user/follows (GetFollowReq) returns (GetFollowRes)
- @doc "获取用户信息"
- @handler getUserProfile
- get /api/user/profile (GetUserProfileReq) returns (GetUserProfileRes)
- @doc "搜索用户"
- @handler searchUsername
- get /api/user/search (SearchUsernameReq) returns (SearchUsernameRes)
- }
- @server (
- perfix: /v1
- jwt: Auth
- )
- service slowwild {
- @doc "创建帖子"
- @handler createPost
- post /api/post/create (CreatePostReq) returns (CreatePostRsp)
- @doc "帖子点赞"
- @handler postUpvote
- post /api/post/upvote (PostUpvoteReq) returns (PostUpvoteRsp)
- @doc "帖子收藏"
- @handler postCollection
- post /api/post/collection (PostCollectionReq) returns (PostCollectionRsp)
- @doc "帖子分享"
- @handler postShare
- post /api/post/share (PostShareReq) returns (PostShareRsp)
- @doc "发布评论"
- @handler postComment
- post /api/post/comment (PostCommentReq) returns (PostCommentRsp)
- @doc "回复评论"
- @handler postReply
- post /api/post/reply (PostReplyReq) returns (PostReplyRsp)
- @doc "评论点赞"
- @handler postCommentUpvote
- post /api/post/comment/upvote (PostCommentUpvoteReq) returns (PostCommentUpvoteRsp)
- @doc "帖子删除"
- @handler postDelete
- post /api/post/delete (PostDeleteReq) returns (PostDeleteRsp)
- @doc "评论删除"
- @handler commentDelete
- post /api/comment/delete (CommentDeleteReq) returns (CommentDeleteRsp)
- }
- @server (
- perfix: /v1
- middleware: OptionalJwtMiddleware
- )
- service slowwild {
- @doc "获取话题列表"
- @handler getTagList
- get /api/tag/list (GetTagListReq) returns (GetTagListRsp)
- @doc "获取话题详情"
- @handler getTag
- get /api/tag (GetTagReq) returns (GetTagRsp)
- @doc "获取帖子列表"
- @handler getPostList
- get /api/post/list (GetPostListReq) returns (GetPostListRsp)
- @doc "获取帖子详情"
- @handler getPost
- get /api/post (GetPostReq) returns (GetPostRsp)
- @doc "获取评论列表"
- @handler getPostCommentList
- get /api/post/comment/list (GetPostCommentListReq) returns (GetPostCommentListRsp)
- @doc "获取回复列表"
- @handler getReplyList
- get /api/post/reply/list (GetReplyListReq) returns (GetReplyListRsp)
- @doc "获取用户发布的帖子列表"
- @handler getUserPostList
- get /api/user/post/list (GetUserPostListReq) returns (GetUserPostListRsp)
- @doc "获取用户收藏的帖子列表"
- @handler getUserPostCollectionList
- get /api/user/post/collection/list (GetUserPostCollectionListReq) returns (GetUserPostCollectionListRsp)
- @doc "获取用户点赞的帖子列表"
- @handler getUserPostLikeList
- get /api/user/post/like/list (GetUserPostLikeListReq) returns (GetUserPostLikeListRsp)
- }
|