slow_wild.api 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. syntax = "v1"
  2. info (
  3. title: "SlowWildServer API"
  4. desc: "This is the API definition for SlowWildServer"
  5. version: "1.0.0"
  6. )
  7. type BaseReturnData {
  8. Data interface{} `json:"data"`
  9. }
  10. type (
  11. UserEntity {
  12. Id int64 `json:"id"`
  13. Avatar string `json:"avatar"`
  14. Nickname string `json:"nickname"`
  15. Username string `json:"username"`
  16. Phone string `json:"phone"`
  17. Status int32 `json:"status"`
  18. Sex int32 `json:"sex"`
  19. Follows int64 `json:"follows"`
  20. Followings int64 `json:"followings"`
  21. GetLikesCount int32 `json:"get_likes_count"`
  22. GetCollectionCount int32 `json:"get_collection_count"`
  23. }
  24. UserInfo {
  25. Id int64 `json:"id"`
  26. Avatar string `json:"avatar"`
  27. Nickname string `json:"nickname"`
  28. Sex int32 `json:"sex"`
  29. }
  30. FollowUserInfo {
  31. User UserInfo `json:"user"`
  32. IsMutualFollow bool `json:"is_mutual_follow"`
  33. }
  34. LoginAndRegisterRsp {
  35. Token string `json:"token"`
  36. Expire int64 `json:"expire"`
  37. }
  38. LoginReq {
  39. Phone string `json:"phone"`
  40. Password string `json:"password"`
  41. Code string `json:"code"`
  42. LoginType int32 `json:"login_type"`
  43. LoginIp string `json:"login_ip"`
  44. }
  45. RegisterReq {
  46. Phone string `json:"phone"`
  47. Nickname string `json:"nickname"`
  48. Password string `json:"password"`
  49. Avatar string `json:"avatar"`
  50. Sex int32 `json:"sex"`
  51. Username string `json:"username"`
  52. Code string `json:"code"`
  53. }
  54. GetUserInfoReq {
  55. QueryUserId int64 `json:"query_user_id"`
  56. }
  57. GetUserInfoResp {
  58. Id int64 `json:"id"`
  59. Avatar string `json:"avatar"`
  60. Nickname string `json:"nickname"`
  61. Sex int32 `json:"sex"`
  62. IsFollow bool `json:"is_follow"`
  63. }
  64. FindUserReq {
  65. Username string `json:"username"`
  66. Phone string `json:"phone"`
  67. Ids []int64 `json:"ids"`
  68. }
  69. FindUserResp {
  70. UserList []UserInfo `json:"user_list"`
  71. }
  72. FollowUserReq {
  73. FollowUserId int64 `json:"follow_user_id"`
  74. }
  75. FollowUserRes {
  76. Success bool `json:"success"`
  77. }
  78. UnFollowUserReq {
  79. UnFollowUserId int64 `json:"un_follow_user_id"`
  80. }
  81. UnFollowUserRes {
  82. Success bool `json:"success"`
  83. }
  84. GetFollowingReq {
  85. PageSize int32 `json:"page_size"`
  86. Page int32 `json:"page"`
  87. QueryUserId int64 `json:"query_user_id"`
  88. }
  89. GetFollowingRes {
  90. List []FollowUserInfo `json:"list"`
  91. Total int64 `json:"total"`
  92. }
  93. GetFollowReq {
  94. PageSize int32 `json:"page_size"`
  95. Page int32 `json:"page"`
  96. QueryUserId int64 `json:"query_user_id"`
  97. }
  98. GetFollowRes {
  99. List []FollowUserInfo `json:"list"`
  100. Total int64 `json:"total"`
  101. }
  102. GetUserProfileReq {
  103. UserId int64 `json:"user_id"`
  104. }
  105. GetUserProfileRes {
  106. Id int64 `json:"id"`
  107. Nickname string `json:"nickname"`
  108. Username string `json:"username"`
  109. Status int32 `json:"status"`
  110. Avatar string `json:"avatar"`
  111. Phone string `json:"phone"`
  112. TweetCount int32 `json:"tweet_count"`
  113. IsFollowing bool `json:"is_following"`
  114. CreatedOn int64 `json:"created_on"`
  115. Follows int64 `json:"follows"`
  116. Fans int64 `json:"fans"`
  117. GetLikesCount int32 `json:"get_likes_count"`
  118. GetCollectionCount int32 `json:"get_collection_count"`
  119. Sex int32 `json:"sex"`
  120. }
  121. SearchUsernameReq {
  122. Keyword string `json:"keyword"`
  123. Page int32 `json:"page"`
  124. PageSize int32 `json:"page_size"`
  125. UserId int64 `json:"user_id"`
  126. }
  127. SearchUsernameItem {
  128. Nickname string `json:"nickname"`
  129. Avatar string `json:"avatar"`
  130. Id int64 `json:"id"`
  131. Sex int32 `json:"sex"`
  132. IsFollow bool `json:"is_follow"`
  133. }
  134. SearchUsernameRes {
  135. List []SearchUsernameItem `json:"list"`
  136. Total int64 `json:"total"`
  137. }
  138. CreateTag {
  139. Name string `json:"name"`
  140. Id int64 `json:"id"`
  141. }
  142. CreatePostReq {
  143. Title string `json:"title"`
  144. Content string `json:"content"`
  145. Tags []CreateTag `json:"tags"`
  146. AtUserIds []int64 `json:"at_user_ids"`
  147. PostType int32 `json:"post_type"`
  148. Visibility int32 `json:"visibility"`
  149. Images []string `json:"images"`
  150. VideoCover string `json:"video_cover"`
  151. VideoUrl string `json:"video_url"`
  152. Ip string `json:"ip"`
  153. IpLoc string `json:"ip_loc"`
  154. }
  155. CreatePostRsp {
  156. PostId int64 `json:"post_id"`
  157. }
  158. GetTagListReq {
  159. Page int32 `json:"page"`
  160. PageSize int32 `json:"page_size"`
  161. TagName string `json:"tag_name"`
  162. SortBy int32 `json:"sort_by"`
  163. }
  164. TagItem {
  165. Name string `json:"name"`
  166. HotNum int64 `json:"hot_num"`
  167. User UserInfo `json:"user"`
  168. Id int64 `json:"id"`
  169. CreatedOn int64 `json:"created_on"`
  170. }
  171. GetTagListRsp {
  172. TagList []TagItem `json:"tag_list"`
  173. Total int32 `json:"total"`
  174. }
  175. GetTagReq {
  176. TagId int64 `json:"tag_id"`
  177. }
  178. GetTagRsp {
  179. Name string `json:"name"`
  180. HotNum int64 `json:"hot_num"`
  181. User UserInfo `json:"user"`
  182. Id int64 `json:"id"`
  183. CreatedOn int64 `json:"created_on"`
  184. PostCount int64 `json:"post_count"`
  185. FollowCount int64 `json:"follow_count"`
  186. IsFollowed bool `json:"is_followed"`
  187. }
  188. GetPostListReq {
  189. Page int32 `json:"page"`
  190. PageSize int32 `json:"page_size"`
  191. SearchType int32 `json:"search_type"`
  192. SortType int32 `json:"sort_type"`
  193. Keyword string `json:"keyword"`
  194. }
  195. GetPostListItem {
  196. Id int64 `json:"id"`
  197. User UserInfo `json:"user"`
  198. Title string `json:"title"`
  199. ContentSummary string `json:"content_summary"`
  200. PostYype int32 `json:"post_type"`
  201. CommentCount int64 `json:"comment_count"`
  202. UpvoteCount int64 `json:"upvote_count"`
  203. CollectionCount int64 `json:"collection_count"`
  204. ShareCount int64 `json:"share_count"`
  205. Visibility int32 `json:"visibility"`
  206. IpLoc string `json:"ip_loc"`
  207. HotNum int64 `json:"hot_num"`
  208. Images []string `json:"images"`
  209. VideoUrl string `json:"video_url"`
  210. VideoCover string `json:"video_cover"`
  211. CreatedOn int64 `json:"created_on"`
  212. Tags []TagItem `json:"tags"`
  213. IsLiked bool `json:"is_liked"`
  214. IsCollected bool `json:"is_collected"`
  215. IsMine bool `json:"is_mine"`
  216. }
  217. GetPostListRsp {
  218. List []GetPostListItem `json:"list"`
  219. Total int64 `json:"total"`
  220. }
  221. GetPostReq {
  222. PostId int64 `json:"post_id"`
  223. }
  224. GetPostRsp {
  225. Id int64 `json:"id"`
  226. User UserInfo `json:"user"`
  227. Title string `json:"title"`
  228. ContentSummary string `json:"content_summary"`
  229. PostYype int32 `json:"post_type"`
  230. CommentCount int64 `json:"comment_count"`
  231. UpvoteCount int64 `json:"upvote_count"`
  232. CollectionCount int64 `json:"collection_count"`
  233. ShareCount int64 `json:"share_count"`
  234. Visibility int32 `json:"visibility"`
  235. IpLoc string `json:"ip_loc"`
  236. HotNum int64 `json:"hot_num"`
  237. Images []string `json:"images"`
  238. VideoUrl string `json:"video_url"`
  239. VideoCover string `json:"video_cover"`
  240. Content string `json:"content"`
  241. CreatedOn int64 `json:"created_on"`
  242. Tags []TagItem `json:"tags"`
  243. WithUser []UserInfo `json:"with_user"`
  244. LatestRepliedOn int64 `json:"latest_replied_on"`
  245. IsLiked bool `json:"is_liked"`
  246. IsCollected bool `json:"is_collected"`
  247. IsMine bool `json:"is_mine"`
  248. }
  249. PostUpvoteReq {
  250. PostId int64 `json:"post_id"`
  251. }
  252. PostUpvoteRsp {
  253. Success bool `json:"success"`
  254. }
  255. PostCollectionReq {
  256. PostId int64 `json:"post_id"`
  257. }
  258. PostCollectionRsp {
  259. Success bool `json:"success"`
  260. }
  261. PostShareReq {
  262. PostId int64 `json:"post_id"`
  263. }
  264. PostShareRsp {
  265. Success bool `json:"success"`
  266. }
  267. PostCommentReq {
  268. PostId int64 `json:"post_id"`
  269. Content string `json:"content"`
  270. Image string `json:"image"`
  271. AtUserId int64 `json:"at_user_id"`
  272. Ip string `json:"ip"`
  273. IpLoc string `json:"ip_loc"`
  274. }
  275. PostCommentRsp {
  276. CommentId int64 `json:"comment_id"`
  277. }
  278. PostReplyReq {
  279. PostId int64 `json:"post_id"`
  280. Content string `json:"content"`
  281. Image string `json:"image"`
  282. AtUserId int64 `json:"at_user_id"`
  283. Ip string `json:"ip"`
  284. IpLoc string `json:"ip_loc"`
  285. CommentId int64 `json:"comment_id"`
  286. ToReplyId int64 `json:"to_reply_id"`
  287. }
  288. PostReplyRsp {
  289. ReplyId int64 `json:"reply_id"`
  290. }
  291. GetPostCommentListReq {
  292. Page int32 `json:"page"`
  293. PageSize int32 `json:"page_size"`
  294. PostId int64 `json:"post_id"`
  295. }
  296. RepliesItem {
  297. Id int64 `json:"id"`
  298. PostId int64 `json:"post_id"`
  299. User UserInfo `json:"user"`
  300. IpLoc string `json:"ip_loc"`
  301. Content string `json:"content"`
  302. Image string `json:"image"`
  303. WithUser []UserInfo `json:"with_user"`
  304. UpvoteCount int64 `json:"upvote_count"`
  305. IsLiked bool `json:"is_liked"`
  306. IsMine bool `json:"is_mine"`
  307. CreatedOn int64 `json:"created_on"`
  308. }
  309. CommentItem {
  310. Id int64 `json:"id"`
  311. PostId int64 `json:"post_id"`
  312. User UserInfo `json:"user"`
  313. IpLoc string `json:"ip_loc"`
  314. Content string `json:"content"`
  315. Image string `json:"image"`
  316. WithUser []UserInfo `json:"with_user"`
  317. ReplyCount int64 `json:"reply_count"`
  318. UpvoteCount int64 `json:"upvote_count"`
  319. ReplyItem []RepliesItem `json:"reply_item"`
  320. IsLiked bool `json:"is_liked"`
  321. IsMine bool `json:"is_mine"`
  322. CreatedOn int64 `json:"created_on"`
  323. }
  324. GetPostCommentListRsp {
  325. List []CommentItem `json:"list"`
  326. Total int64 `json:"total"`
  327. }
  328. GetReplyListReq {
  329. Page int32 `json:"page"`
  330. PageSize int32 `json:"page_size"`
  331. CommentId int64 `json:"comment_id"`
  332. }
  333. GetReplyListRsp {
  334. List []RepliesItem `json:"list"`
  335. Total int64 `json:"total"`
  336. }
  337. PostCommentUpvoteReq {
  338. CommentId int64 `json:"comment_id"`
  339. CommentType int32 `json:"comment_type"`
  340. }
  341. PostCommentUpvoteRsp {
  342. Success bool `json:"success"`
  343. }
  344. PostDeleteReq {
  345. PostId int64 `json:"post_id"`
  346. }
  347. PostDeleteRsp {
  348. Success bool `json:"success"`
  349. }
  350. CommentDeleteReq {
  351. CommentId int64 `json:"comment_id"`
  352. CommentType int32 `json:"comment_type"`
  353. }
  354. CommentDeleteRsp {
  355. Success bool `json:"success"`
  356. }
  357. GetUserPostListReq {
  358. Page int64 `json:"page"`
  359. PageSize int64 `json:"page_size"`
  360. QueryUserId int64 `json:"query_user_id"`
  361. }
  362. GetUserPostListRsp {
  363. List []GetPostListItem `json:"list"`
  364. Total int64 `json:"total"`
  365. }
  366. GetUserPostCollectionListReq {
  367. Page int64 `json:"page"`
  368. PageSize int64 `json:"page_size"`
  369. QueryUserId int64 `json:"query_user_id"`
  370. }
  371. GetUserPostCollectionListRsp {
  372. List []GetPostListItem `json:"list"`
  373. Total int64 `json:"total"`
  374. }
  375. GetUserPostLikeListReq {
  376. Page int64 `json:"page"`
  377. PageSize int64 `json:"page_size"`
  378. QueryUserId int64 `json:"query_user_id"`
  379. }
  380. GetUserPostLikeListRsp {
  381. List []GetPostListItem `json:"list"`
  382. Total int64 `json:"total"`
  383. }
  384. )
  385. @server (
  386. perfix: /v1
  387. )
  388. service slowwild {
  389. @doc "登录方法"
  390. @handler login
  391. post /api/user/login (LoginReq) returns (BaseReturnData)
  392. @doc "用户注册"
  393. @handler register
  394. post /api/user/register (RegisterReq) returns (BaseReturnData)
  395. }
  396. @server (
  397. perfix: /v1
  398. jwt: Auth // 开启 jwt 认证
  399. )
  400. service slowwild {
  401. @doc "获取用户信息"
  402. @handler getUserInfo
  403. get /api/user/info (GetUserInfoReq) returns (BaseReturnData)
  404. @doc "查询用户"
  405. @handler findUser
  406. post /api/user/find (FindUserReq) returns (BaseReturnData)
  407. @doc "关注用户"
  408. @handler followUser
  409. post /api/user/follow (FollowUserReq) returns (BaseReturnData)
  410. @doc "取消关注用户"
  411. @handler unfollowUser
  412. post /api/user/unfollow (UnFollowUserReq) returns (BaseReturnData)
  413. @doc "获取粉丝"
  414. @handler getFans
  415. get /api/user/fans (GetFollowingReq) returns (BaseReturnData)
  416. @doc "获取关注列表"
  417. @handler getFollows
  418. get /api/user/follows (GetFollowReq) returns (BaseReturnData)
  419. @doc "获取用户信息"
  420. @handler getUserProfile
  421. get /api/user/profile (GetUserProfileReq) returns (BaseReturnData)
  422. @doc "搜索用户"
  423. @handler searchUsername
  424. get /api/user/search (SearchUsernameReq) returns (BaseReturnData)
  425. }
  426. @server (
  427. perfix: /v1
  428. jwt: Auth
  429. )
  430. service slowwild {
  431. @doc "创建帖子"
  432. @handler createPost
  433. post /api/post/create (CreatePostReq) returns (BaseReturnData)
  434. @doc "帖子点赞"
  435. @handler postUpvote
  436. post /api/post/upvote (PostUpvoteReq) returns (BaseReturnData)
  437. @doc "帖子收藏"
  438. @handler postCollection
  439. post /api/post/collection (PostCollectionReq) returns (BaseReturnData)
  440. @doc "帖子分享"
  441. @handler postShare
  442. post /api/post/share (PostShareReq) returns (BaseReturnData)
  443. @doc "发布评论"
  444. @handler postComment
  445. post /api/post/comment (PostCommentReq) returns (BaseReturnData)
  446. @doc "回复评论"
  447. @handler postReply
  448. post /api/post/reply (PostReplyReq) returns (BaseReturnData)
  449. @doc "评论点赞"
  450. @handler postCommentUpvote
  451. post /api/post/comment/upvote (PostCommentUpvoteReq) returns (BaseReturnData)
  452. @doc "帖子删除"
  453. @handler postDelete
  454. post /api/post/delete (PostDeleteReq) returns (BaseReturnData)
  455. @doc "评论删除"
  456. @handler commentDelete
  457. post /api/comment/delete (CommentDeleteReq) returns (BaseReturnData)
  458. }
  459. @server (
  460. perfix: /v1
  461. middleware: OptionalJwtMiddleware
  462. )
  463. service slowwild {
  464. @doc "获取话题列表"
  465. @handler getTagList
  466. get /api/tag/list (GetTagListReq) returns (BaseReturnData)
  467. @doc "获取话题详情"
  468. @handler getTag
  469. get /api/tag (GetTagReq) returns (BaseReturnData)
  470. @doc "获取帖子列表"
  471. @handler getPostList
  472. get /api/post/list (GetPostListReq) returns (BaseReturnData)
  473. @doc "获取帖子详情"
  474. @handler getPost
  475. get /api/post (GetPostReq) returns (BaseReturnData)
  476. @doc "获取评论列表"
  477. @handler getPostCommentList
  478. get /api/post/comment/list (GetPostCommentListReq) returns (BaseReturnData)
  479. @doc "获取回复列表"
  480. @handler getReplyList
  481. get /api/post/reply/list (GetReplyListReq) returns (BaseReturnData)
  482. @doc "获取用户发布的帖子列表"
  483. @handler getUserPostList
  484. get /api/user/post/list (GetUserPostListReq) returns (BaseReturnData)
  485. @doc "获取用户收藏的帖子列表"
  486. @handler getUserPostCollectionList
  487. get /api/user/post/collection/list (GetUserPostCollectionListReq) returns (BaseReturnData)
  488. @doc "获取用户点赞的帖子列表"
  489. @handler getUserPostLikeList
  490. get /api/user/post/like/list (GetUserPostLikeListReq) returns (BaseReturnData)
  491. }