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 6.6 KiB

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