golang-im聊天
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

logic.ext.proto 7.5 KiB

2 jaren geleden
1 jaar geleden
2 jaren geleden
1 jaar geleden
2 jaren geleden
2 jaren geleden
1 jaar geleden
2 jaren geleden
1 jaar geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
1 jaar geleden
2 jaren geleden
2 jaren geleden
1 jaar geleden
2 jaren geleden
1 jaar geleden
1 jaar geleden
2 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 GetGroupBannedMembers (GetGroupBannedMembersReq) returns (GetGroupBannedMembersResp);
  47. }
  48. message RegisterDeviceReq {
  49. int32 type = 2; // 设备类型
  50. string brand = 3; // 厂商
  51. string model = 4; // 机型
  52. string system_version = 5; // 系统版本
  53. string sdk_version = 6; // sdk版本号
  54. }
  55. message RegisterDeviceResp {
  56. int64 device_id = 1; // 设备id
  57. }
  58. message SendMessageReq {
  59. ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
  60. int64 receiver_id = 2; // 用户id或者群组id
  61. repeated int64 to_user_ids = 3; // 需要@的用户id列表
  62. MessageType message_type = 4; // 消息类型
  63. bytes message_content = 5; // 消息内容
  64. int64 send_time = 6; // 消息发送时间戳,精确到毫秒
  65. bool is_persist = 7; // 是否将消息持久化到数据库
  66. string message_content_back = 8;
  67. }
  68. message SendMessageResp {
  69. int64 seq = 1; // 消息序列号
  70. }
  71. message RecallMessageReq {
  72. ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
  73. int64 receiver_id = 2; // 用户id或者群组id
  74. repeated int64 to_user_ids = 3; // 需要@的用户id列表
  75. MessageType message_type = 4; // 消息类型
  76. bytes message_content = 5; // 消息内容
  77. int64 send_time = 6; // 消息发送时间戳,精确到毫秒
  78. bool is_persist = 7; // 是否将消息持久化到数据库
  79. string message_content_back = 8;
  80. }
  81. message RecallMessageResp {
  82. int64 seq = 1; // 消息序列号
  83. }
  84. message SendRedPacketReq {
  85. ReceiverType receiver_type = 1; // 接收者类型,1:user;2:group
  86. int64 receiver_id = 2; // 用户id或者群组id
  87. MessageType message_type = 3; // 消息类型
  88. bytes message_content = 4; // 消息内容
  89. int64 send_time = 5; // 消息发送时间戳,精确到毫秒
  90. repeated int64 to_user_ids = 6; // 红包给到哪些用户(专属红包)
  91. string message_content_back = 7;
  92. }
  93. message SendRedPacketResp {
  94. int64 seq = 1; // 消息序列号
  95. }
  96. message PushRoomReq{
  97. int64 room_id = 1; // 房间id
  98. MessageType message_type = 2; // 消息类型
  99. bytes message_content = 3; // 消息内容
  100. int64 send_time = 4; // 消息发送时间戳,精确到毫秒
  101. bool is_persist = 5; // 是否将消息持久化
  102. bool is_priority = 6; // 是否优先推送
  103. }
  104. message AddFriendReq {
  105. int64 friend_id = 1; // 用户id
  106. string remarks = 2; // 备注
  107. string description = 3; // 描述
  108. }
  109. message DeleteFriendReq {
  110. int64 user_id = 1; // 用户id
  111. }
  112. message AgreeAddFriendReq {
  113. int64 user_id = 1; // 用户id
  114. string remarks = 2; // 备注
  115. }
  116. message SetFriendReq {
  117. int64 friend_id = 1; // 好友id
  118. string remarks = 2; // 备注
  119. string extra = 8; // 附加字段
  120. }
  121. message SetFriendResp {
  122. int64 friend_id = 1; // 好友id
  123. string remarks = 2; // 备注
  124. string extra = 8; // 附加字段
  125. }
  126. message Friend {
  127. int64 user_id = 1; // 用户id
  128. string phone_number = 2; // 电话号码
  129. string nickname = 3; // 昵称
  130. int32 sex = 4; // 性别
  131. string avatar_url = 5; // 头像地址
  132. string user_extra = 6; // 用户附加字段
  133. string remarks = 7; // 备注
  134. string extra = 8; // 附加字段
  135. }
  136. message GetFriendsResp {
  137. repeated Friend friends = 1;
  138. }
  139. message CreateGroupReq {
  140. string name = 1; // 名称
  141. string avatar_url = 2; // 头像
  142. string introduction = 3; // 简介
  143. string extra = 4; // 附加字段
  144. repeated int64 member_ids = 5; // 群组成员ID列表
  145. }
  146. message CreateGroupResp {
  147. int64 group_id = 1; // 群组id
  148. }
  149. message UpdateGroupReq {
  150. int64 group_id = 1; // 群组id
  151. string avatar_url = 2; // 头像
  152. string name = 3; // 名称
  153. string introduction = 4; // 简介
  154. string extra = 5; // 附加字段
  155. }
  156. message GetGroupReq {
  157. int64 group_id = 1;
  158. }
  159. message GetGroupResp {
  160. Group group = 1;
  161. }
  162. message Group {
  163. int64 group_id = 1; // 群组id
  164. string name = 2; // 名称
  165. string avatar_url = 3; // 头像
  166. string introduction = 4; // 简介
  167. int32 user_mum = 5; // 用户数
  168. int32 is_all_member_banned = 6; // 是否全员禁言(1:是 2:否)
  169. string extra = 7; // 附加字段
  170. int64 create_time = 8; // 创建时间
  171. int64 update_time = 9; // 更新时间
  172. }
  173. message GetGroupsResp {
  174. repeated Group groups = 1;
  175. }
  176. message AddGroupMembersReq {
  177. int64 group_id = 1; // 群组id
  178. repeated int64 user_ids = 2; // 用户id列表
  179. }
  180. message AddGroupMembersResp {
  181. repeated int64 user_ids = 1; // 已经在群组的用户id列表
  182. }
  183. enum MemberType {
  184. GMT_UNKNOWN = 0; // 未知
  185. GMT_ADMIN = 1; // 管理员
  186. GMT_MEMBER = 2; // 成员
  187. }
  188. message UpdateGroupMemberReq {
  189. int64 group_id = 1; // 群组id
  190. int64 user_id = 2; // 用户id
  191. MemberType member_type = 3; // 成员类型
  192. string remarks = 4; // 备注
  193. string extra = 5; // 附加字段
  194. }
  195. message DeleteGroupMemberReq {
  196. int64 group_id = 1; // 群组id
  197. int64 user_id = 2; // 用户id
  198. }
  199. message GetGroupMembersReq {
  200. int64 group_id = 1;
  201. }
  202. message GetGroupMembersResp {
  203. repeated GroupMember members = 1;
  204. }
  205. message GroupMember {
  206. int64 user_id = 1;
  207. string nickname = 2; // 昵称
  208. int32 sex = 3; // 性别
  209. string avatar_url = 4; // 头像地址
  210. string user_extra = 5; // 用户附加字段
  211. MemberType member_type = 6; // 成员类型
  212. string remarks = 7; // 备注
  213. string extra = 8; // 群组成员附加字段
  214. int32 status = 9; // 状态
  215. }
  216. message SetGroupMemberBannedReq {
  217. int64 group_id = 1; // 群组id
  218. repeated int64 user_ids = 2; // 用户id列表
  219. AllMemberBannedType is_all_member_banned = 3; // 全员禁言(1:是 2:否)
  220. }
  221. enum AllMemberBannedType {
  222. UNKNOWN_All_Member_Banned = 0; // 未知
  223. YES_All_Member_Banned = 1; // 是-全员禁言
  224. NOT_All_Member_Banned = 2; // 否-全员禁言
  225. }
  226. message SetGroupMemberBannedResp {
  227. AllMemberBannedType is_all_member_banned = 3; // 全员禁言(1:是 2:否)
  228. repeated GroupMember members = 1; //禁言人员列表
  229. }
  230. message GetGroupBannedMembersReq {
  231. int64 group_id = 1;
  232. }
  233. message GetGroupBannedMembersResp {
  234. repeated GroupMember members = 1;
  235. }