api.proto 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. syntax = "proto3";
  2. package community.service.favorite;
  3. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  4. import "app/service/main/favorite/model/fav.proto";
  5. import "google/protobuf/empty.proto";
  6. option go_package = "api";
  7. message ModelPage {
  8. int32 num = 1;
  9. int32 size = 2;
  10. int32 count = 3;
  11. }
  12. message ModelFavorite {
  13. int64 id = 1;
  14. int64 oid = 2;
  15. int64 mid = 3;
  16. int64 fid = 4;
  17. int32 type = 5;
  18. int32 state = 6;
  19. int64 ctime = 7;
  20. int64 mtime = 8;
  21. }
  22. message ModelPartition {
  23. int32 tid = 1;
  24. string name = 2;
  25. int32 count = 3;
  26. }
  27. message ModelFavorites {
  28. ModelPage page = 1;
  29. repeated ModelFavorite list = 2;
  30. }
  31. message AddFavReply {
  32. }
  33. message AddFavReq {
  34. int32 tp = 2;
  35. int64 mid = 3;
  36. int64 fid = 4;
  37. int64 oid = 5;
  38. int32 otype = 6;
  39. }
  40. message DelFavReply {
  41. }
  42. message DelFavReq {
  43. int32 tp = 2;
  44. int64 mid = 3;
  45. int64 fid = 4;
  46. int64 oid = 5;
  47. int32 otype = 6;
  48. }
  49. message FavoritesReply {
  50. ModelFavorites res = 1;
  51. }
  52. message FavoritesReq {
  53. int32 tp = 2;
  54. int64 mid = 3;
  55. int64 uid = 4;
  56. int64 fid = 5;
  57. int32 pn = 6;
  58. int32 ps = 7;
  59. int32 tid = 8;
  60. int32 tv = 9;
  61. string keyword = 10;
  62. string order = 11;
  63. }
  64. message TlistsReply {
  65. repeated ModelPartition res = 1;
  66. }
  67. message TlistsReq {
  68. int32 tp = 2;
  69. int64 mid = 3;
  70. int64 uid = 4;
  71. int64 fid = 5;
  72. }
  73. message RecentFavsReply {
  74. repeated int64 res = 1;
  75. }
  76. message RecentFavsReq {
  77. int32 tp = 2;
  78. int64 mid = 3;
  79. int32 size = 4;
  80. }
  81. message IsFavoredReply {
  82. bool faved = 1;
  83. }
  84. message IsFavoredReq {
  85. int32 typ = 2;
  86. int64 mid = 3;
  87. int64 oid = 4;
  88. }
  89. message IsFavoredByFidReq {
  90. int32 type = 1;
  91. int64 mid = 2;
  92. int64 oid = 3;
  93. int64 fid = 4;
  94. }
  95. message IsFavoredsReply {
  96. map<int64,bool> faveds = 1;
  97. }
  98. message IsFavoredsReq{
  99. int32 typ = 2;
  100. int64 mid = 3;
  101. repeated int64 oids = 4;
  102. }
  103. message UserFoldersReply {
  104. repeated .model.Folder res = 1;
  105. }
  106. message UserFoldersReq {
  107. int32 typ = 2;
  108. int64 mid = 3;
  109. int64 vmid = 4;
  110. int64 oid = 5;
  111. bool allCount = 6;
  112. int32 otype = 7;
  113. }
  114. message UserFolderReply {
  115. .model.Folder res = 1;
  116. }
  117. message UserFolderReq {
  118. int32 typ = 2;
  119. int64 mid = 3;
  120. int64 vmid = 4;
  121. int64 fid = 5;
  122. bool allCount = 6;
  123. }
  124. message AddFolderReq {
  125. int32 typ = 1;
  126. int64 mid = 2;
  127. string name = 3;
  128. string description = 4;
  129. string cover = 5;
  130. int32 public = 6;
  131. string cookie = 7;
  132. string accessKey = 8;
  133. }
  134. message AddFolderReply {
  135. int64 fid = 1;
  136. }
  137. message UpdateFolderReq {
  138. int32 typ =1;
  139. int64 fid =2;
  140. int64 mid =3;
  141. string name =4;
  142. string description =5;
  143. string cover =6;
  144. int32 public =7;
  145. string cookie =8;
  146. string accessKey =9;
  147. }
  148. message AdminUpdateFolderReq {
  149. int32 typ =1;
  150. int64 fid =2;
  151. int64 mid =3;
  152. string name =4;
  153. string description =5;
  154. string cover =6;
  155. int32 state =7;
  156. int32 attr =8;
  157. }
  158. message DelFolderReq {
  159. int32 typ =1;
  160. int64 mid =2;
  161. int64 fid =3;
  162. }
  163. message MultiAddReq {
  164. int32 typ =1;
  165. int64 mid =2;
  166. repeated int64 oids =3;
  167. int64 fid =4;
  168. }
  169. message MultiDelReq {
  170. int32 typ =1;
  171. int64 mid =2;
  172. repeated int64 oids =3;
  173. int64 fid =4;
  174. }
  175. message InDefaultFolderReq {
  176. int32 typ =1;
  177. int64 mid =2;
  178. int64 oid =3;
  179. }
  180. message InDefaultFolderReply {
  181. bool isIn =1;
  182. }
  183. message CntUserFoldersReq {
  184. int32 typ =1;
  185. int64 mid =2;
  186. int64 vmid =3;
  187. }
  188. message CntUserFoldersReply {
  189. int32 count =1;
  190. }
  191. message User {
  192. int64 id =1;
  193. int64 oid =2;
  194. int64 mid =3;
  195. int32 typ =4;
  196. int32 state =5;
  197. int64 ctime =6;
  198. int64 mtime =7;
  199. }
  200. message FavedUsersReply {
  201. ModelPage page =1;
  202. repeated User user =2;
  203. }
  204. message FavedUsersReq {
  205. int32 Type =1;
  206. int64 Oid =2;
  207. int32 pn =3;
  208. int32 ps =4;
  209. }
  210. message SetFolderSortReq {
  211. int32 typ =1;
  212. int64 mid =3;
  213. repeated int64 fids =4;
  214. }
  215. message FoldersReply {
  216. repeated .model.Folder res = 1;
  217. }
  218. message FoldersReq {
  219. // id = fid*100 + mid%100
  220. repeated FolderID ids = 1;
  221. int32 typ = 2;
  222. int64 mid = 3;
  223. }
  224. message FolderID {
  225. int64 fid = 1;
  226. int64 mid = 2;
  227. }
  228. message MoveFavsReq {
  229. int32 typ = 1;
  230. int64 mid = 2;
  231. int64 oldFid = 3;
  232. int64 newFid = 4;
  233. repeated int64 oids = 5;
  234. }
  235. message CopyFavsReq {
  236. int32 typ = 1;
  237. int64 oldMid = 2;
  238. int64 mid = 3;
  239. int64 oldFid = 4;
  240. int64 newFid = 5;
  241. repeated int64 oids = 6;
  242. }
  243. message CleanStateReq {
  244. int32 typ =1;
  245. int64 mid =2;
  246. int64 fid =3;
  247. }
  248. message CleanStateReply {
  249. int32 cleanState =1;
  250. }
  251. message CleanInvalidFavsReq {
  252. int32 typ =1;
  253. int64 mid =2;
  254. int64 fid =3;
  255. }
  256. message FavAddFoldersReq {
  257. int64 oid = 1;
  258. int32 typ = 2;
  259. repeated int64 fids = 3;
  260. int64 mid = 4;
  261. int32 otype = 5;
  262. }
  263. message FavDelFoldersReq {
  264. int64 oid = 1;
  265. int32 typ = 2;
  266. repeated int64 fids = 3;
  267. int64 mid = 4;
  268. int32 otype = 5;
  269. }
  270. message SortFavsReq{
  271. repeated SortFav sorts = 1;
  272. int64 mid = 2;
  273. int64 fid = 3;
  274. int32 typ = 4;
  275. }
  276. message SortFav {
  277. .model.Resource pre = 1;
  278. .model.Resource insert = 2;
  279. }
  280. message UpFolderNameReq {
  281. int32 typ =1;
  282. int64 fid =2;
  283. int64 mid =3;
  284. string name =4;
  285. string cookie =5;
  286. string accessKey =6;
  287. }
  288. message UpFolderAttrReq {
  289. int32 typ =1;
  290. int64 fid =2;
  291. int64 mid =3;
  292. int32 public =4;
  293. }
  294. message RecentResourcesReq {
  295. int32 tp = 2;
  296. int64 mid = 3;
  297. int32 size = 4;
  298. }
  299. message RecentResourcesReply {
  300. repeated .model.Resource res = 1;
  301. }
  302. service Favorite {
  303. // 更新收藏夹V2版本
  304. rpc AdminUpdateFolder(AdminUpdateFolderReq) returns(.google.protobuf.Empty);
  305. // 删除一个资源从多个收藏夹
  306. rpc FavDelFolders(FavDelFoldersReq) returns(.google.protobuf.Empty);
  307. // 添加一个资源至多个收藏夹
  308. rpc FavAddFolders(FavAddFoldersReq) returns(.google.protobuf.Empty);
  309. // 收藏夹重命名
  310. rpc UpFolderName(UpFolderNameReq) returns(.google.protobuf.Empty);
  311. // 设置收藏夹公开
  312. rpc UpFolderAttr(UpFolderAttrReq) returns(.google.protobuf.Empty);
  313. // 清除不合法的收藏资源
  314. rpc CleanInvalidFavs(CleanInvalidFavsReq) returns(.google.protobuf.Empty);
  315. // 返回某个收藏夹是否已经是clean的
  316. rpc CleanState(CleanStateReq) returns(CleanStateReply);
  317. // 拷贝收藏夹内的资源至另外一个收藏夹
  318. rpc CopyFavs(CopyFavsReq) returns(.google.protobuf.Empty);
  319. // 移动收藏夹内的资源至另外一个收藏夹
  320. rpc MoveFavs(MoveFavsReq) returns(.google.protobuf.Empty);
  321. // 收藏夹排序
  322. rpc SetFolderSort(SetFolderSortReq) returns(.google.protobuf.Empty);
  323. // 哪些用户收藏了该资源
  324. rpc FavedUsers(FavedUsersReq) returns(FavedUsersReply);
  325. // 用户收藏夹数量
  326. rpc CntUserFolders(CntUserFoldersReq) returns(CntUserFoldersReply);
  327. // 该资源是否在默认收藏夹中
  328. rpc InDefault(InDefaultFolderReq) returns(InDefaultFolderReply);
  329. // 批量删除多个资源
  330. rpc MultiDel(MultiDelReq) returns(.google.protobuf.Empty);
  331. // 批量添加多个资源
  332. rpc MultiAdd(MultiAddReq) returns(.google.protobuf.Empty);
  333. // 删除收藏夹
  334. rpc DelFolder(DelFolderReq) returns(.google.protobuf.Empty);
  335. // 更新收藏夹
  336. rpc UpdateFolder(UpdateFolderReq) returns(.google.protobuf.Empty);
  337. // 创建收藏夹
  338. rpc AddFolder(AddFolderReq) returns(AddFolderReply);
  339. // 收藏夹内的资源列表(只显示和收藏夹相同type的资源)
  340. rpc Favorites(FavoritesReq) returns(FavoritesReply);
  341. // 收藏夹内的资源列表(显示所有资源)
  342. rpc FavoritesAll(FavoritesReq) returns(FavoritesReply);
  343. // 分区信息
  344. rpc Tlists(TlistsReq) returns(TlistsReply);
  345. // 该用户最近收藏
  346. rpc RecentFavs(RecentFavsReq) returns(RecentFavsReply);
  347. // 该用户最近收藏的资源
  348. rpc RecentResources(RecentResourcesReq) returns(RecentResourcesReply);
  349. // 用户是否收藏该资源
  350. rpc IsFavored(IsFavoredReq) returns(IsFavoredReply);
  351. // 该资源是否在某个收藏夹内
  352. rpc IsFavoredByFid(IsFavoredByFidReq) returns(IsFavoredReply);
  353. // 多个资源是否被用户收藏
  354. rpc IsFavoreds(IsFavoredsReq) returns(IsFavoredsReply);
  355. // 添加收藏
  356. rpc AddFav(AddFavReq) returns(AddFavReply);
  357. // 删除收藏
  358. rpc DelFav(DelFavReq) returns(DelFavReply);
  359. // 用户的收藏夹列表
  360. rpc UserFolders(UserFoldersReq) returns(UserFoldersReply);
  361. // 用户的一个收藏夹
  362. rpc UserFolder(UserFolderReq) returns(UserFolderReply);
  363. // 通过ID批量返回收藏夹 id = fid*100 + mid%100
  364. rpc Folders(FoldersReq) returns(FoldersReply);
  365. // 改变被搜藏的元素的顺序
  366. rpc SortFavs(SortFavsReq) returns(.google.protobuf.Empty);
  367. }