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) }