golang-im聊天
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

logic.ext.proto 7.8 KiB

2 anni fa
2 anni fa
1 anno fa
2 anni fa
2 anni fa
1 anno fa
2 anni fa
1 anno fa
1 anno fa
2 anni fa
2 anni fa
2 anni fa
1 anno fa
1 anno fa
1 anno fa
2 anni fa
2 anni fa
1 anno fa
2 anni fa
1 anno fa
2 anni fa
1 anno fa
2 anni fa
1 anno fa
1 anno fa
1 anno fa
2 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. syntax = "proto3";
  2. package pb;
  3. option go_package = "gim/pkg/pb/";
  4. import "common.ext.proto";
  5. import "connect.ext.proto";
  6. service LogicExt {
  7. // 注册设备
  8. rpc RegisterDevice (RegisterDeviceReq) returns (RegisterDeviceResp);
  9. // 发送消息
  10. rpc SendMessage (SendMessageReq) returns (SendMessageResp);
  11. // 撤回消息
  12. rpc RecallMessage (RecallMessageReq) returns (RecallMessageResp);
  13. // 推送消息到房间
  14. rpc PushRoom(PushRoomReq)returns(Empty);
  15. // 发送红包
  16. rpc SendRedPacket (SendRedPacketReq) returns (SendRedPacketResp);
  17. // 添加好友
  18. rpc AddFriend (AddFriendReq) returns (Empty);
  19. // 同意添加好友
  20. rpc AgreeAddFriend (AgreeAddFriendReq) returns (Empty);
  21. // 删除好友
  22. rpc DeleteFriend (DeleteFriendReq) returns (Empty);
  23. // 设置好友信息
  24. rpc SetFriend (SetFriendReq) returns (SetFriendResp);
  25. // 获取好友列表
  26. rpc GetFriends (Empty) returns (GetFriendsResp);
  27. // 创建群组
  28. rpc CreateGroup (CreateGroupReq) returns (CreateGroupResp);
  29. // 更新群组
  30. rpc UpdateGroup (UpdateGroupReq) returns (Empty);
  31. // 获取群组信息
  32. rpc GetGroup (GetGroupReq) returns (GetGroupResp);
  33. // 获取用户加入的所有群组
  34. rpc GetGroups (Empty) returns (GetGroupsResp);
  35. // 添加群组成员
  36. rpc AddGroupMembers (AddGroupMembersReq) returns (AddGroupMembersResp);
  37. // 更新群组成员信息
  38. rpc UpdateGroupMember (UpdateGroupMemberReq) returns (Empty);
  39. // 删除群组成员
  40. rpc DeleteGroupMember (DeleteGroupMemberReq) returns (Empty);
  41. // 获取群组成员
  42. rpc GetGroupMembers (GetGroupMembersReq) returns (GetGroupMembersResp);
  43. // 设置禁言
  44. rpc SetGroupBannedMembers (SetGroupMemberBannedReq) returns (SetGroupMemberBannedResp);
  45. // 取消禁言
  46. rpc SetGroupRemoveBannedMembers (SetGroupMemberRemoveBannedReq) returns (Empty);
  47. // 获取群组禁言成员
  48. rpc GetGroupBannedMembers (GetGroupBannedMembersReq) returns (GetGroupBannedMembersResp);
  49. }
  50. message RegisterDeviceReq {
  51. int32 type = 2; // 设备类型
  52. string brand = 3; // 厂商
  53. string model = 4; // 机型
  54. string system_version = 5; // 系统版本
  55. string sdk_version = 6; // sdk版本号
  56. }
  57. message RegisterDeviceResp {
  58. int64 device_id = 1; // 设备id
  59. }
  60. message SendMessageReq {
  61. ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
  62. int64 receiver_id = 2; // 用户id或者群组id
  63. repeated int64 to_user_ids = 3; // 需要@的用户id列表
  64. MessageType message_type = 4; // 消息类型
  65. bytes message_content = 5; // 消息内容
  66. int64 send_time = 6; // 消息发送时间戳,精确到毫秒
  67. bool is_persist = 7; // 是否将消息持久化到数据库
  68. string message_content_back = 8;
  69. }
  70. message SendMessageResp {
  71. int64 seq = 1; // 消息序列号
  72. }
  73. message RecallMessageReq {
  74. ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
  75. int64 receiver_id = 2; // 用户id或者群组id
  76. repeated int64 to_user_ids = 3; // 需要@的用户id列表
  77. MessageType message_type = 4; // 消息类型
  78. bytes message_content = 5; // 消息内容
  79. int64 send_time = 6; // 消息发送时间戳,精确到毫秒
  80. bool is_persist = 7; // 是否将消息持久化到数据库
  81. string message_content_back = 8;
  82. }
  83. message RecallMessageResp {
  84. int64 seq = 1; // 消息序列号
  85. }
  86. message SendRedPacketReq {
  87. ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
  88. int64 receiver_id = 2; // 用户id或者群组id
  89. MessageType message_type = 3; // 消息类型
  90. bytes message_content = 4; // 消息内容
  91. int64 send_time = 5; // 消息发送时间戳,精确到毫秒
  92. repeated int64 to_user_ids = 6; // 红包给到哪些用户(专属红包)
  93. string message_content_back = 7;
  94. }
  95. message SendRedPacketResp {
  96. int64 seq = 1; // 消息序列号
  97. }
  98. message PushRoomReq{
  99. int64 room_id = 1; // 房间id
  100. MessageType message_type = 2; // 消息类型
  101. bytes message_content = 3; // 消息内容
  102. int64 send_time = 4; // 消息发送时间戳,精确到毫秒
  103. bool is_persist = 5; // 是否将消息持久化
  104. bool is_priority = 6; // 是否优先推送
  105. }
  106. message AddFriendReq {
  107. int64 friend_id = 1; // 用户id
  108. string remarks = 2; // 备注
  109. string description = 3; // 描述
  110. }
  111. message DeleteFriendReq {
  112. int64 user_id = 1; // 用户id
  113. }
  114. message AgreeAddFriendReq {
  115. int64 user_id = 1; // 用户id
  116. string remarks = 2; // 备注
  117. }
  118. message SetFriendReq {
  119. int64 friend_id = 1; // 好友id
  120. string remarks = 2; // 备注
  121. string extra = 8; // 附加字段
  122. }
  123. message SetFriendResp {
  124. int64 friend_id = 1; // 好友id
  125. string remarks = 2; // 备注
  126. string extra = 8; // 附加字段
  127. }
  128. message Friend {
  129. int64 user_id = 1; // 用户id
  130. string phone_number = 2; // 电话号码
  131. string nickname = 3; // 昵称
  132. int32 sex = 4; // 性别
  133. string avatar_url = 5; // 头像地址
  134. string user_extra = 6; // 用户附加字段
  135. string remarks = 7; // 备注
  136. string extra = 8; // 附加字段
  137. }
  138. message GetFriendsResp {
  139. repeated Friend friends = 1;
  140. }
  141. message CreateGroupReq {
  142. string name = 1; // 名称
  143. string avatar_url = 2; // 头像
  144. string introduction = 3; // 简介
  145. string extra = 4; // 附加字段
  146. repeated int64 member_ids = 5; // 群组成员ID列表
  147. }
  148. message CreateGroupResp {
  149. int64 group_id = 1; // 群组id
  150. }
  151. message UpdateGroupReq {
  152. int64 group_id = 1; // 群组id
  153. string avatar_url = 2; // 头像
  154. string name = 3; // 名称
  155. string introduction = 4; // 简介
  156. string extra = 5; // 附加字段
  157. }
  158. message GetGroupReq {
  159. int64 group_id = 1;
  160. }
  161. message GetGroupResp {
  162. Group group = 1;
  163. }
  164. message Group {
  165. int64 group_id = 1; // 群组id
  166. string name = 2; // 名称
  167. string avatar_url = 3; // 头像
  168. string introduction = 4; // 简介
  169. int32 user_mum = 5; // 用户数
  170. int32 is_all_member_banned = 6; // 是否全员禁言(1:是 2:否)
  171. string extra = 7; // 附加字段
  172. int64 create_time = 8; // 创建时间
  173. int64 update_time = 9; // 更新时间
  174. }
  175. message GetGroupsResp {
  176. repeated Group groups = 1;
  177. }
  178. message AddGroupMembersReq {
  179. int64 group_id = 1; // 群组id
  180. repeated int64 user_ids = 2; // 用户id列表
  181. }
  182. message AddGroupMembersResp {
  183. repeated int64 user_ids = 1; // 已经在群组的用户id列表
  184. }
  185. enum MemberType {
  186. GMT_UNKNOWN = 0; // 未知
  187. GMT_ADMIN = 1; // 群主
  188. GMT_MEMBER = 2; // 成员
  189. GMT_MANAGE = 3; // 管理员
  190. }
  191. message UpdateGroupMemberReq {
  192. int64 group_id = 1; // 群组id
  193. int64 user_id = 2; // 用户id
  194. MemberType member_type = 3; // 成员类型
  195. string remarks = 4; // 备注
  196. string extra = 5; // 附加字段
  197. }
  198. message DeleteGroupMemberReq {
  199. int64 group_id = 1; // 群组id
  200. int64 user_id = 2; // 用户id
  201. }
  202. message GetGroupMembersReq {
  203. int64 group_id = 1;
  204. }
  205. message GetGroupMembersResp {
  206. repeated GroupMember members = 1;
  207. }
  208. message GroupMember {
  209. int64 user_id = 1;
  210. string nickname = 2; // 昵称
  211. int32 sex = 3; // 性别
  212. string avatar_url = 4; // 头像地址
  213. string user_extra = 5; // 用户附加字段
  214. MemberType member_type = 6; // 成员类型
  215. string remarks = 7; // 备注
  216. string extra = 8; // 群组成员附加字段
  217. int32 status = 9; // 状态
  218. }
  219. message SetGroupMemberBannedReq {
  220. int64 group_id = 1; // 群组id
  221. repeated int64 user_ids = 2; // 用户id列表
  222. AllMemberBannedType is_all_member_banned = 3; // 全员禁言(1:是 2:否)
  223. }
  224. message SetGroupMemberRemoveBannedReq {
  225. int64 group_id = 1; // 群组id
  226. repeated int64 remove_user_ids = 2; // 解除用户id列表
  227. }
  228. enum AllMemberBannedType {
  229. UNKNOWN_All_Member_Banned = 0; // 未知
  230. YES_All_Member_Banned = 1; // 是-全员禁言
  231. NOT_All_Member_Banned = 2; // 否-全员禁言
  232. }
  233. message SetGroupMemberBannedResp {
  234. AllMemberBannedType is_all_member_banned = 3; // 全员禁言(1:是 2:否)
  235. repeated GroupMember members = 1; //禁言人员列表
  236. }
  237. message GetGroupBannedMembersReq {
  238. int64 group_id = 1;
  239. }
  240. message GetGroupBannedMembersResp {
  241. repeated GroupMember members = 1;
  242. }