api.proto 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. syntax = "proto3";
  2. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  3. import "google/protobuf/empty.proto";
  4. package bbq.service.topic.v1;
  5. option go_package = "api";
  6. option (gogoproto.goproto_getters_all) = false;
  7. message ListExtensionReq {
  8. repeated int64 svids = 1;
  9. }
  10. message ListExtensionReply {
  11. repeated VideoExtension list = 1;
  12. }
  13. message UpdateVideoScoreReq {
  14. int64 svid = 1;
  15. double score = 2;
  16. }
  17. message UpdateVideoStateReq {
  18. int64 svid = 1;
  19. int32 state = 2;
  20. }
  21. message TopicVideosReq {
  22. int64 topic_id = 1[(gogoproto.moretags)='form:"topic_id"'];
  23. string cursor_prev = 2[(gogoproto.moretags)='form:"cursor_prev"'];
  24. string cursor_next = 3[(gogoproto.moretags)='form:"cursor_next"'];
  25. }
  26. message ListMultiTopicVideosReq {
  27. repeated TopicVideosReq list = 1;
  28. }
  29. message VideoItem {
  30. int64 svid = 1;
  31. string cursor_value = 2;
  32. int64 hot_type = 3;
  33. }
  34. message TopicDetail {
  35. TopicInfo topic_info = 1;
  36. repeated VideoItem list = 2;
  37. bool has_more = 3[(gogoproto.jsontag) = "has_more"];
  38. }
  39. message ListDiscoveryTopicReq {
  40. int32 page = 1[(gogoproto.moretags)='form:"page" validate:"required"'];
  41. }
  42. message ListDiscoveryTopicReply {
  43. repeated TopicDetail list = 1;
  44. bool has_more = 2;
  45. }
  46. message ListTopicsReq {
  47. int32 page = 1[(gogoproto.moretags)='form:"page" validate:"required"'];
  48. }
  49. message ListTopicsReply {
  50. bool has_more = 1[(gogoproto.jsontag) = "has_more"];
  51. repeated TopicInfo list = 2;
  52. }
  53. message StickTopicReq {
  54. int64 topic_id = 1[(gogoproto.moretags)='form:"topic_id" validate:"required"'];
  55. int64 op = 2[(gogoproto.moretags)='form:"op"'];// 0表示取消置顶,1表示置顶
  56. }
  57. message StickTopicVideoReq {
  58. int64 topic_id = 1[(gogoproto.moretags)='form:"topic_id" validate:"required"'];
  59. int64 svid = 2[(gogoproto.moretags)='form:"svid" validate:"required"'];
  60. int64 op = 3[(gogoproto.moretags)='form:"op"'];// 0表示取消置顶,1表示置顶
  61. }
  62. message SetStickTopicVideoReq {
  63. int64 topic_id = 1[(gogoproto.moretags)='form:"topic_id" validate:"required"'];
  64. repeated int64 svids = 2[(gogoproto.moretags)='form:"svids"'];
  65. }
  66. // 所有查找走同一个接口
  67. message ListCmsTopicsReq {
  68. int32 page = 1[(gogoproto.moretags)='form:"page" validate:"required"'];
  69. string name = 2[(gogoproto.moretags)='form:"name"'];
  70. int64 topic_id = 3[(gogoproto.moretags)='form:"topic_id"'];
  71. int32 state = 4[(gogoproto.moretags)='form:"state"'];
  72. }
  73. message ListCmsTopicsReply {
  74. bool has_more = 1[(gogoproto.jsontag) = "has_more"];
  75. repeated TopicInfo list = 2;
  76. }
  77. service Topic {
  78. ////////////////extension////////////////
  79. rpc Register (VideoExtension) returns (.google.protobuf.Empty);
  80. rpc ListExtension (ListExtensionReq) returns (ListExtensionReply);
  81. //////////////////topic///////////////////
  82. rpc UpdateVideoScore(UpdateVideoScoreReq) returns (.google.protobuf.Empty);
  83. rpc UpdateVideoState(UpdateVideoStateReq) returns (.google.protobuf.Empty);
  84. // 获取话题下的视频
  85. rpc ListTopicVideos (TopicVideosReq) returns (TopicDetail);
  86. // TODO: to deleted. 发现页分成先请求话题,再请求话题下视频
  87. // 获取发现页下的话题
  88. rpc ListDiscoveryTopics (ListDiscoveryTopicReq) returns (ListDiscoveryTopicReply);
  89. // 推荐的话题,不会返回话题内的视频
  90. rpc ListTopics (ListTopicsReq) returns (ListTopicsReply);
  91. ///// cms /////
  92. rpc StickTopic(StickTopicReq) returns (.google.protobuf.Empty);
  93. // 置顶、取消置顶话题下的视频(需要cms先去判断该视频是否可以放在话题中)
  94. rpc StickTopicVideo(StickTopicVideoReq) returns (.google.protobuf.Empty);
  95. rpc SetStickTopicVideo(SetStickTopicVideoReq) returns (.google.protobuf.Empty);
  96. // 注意:该接口不支持复杂条件,当以下三种同时请求的时候只会按顺序选择一种进行返回:
  97. // 话题name查找接口,不区分隐藏,返回数组,但是暂时只会完全匹配,
  98. // 话题隐藏列表接口,按照时间反向排序
  99. // 话题推荐列表接口,按照热度反向排序,其中第一页会包含置顶话题
  100. rpc ListCmsTopics(ListCmsTopicsReq) returns (ListCmsTopicsReply);
  101. // 修改话题简介,topic_id必传传,直接放在http请求里
  102. rpc UpdateTopicDesc(TopicInfo) returns (.google.protobuf.Empty);
  103. rpc UpdateTopicState(TopicInfo) returns (.google.protobuf.Empty);
  104. // 话题详情页,含话题信息+视频信息
  105. // 使用video-c的topic/detail接口,php内部转换成cms逻辑
  106. // 根据svid返回topic_id列表
  107. rpc VideoTopic(VideoTopicReq) returns (VideoTopicReply);
  108. }
  109. message TopicVideoItem {
  110. int64 topic_id = 1;
  111. int64 svid = 2;
  112. double score = 3;
  113. int32 state = 4;
  114. }
  115. message VideoTopicReq {
  116. int64 svid = 1[(gogoproto.moretags)='form:"svid"'];
  117. }
  118. message VideoTopicReply {
  119. repeated TopicVideoItem list = 1;
  120. }
  121. message UpdateTopicStateReq {
  122. int64 topic_id = 1[(gogoproto.moretags)='form:"topic_id"'];
  123. int32 op = 2[(gogoproto.moretags)='form:"op"'];// 0表示通过,1表示下架
  124. }
  125. message TopicInfo {
  126. int64 topic_id = 1[(gogoproto.moretags)='form:"topic_id"'];
  127. string name = 2;
  128. string desc = 3[(gogoproto.moretags)='form:"desc"'];
  129. double score = 4;
  130. int32 state = 5[(gogoproto.moretags)='form:"state"'];// 0表示通过,1表示下架
  131. int32 hot_type = 6[(gogoproto.jsontag)="hot_type"];
  132. string cover_url = 7[(gogoproto.moretags)='form:"cover_url"'];
  133. }
  134. message TitleExtraItem {
  135. int64 id = 1[(gogoproto.jsontag) = "id"];
  136. int64 type = 2[(gogoproto.jsontag) = "type"];
  137. string name = 3[(gogoproto.jsontag) = "name"];
  138. int64 start = 4[(gogoproto.jsontag) = "start"];
  139. int64 end = 5[(gogoproto.jsontag) = "end"];
  140. string scheme = 6[(gogoproto.jsontag) = "scheme"];
  141. }
  142. // 用于传递给上游的extension,通过序列化赋值给extension
  143. message VideoExtension {
  144. int64 svid = 1;
  145. string extension = 2; // 序列化后的Extension会放在这里
  146. }
  147. // 结构化的extension,真正的extension
  148. message Extension {
  149. repeated TitleExtraItem title_extra = 1;
  150. }