| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526 |
- syntax = "v1"
- info (
- title: "SlowWildServer API"
- desc: "This is the API definition for SlowWildServer"
- version: "1.0.0"
- )
- type BaseReturnData {
- Data interface{} `json:"data"`
- }
- 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"`
- GetLikesCount int32 `json:"get_likes_count"`
- GetCollectionCount 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"`
- IsMutualFollow 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,optional"`
- LoginType int32 `json:"login_type"`
- LoginIp string `json:"login_ip,optional"`
- }
- RegisterReq {
- Phone string `json:"phone"`
- Nickname string `json:"nickname,optional"`
- Password string `json:"password"`
- Avatar string `json:"avatar,optional"`
- Sex int32 `json:"sex,default=1"`
- Username string `json:"username,optional"`
- Code string `json:"code,optional"`
- }
- GetUserInfoReq {
- QueryUserId int64 `form:"query_user_id"`
- }
- GetUserInfoResp {
- Id int64 `json:"id"`
- Avatar string `json:"avatar"`
- Nickname string `json:"nickname"`
- Sex int32 `json:"sex"`
- IsFollow bool `json:"is_follow"`
- }
- FindUserReq {
- Username string `json:"username,optional"`
- Phone string `json:"phone,optional"`
- Ids []int64 `json:"ids,optional"`
- }
- FindUserResp {
- UserList []UserInfo `json:"user_list"`
- }
- FollowUserReq {
- FollowUserId int64 `json:"follow_user_id"`
- }
- FollowUserRes {
- Success bool `json:"success"`
- }
- UnFollowUserReq {
- UnFollowUserId int64 `json:"un_follow_user_id"`
- }
- UnFollowUserRes {
- Success bool `json:"success"`
- }
- GetFollowingReq {
- PageSize int32 `form:"page_size,default=10"`
- Page int32 `form:"page,default=1"`
- QueryUserId int64 `form:"query_user_id"`
- }
- GetFollowingRes {
- List []FollowUserInfo `json:"list"`
- Total int64 `json:"total"`
- }
- GetFollowReq {
- PageSize int32 `form:"page_size,default=10"`
- Page int32 `form:"page,default=1"`
- QueryUserId int64 `form:"query_user_id"`
- }
- GetFollowRes {
- List []FollowUserInfo `json:"list"`
- Total int64 `json:"total"`
- }
- GetUserProfileReq {
- UserId int64 `form:"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"`
- TweetCount int32 `json:"tweet_count"`
- IsFollowing bool `json:"is_following"`
- CreatedOn int64 `json:"created_on"`
- Follows int64 `json:"follows"`
- Fans int64 `json:"fans"`
- GetLikesCount int32 `json:"get_likes_count"`
- GetCollectionCount int32 `json:"get_collection_count"`
- Sex int32 `json:"sex"`
- }
- SearchUsernameReq {
- Keyword string `form:"keyword"`
- Page int32 `form:"page,default=1"`
- PageSize int32 `form:"page_size,default=10"`
- }
- SearchUsernameItem {
- Nickname string `json:"nickname"`
- Avatar string `json:"avatar"`
- Id int64 `json:"id"`
- Sex int32 `json:"sex"`
- IsFollow bool `json:"is_follow"`
- }
- SearchUsernameRes {
- List []SearchUsernameItem `json:"list"`
- Total int64 `json:"total"`
- }
- CreateTag {
- Name string `json:"name"`
- Id int64 `json:"id"`
- }
- CreatePostReq {
- Title string `json:"title"`
- Content string `json:"content"`
- Tags []CreateTag `json:"tags,optional"`
- AtUserIds []int64 `json:"at_user_ids,optional"`
- PostType int32 `json:"post_type"`
- Visibility int32 `json:"visibility"`
- Images []string `json:"images"`
- VideoCover string `json:"video_cover,optional"`
- VideoUrl string `json:"video_url,optional"`
- }
- CreatePostRsp {
- PostId int64 `json:"post_id"`
- }
- GetTagListReq {
- Page int32 `form:"page,default=1"`
- PageSize int32 `form:"page_size,default=10"`
- TagName string `form:"tag_name"`
- SortBy int32 `form:"sort_by"`
- }
- TagItem {
- Name string `json:"name"`
- HotNum int64 `json:"hot_num"`
- User UserInfo `json:"user"`
- Id int64 `json:"id"`
- CreatedOn int64 `json:"created_on"`
- }
- GetTagListRsp {
- TagList []TagItem `json:"tag_list"`
- Total int32 `json:"total"`
- }
- GetTagReq {
- TagId int64 `form:"tag_id"`
- }
- GetTagRsp {
- Name string `json:"name"`
- HotNum int64 `json:"hot_num"`
- User UserInfo `json:"user"`
- Id int64 `json:"id"`
- CreatedOn int64 `json:"created_on"`
- PostCount int64 `json:"post_count"`
- FollowCount int64 `json:"follow_count"`
- IsFollowed bool `json:"is_followed"`
- }
- GetPostListReq {
- Page int32 `form:"page,default=1"`
- PageSize int32 `form:"page_size,default=10"`
- SearchType int32 `form:"search_type,optional"`
- SortType int32 `form:"sort_type,optional"`
- Keyword string `form:"keyword,optional"`
- }
- GetPostListItem {
- Id int64 `json:"id"`
- User UserInfo `json:"user"`
- Title string `json:"title"`
- ContentSummary string `json:"content_summary"`
- PostYype int32 `json:"post_type"`
- CommentCount int64 `json:"comment_count"`
- UpvoteCount int64 `json:"upvote_count"`
- CollectionCount int64 `json:"collection_count"`
- ShareCount int64 `json:"share_count"`
- Visibility int32 `json:"visibility"`
- IpLoc string `json:"ip_loc"`
- HotNum int64 `json:"hot_num"`
- Images []string `json:"images"`
- VideoUrl string `json:"video_url"`
- VideoCover string `json:"video_cover"`
- CreatedOn int64 `json:"created_on"`
- Tags []TagItem `json:"tags"`
- IsLiked bool `json:"is_liked"`
- IsCollected bool `json:"is_collected"`
- IsMine bool `json:"is_mine"`
- }
- GetPostListRsp {
- List []GetPostListItem `json:"list"`
- Total int64 `json:"total"`
- }
- GetPostReq {
- PostId int64 `form:"post_id"`
- }
- GetPostRsp {
- Id int64 `json:"id"`
- User UserInfo `json:"user"`
- Title string `json:"title"`
- ContentSummary string `json:"content_summary"`
- PostYype int32 `json:"post_type"`
- CommentCount int64 `json:"comment_count"`
- UpvoteCount int64 `json:"upvote_count"`
- CollectionCount int64 `json:"collection_count"`
- ShareCount int64 `json:"share_count"`
- Visibility int32 `json:"visibility"`
- IpLoc string `json:"ip_loc"`
- HotNum int64 `json:"hot_num"`
- Images []string `json:"images"`
- VideoUrl string `json:"video_url"`
- VideoCover string `json:"video_cover"`
- Content string `json:"content"`
- CreatedOn int64 `json:"created_on"`
- Tags []TagItem `json:"tags"`
- WithUser []UserInfo `json:"with_user"`
- LatestRepliedOn int64 `json:"latest_replied_on"`
- IsLiked bool `json:"is_liked"`
- IsCollected bool `json:"is_collected"`
- IsMine bool `json:"is_mine"`
- }
- PostUpvoteReq {
- PostId int64 `json:"post_id"`
- }
- PostUpvoteRsp {
- Success bool `json:"success"`
- }
- PostCollectionReq {
- PostId int64 `json:"post_id"`
- }
- PostCollectionRsp {
- Success bool `json:"success"`
- }
- PostShareReq {
- PostId int64 `json:"post_id"`
- }
- PostShareRsp {
- Success bool `json:"success"`
- }
- PostCommentReq {
- PostId int64 `json:"post_id"`
- Content string `json:"content"`
- Image string `json:"image,optional"`
- AtUserId int64 `json:"at_user_id,optional"`
- }
- PostCommentRsp {
- CommentId int64 `json:"comment_id"`
- }
- PostReplyReq {
- PostId int64 `json:"post_id"`
- Content string `json:"content"`
- Image string `json:"image,optional"`
- AtUserId int64 `json:"at_user_id,optional"`
- CommentId int64 `json:"comment_id"`
- ToReplyId int64 `json:"to_reply_id,optional"`
- }
- PostReplyRsp {
- ReplyId int64 `json:"reply_id"`
- }
- GetPostCommentListReq {
- Page int32 `form:"page,default=1"`
- PageSize int32 `form:"page_size,default=10"`
- PostId int64 `form:"post_id"`
- }
- RepliesItem {
- Id int64 `json:"id"`
- PostId int64 `json:"post_id"`
- User UserInfo `json:"user"`
- IpLoc string `json:"ip_loc"`
- Content string `json:"content"`
- Image string `json:"image"`
- WithUser []UserInfo `json:"with_user"`
- UpvoteCount int64 `json:"upvote_count"`
- IsLiked bool `json:"is_liked"`
- IsMine bool `json:"is_mine"`
- CreatedOn int64 `json:"created_on"`
- }
- CommentItem {
- Id int64 `json:"id"`
- PostId int64 `json:"post_id"`
- User UserInfo `json:"user"`
- IpLoc string `json:"ip_loc"`
- Content string `json:"content"`
- Image string `json:"image"`
- WithUser []UserInfo `json:"with_user"`
- ReplyCount int64 `json:"reply_count"`
- UpvoteCount int64 `json:"upvote_count"`
- ReplyItem []RepliesItem `json:"reply_item"`
- IsLiked bool `json:"is_liked"`
- IsMine bool `json:"is_mine"`
- CreatedOn int64 `json:"created_on"`
- }
- GetPostCommentListRsp {
- List []CommentItem `json:"list"`
- Total int64 `json:"total"`
- }
- GetReplyListReq {
- Page int32 `from:"page,default=1"`
- PageSize int32 `from:"page_size,default=10"`
- CommentId int64 `from:"comment_id"`
- }
- GetReplyListRsp {
- List []RepliesItem `json:"list"`
- Total int64 `json:"total"`
- }
- PostCommentUpvoteReq {
- CommentId int64 `json:"comment_id"`
- CommentType int32 `json:"comment_type"`
- }
- PostCommentUpvoteRsp {
- Success bool `json:"success"`
- }
- PostDeleteReq {
- PostId int64 `json:"post_id"`
- }
- PostDeleteRsp {
- Success bool `json:"success"`
- }
- CommentDeleteReq {
- CommentId int64 `json:"comment_id"`
- CommentType int32 `json:"comment_type"`
- }
- CommentDeleteRsp {
- Success bool `json:"success"`
- }
- GetUserPostListReq {
- Page int64 `from:"page,default=1"`
- PageSize int64 `from:"page_size,default=10"`
- QueryUserId int64 `from:"query_user_id"`
- }
- GetUserPostListRsp {
- List []GetPostListItem `json:"list"`
- Total int64 `json:"total"`
- }
- GetUserPostCollectionListReq {
- Page int64 `from:"page,default=1"`
- PageSize int64 `from:"page_size,default=10"`
- QueryUserId int64 `from:"query_user_id"`
- }
- GetUserPostCollectionListRsp {
- List []GetPostListItem `json:"list"`
- Total int64 `json:"total"`
- }
- GetUserPostLikeListReq {
- Page int64 `from:"page,default=1"`
- PageSize int64 `from:"page_size,default=10"`
- QueryUserId int64 `from:"query_user_id"`
- }
- GetUserPostLikeListRsp {
- List []GetPostListItem `json:"list"`
- Total int64 `json:"total"`
- }
- )
- @server (
- prefix: /v1/api
- )
- service slowwild {
- @doc "登录方法"
- @handler login
- post /user/login (LoginReq) returns (BaseReturnData)
- @doc "用户注册"
- @handler register
- post /user/register (RegisterReq) returns (BaseReturnData)
- }
- @server (
- prefix: /v1/api
- jwt: Auth // 开启 jwt 认证
- )
- service slowwild {
- @doc "获取用户信息"
- @handler getUserInfo
- get /user/info (GetUserInfoReq) returns (BaseReturnData)
- @doc "查询用户"
- @handler findUser
- post /user/find (FindUserReq) returns (BaseReturnData)
- @doc "关注用户"
- @handler followUser
- post /user/follow (FollowUserReq) returns (BaseReturnData)
- @doc "取消关注用户"
- @handler unfollowUser
- post /user/unfollow (UnFollowUserReq) returns (BaseReturnData)
- @doc "获取粉丝"
- @handler getFans
- get /user/fans (GetFollowingReq) returns (BaseReturnData)
- @doc "获取关注列表"
- @handler getFollows
- get /user/follows (GetFollowReq) returns (BaseReturnData)
- @doc "获取用户信息"
- @handler getUserProfile
- get /user/profile (GetUserProfileReq) returns (BaseReturnData)
- @doc "搜索用户"
- @handler searchUsername
- get /user/search (SearchUsernameReq) returns (BaseReturnData)
- }
- @server (
- prefix: /v1/api
- jwt: Auth
- )
- service slowwild {
- @doc "创建帖子"
- @handler createPost
- post /post/create (CreatePostReq) returns (BaseReturnData)
- @doc "帖子点赞"
- @handler postUpvote
- post /post/upvote (PostUpvoteReq) returns (BaseReturnData)
- @doc "帖子收藏"
- @handler postCollection
- post /post/collection (PostCollectionReq) returns (BaseReturnData)
- @doc "帖子分享"
- @handler postShare
- post /post/share (PostShareReq) returns (BaseReturnData)
- @doc "发布评论"
- @handler postComment
- post /post/comment (PostCommentReq) returns (BaseReturnData)
- @doc "回复评论"
- @handler postReply
- post /post/reply (PostReplyReq) returns (BaseReturnData)
- @doc "评论点赞"
- @handler postCommentUpvote
- post /post/comment/upvote (PostCommentUpvoteReq) returns (BaseReturnData)
- @doc "帖子删除"
- @handler postDelete
- post /post/delete (PostDeleteReq) returns (BaseReturnData)
- @doc "评论删除"
- @handler commentDelete
- post /comment/delete (CommentDeleteReq) returns (BaseReturnData)
- }
- @server (
- prefix: /v1/api
- middleware: OptionalJwtMiddleware
- )
- service slowwild {
- @doc "获取话题列表"
- @handler getTagList
- get /tag/list (GetTagListReq) returns (BaseReturnData)
- @doc "获取话题详情"
- @handler getTag
- get /tag (GetTagReq) returns (BaseReturnData)
- @doc "获取帖子列表"
- @handler getPostList
- get /post/list (GetPostListReq) returns (BaseReturnData)
- @doc "获取帖子详情"
- @handler getPost
- get /post (GetPostReq) returns (BaseReturnData)
- @doc "获取评论列表"
- @handler getPostCommentList
- get /post/comment/list (GetPostCommentListReq) returns (BaseReturnData)
- @doc "获取回复列表"
- @handler getReplyList
- get /post/reply/list (GetReplyListReq) returns (BaseReturnData)
- @doc "获取用户发布的帖子列表"
- @handler getUserPostList
- get /user/post/list (GetUserPostListReq) returns (BaseReturnData)
- @doc "获取用户收藏的帖子列表"
- @handler getUserPostCollectionList
- get /user/post/collection/list (GetUserPostCollectionListReq) returns (BaseReturnData)
- @doc "获取用户点赞的帖子列表"
- @handler getUserPostLikeList
- get /user/post/like/list (GetUserPostLikeListReq) returns (BaseReturnData)
- }
- @server (
- prefix: /v1/api
- jwt: Auth
- )
- service slowwild {
- @doc "上传文件"
- @handler attachmentUpload
- post /attachment/upload returns (BaseReturnData)
- }
|