V2TIMManager+Group.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. /////////////////////////////////////////////////////////////////////
  2. //
  3. // 腾讯云通信服务 IMSDK
  4. //
  5. // 模块名称:V2TIMManager+Group
  6. //
  7. // 群组高级接口,里面包含了群组的高级功能,比如群成员邀请、非群成员申请进群等操作接口。
  8. //
  9. /////////////////////////////////////////////////////////////////////
  10. #import "V2TIMManager.h"
  11. #import "V2TIMManager+Message.h"
  12. #import "V2TIMManager+Conversation.h"
  13. @class V2TIMGroupMemberOperationResult;
  14. @class V2TIMGroupApplicationResult;
  15. @class V2TIMCreateGroupMemberInfo;
  16. @class V2TIMGroupInfo;
  17. @class V2TIMGroupInfoResult;
  18. @class V2TIMGroupApplication;
  19. @class V2TIMGroupSearchParam;
  20. @class V2TIMGroupSearchResult;
  21. @class V2TIMGroupMemberSearchParam;
  22. @class V2TIMGroupMemberSearchResult;
  23. @class V2TIMGroupAtInfo;
  24. /////////////////////////////////////////////////////////////////////////////////
  25. //
  26. // 群相关的高级接口
  27. //
  28. /////////////////////////////////////////////////////////////////////////////////
  29. V2TIM_EXPORT @interface V2TIMManager (Group)
  30. /// 获取已加入群列表成功回调
  31. typedef void (^V2TIMGroupInfoListSucc)(NSArray<V2TIMGroupInfo *> *groupList);
  32. /// 获取指定群列表成功回调
  33. typedef void (^V2TIMGroupInfoResultListSucc)(NSArray<V2TIMGroupInfoResult *> *groupResultList);
  34. /// 云端搜索群组的结果回调
  35. typedef void (^V2TIMGroupSearchResultSucc)(V2TIMGroupSearchResult *searchResult);
  36. /// 获取群属性列表成功回调
  37. typedef void (^V2TIMGroupAttributeListSucc)(NSMutableDictionary<NSString *,NSString *> *groupAttributeList);
  38. /// 获取群成员列表成功回调
  39. typedef void (^V2TIMGroupMemberInfoListSucc)(NSArray<V2TIMGroupMemberFullInfo *> *memberList);
  40. /// 获取指定群成员列表成功回调
  41. typedef void (^V2TIMGroupMemberInfoResultSucc)(uint64_t nextSeq, NSArray<V2TIMGroupMemberFullInfo *> * memberList);
  42. /// 搜索本地群成员列表成功回调
  43. typedef void (^V2TIMGroupMemberInfoListSearchSucc)(NSDictionary<NSString *, NSArray<V2TIMGroupMemberFullInfo *> *> *memberList);
  44. /// 搜索云端群成员列表成功回调
  45. typedef void (^V2TIMGroupMemberSearchResultSucc)(V2TIMGroupMemberSearchResult *searchResult);
  46. /// 群成员操作成功回调
  47. typedef void (^V2TIMGroupMemberOperationResultListSucc)(NSArray<V2TIMGroupMemberOperationResult*> * resultList);
  48. /// 获取好友申请列表成功回调
  49. typedef void (^V2TIMGroupApplicationResultSucc)(V2TIMGroupApplicationResult *result);
  50. /// 获取群在线人数成功回调
  51. typedef void (^V2TIMGroupOnlineMemberCountSucc)(NSInteger count);
  52. /// 群计数器操作成功的回调
  53. typedef void (^V2TIMGroupCounterResultSucc)(NSDictionary<NSString *, NSNumber *> *groupCounters);
  54. /// 加群选项
  55. typedef NS_ENUM(NSInteger, V2TIMGroupAddOpt) {
  56. V2TIM_GROUP_ADD_FORBID = 0, ///< 禁止加群
  57. V2TIM_GROUP_ADD_AUTH = 1, ///< 需要管理员审批
  58. V2TIM_GROUP_ADD_ANY = 2, ///< 任何人可以加入
  59. };
  60. /// 群组操作结果
  61. typedef NS_ENUM(NSInteger, V2TIMGroupMemberResult) {
  62. V2TIM_GROUP_MEMBER_RESULT_FAIL = 0, ///< 操作失败
  63. V2TIM_GROUP_MEMBER_RESULT_SUCC = 1, ///< 操作成功
  64. V2TIM_GROUP_MEMBER_RESULT_INVALID = 2, ///< 无效操作,加群时已经是群成员,移除群组时不在群内
  65. V2TIM_GROUP_MEMBER_RESULT_PENDING = 3, ///< 等待处理,邀请入群时等待审批
  66. V2TIM_GROUP_MEMBER_RESULT_OVERLIMIT = 4, ///< 操作失败,创建群指定初始群成员列表或邀请入群时,被邀请者加入的群总数超限
  67. };
  68. /// 群成员角色过滤方式
  69. typedef NS_ENUM(NSInteger, V2TIMGroupMemberFilter) {
  70. V2TIM_GROUP_MEMBER_FILTER_ALL = 0x00, ///< 全部成员
  71. V2TIM_GROUP_MEMBER_FILTER_OWNER = 0x01, ///< 群主
  72. V2TIM_GROUP_MEMBER_FILTER_ADMIN = 0x02, ///< 管理员
  73. V2TIM_GROUP_MEMBER_FILTER_COMMON = 0x04, ///< 普通成员
  74. };
  75. /// 群组未决请求类型
  76. typedef NS_ENUM(NSInteger, V2TIMGroupApplicationType) {
  77. V2TIM_GROUP_JOIN_APPLICATION_NEED_APPROVED_BY_ADMIN = 0x0, ///< 需要群主或管理员审批的申请加群请求
  78. V2TIM_GROUP_INVITE_APPLICATION_NEED_APPROVED_BY_INVITEE = 0x1, ///< 需要被邀请者同意的邀请入群请求
  79. V2TIM_GROUP_INVITE_APPLICATION_NEED_APPROVED_BY_ADMIN = 0x2, ///< 需要群主或管理员审批的邀请入群请求
  80. };
  81. /// 群组已决标志
  82. typedef NS_ENUM(NSInteger, V2TIMGroupApplicationHandleStatus) {
  83. V2TIM_GROUP_APPLICATION_HANDLE_STATUS_UNHANDLED = 0, ///< 未处理
  84. V2TIM_GROUP_APPLICATION_HANDLE_STATUS_HANDLED_BY_OTHER = 1, ///< 被他人处理
  85. V2TIM_GROUP_APPLICATION_HANDLE_STATUS_HANDLED_BY_SELF = 2, ///< 自己已处理
  86. };
  87. /// 群组已决结果
  88. typedef NS_ENUM(NSInteger, V2TIMGroupApplicationHandleResult) {
  89. V2TIM_GROUP_APPLICATION_HANDLE_RESULT_REFUSE = 0, ///< 拒绝申请
  90. V2TIM_GROUP_APPLICATION_HANDLE_RESULT_AGREE = 1, ///< 同意申请
  91. };
  92. /////////////////////////////////////////////////////////////////////////////////
  93. // 群管理
  94. /////////////////////////////////////////////////////////////////////////////////
  95. /**
  96. * 1.1 创建自定义群组(高级版本:可以指定初始的群成员)
  97. *
  98. * @param info 自定义群组信息,可以设置 groupID | groupType | groupName | notification | introduction | faceURL 字段
  99. * @param memberList 指定初始的群成员(直播群 AVChatRoom 不支持指定初始群成员,memberList 请传 nil)
  100. *
  101. * @note
  102. * - 后台限制邀请的群成员个数不能超过 20
  103. * - 其他限制请参考 V2TIMManager.h -> createGroup 注释
  104. */
  105. - (void)createGroup:(V2TIMGroupInfo*)info memberList:(NSArray<V2TIMCreateGroupMemberInfo *>*) memberList succ:(V2TIMCreateGroupSucc)succ fail:(V2TIMFail)fail;
  106. /**
  107. * 1.2 获取当前用户已经加入的群列表
  108. *
  109. * @note
  110. * - 直播群(AVChatRoom)不支持该 API
  111. * - 该接口有频限检测,SDK 限制调用频率为 1 秒 10 次,超过限制后会报 ERR_SDK_COMM_API_CALL_FREQUENCY_LIMIT (7008)错误
  112. */
  113. - (void)getJoinedGroupList:(V2TIMGroupInfoListSucc)succ fail:(V2TIMFail)fail;
  114. /////////////////////////////////////////////////////////////////////////////////
  115. // 群资料管理
  116. /////////////////////////////////////////////////////////////////////////////////
  117. /**
  118. * 2.1 拉取群资料
  119. *
  120. * @param groupIDList 群组 ID 列表
  121. */
  122. - (void)getGroupsInfo:(NSArray<NSString *> *)groupIDList succ:(V2TIMGroupInfoResultListSucc)succ fail:(V2TIMFail)fail;
  123. /**
  124. * 2.2 搜索本地群资料(5.4.666 及以上版本支持)
  125. * @note 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17474)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17176#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)
  126. */
  127. - (void)searchGroups:(V2TIMGroupSearchParam *)searchParam succ:(V2TIMGroupInfoListSucc)succ fail:(V2TIMFail)fail;
  128. /**
  129. * 2.3 搜索云端群资料(8.4 及以上版本支持)
  130. * @note 该功能为 IM 增值功能,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17176#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)
  131. */
  132. - (void)searchCloudGroups:(V2TIMGroupSearchParam *)searchParam succ:(V2TIMGroupSearchResultSucc)succ fail:(V2TIMFail)fail;
  133. /**
  134. * 2.4 修改群资料
  135. */
  136. - (void)setGroupInfo:(V2TIMGroupInfo *)info succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  137. /**
  138. * 2.5 初始化群属性,会清空原有的群属性列表
  139. *
  140. * @note
  141. * attributes 的使用限制如下:
  142. * - 6.7 及其以前版本,只支持 AVChatRoom 直播群;
  143. * - 从 6.8 版本开始,同时支持 AVChatRoom、Public、Meeting、Work 四种群类型;
  144. * - 从 7.0 版本开始,除了话题外,群属性支持所有的群类型;
  145. * - key 最多支持 16 个,长度限制为 32 字节;
  146. * - value 长度限制为 4k;
  147. * - 总的 attributes(包括 key 和 value)限制为 16k;
  148. * - initGroupAttributes、setGroupAttributes、deleteGroupAttributes 接口合并计算, SDK 限制为 5 秒 10 次,超过后回调 8511 错误码;后台限制 1 秒 5 次,超过后返回 10049 错误码;
  149. * - getGroupAttributes 接口 SDK 限制 5 秒 20 次;
  150. * - 从 5.6 版本开始,当每次APP启动后初次修改群属性时,请您先调用 getGroupAttributes 拉取到最新的群属性之后,再发起修改操作;
  151. * - 从 5.6 版本开始,当多个用户同时修改同一个群属性时,只有第一个用户可以执行成功,其它用户会收到 10056 错误码;收到这个错误码之后,请您调用 getGroupAttributes 把本地保存的群属性更新到最新之后,再发起修改操作。
  152. */
  153. - (void)initGroupAttributes:(NSString*)groupID attributes:(NSDictionary<NSString *,NSString *> *)attributes succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  154. /**
  155. * 2.6 设置群属性,已有该群属性则更新其 value 值,没有该群属性则添加该群属性。
  156. * @note
  157. * - 6.7 及其以前版本,只支持 AVChatRoom 直播群;
  158. * - 从 6.8 版本开始,同时支持 AVChatRoom、Public、Meeting、Work 四种群类型;
  159. * - 从 7.0 版本开始,除了话题外,群属性支持所有的群类型。
  160. */
  161. - (void)setGroupAttributes:(NSString*)groupID attributes:(NSDictionary<NSString *,NSString *> *)attributes succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  162. /**
  163. * 2.7 删除群指定属性,keys 传 nil 则清空所有群属性。
  164. * @note
  165. * - 6.7 及其以前版本,只支持 AVChatRoom 直播群;
  166. * - 从 6.8 版本开始,同时支持 AVChatRoom、Public、Meeting、Work 四种群类型;
  167. * - 从 7.0 版本开始,除了话题外,群属性支持所有的群类型。
  168. */
  169. - (void)deleteGroupAttributes:(NSString*)groupID keys:(NSArray<NSString *> *)keys succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  170. /**
  171. * 2.8 获取群指定属性,keys 传 nil 则获取所有群属性。
  172. * @note
  173. * - 6.7 及其以前版本,只支持 AVChatRoom 直播群;
  174. * - 从 6.8 版本开始,同时支持 AVChatRoom、Public、Meeting、Work 四种群类型;
  175. * - 从 7.0 版本开始,除了话题外,群属性支持所有的群类型。
  176. */
  177. - (void)getGroupAttributes:(NSString*)groupID keys:(NSArray<NSString *> *)keys succ:(V2TIMGroupAttributeListSucc)succ fail:(V2TIMFail)fail;
  178. /**
  179. * 2.9 获取指定群在线人数
  180. *
  181. * @param groupID 群id
  182. * @param succ 成功回调
  183. * @param fail 失败回调
  184. *
  185. * @note
  186. * - IMSDK 7.3 以前的版本仅支持直播群( AVChatRoom);
  187. * - IMSDK 7.3 及其以后的版本支持所有群类型。
  188. */
  189. - (void)getGroupOnlineMemberCount:(NSString*)groupID succ:(V2TIMGroupOnlineMemberCountSucc)succ fail:(V2TIMFail)fail;
  190. /**
  191. * 2.10 设置群计数器(7.0 及其以上版本支持)
  192. *
  193. * @note
  194. * - 该计数器的 key 如果存在,则直接更新计数器的 value 值;如果不存在,则添加该计数器的 key-value;
  195. * - 当群计数器设置成功后,在 succ 回调中会返回最终成功设置的群计数器信息;
  196. * - 除了社群和话题,群计数器支持所有的群组类型。
  197. */
  198. - (void)setGroupCounters:(NSString *)groupID counters:(NSDictionary<NSString *, NSNumber *> *)counters succ:(V2TIMGroupCounterResultSucc)succ fail:(V2TIMFail)fail;
  199. /**
  200. * 2.11 获取群计数器(7.0 及其以上版本支持)
  201. *
  202. * @note
  203. * - 如果 keys 为空,则表示获取群内的所有计数器;
  204. * - 除了社群和话题,群计数器支持所有的群组类型。
  205. */
  206. - (void)getGroupCounters:(NSString *)groupID keys:(NSArray<NSString *> *)keys succ:(V2TIMGroupCounterResultSucc)succ fail:(V2TIMFail)fail;
  207. /**
  208. * 2.12 递增群计数器(7.0 及其以上版本支持)
  209. *
  210. * @param groupID 群 ID
  211. * @param key 群计数器的 key
  212. * @param value 群计数器的递增的变化量,计数器 key 对应的 value 变更方式为: new_value = old_value + value
  213. * @param succ 成功后的回调,会返回当前计数器做完递增操作后的 value
  214. * @param fail 失败的回调
  215. *
  216. * @note
  217. * - 该计数器的 key 如果存在,则直接在当前值的基础上根据传入的 value 作递增操作;反之,添加 key,并在默认值为 0 的基础上根据传入的 value 作递增操作;
  218. * - 除了社群和话题,群计数器支持所有的群组类型。
  219. */
  220. - (void)increaseGroupCounter:(NSString *)groupID key:(NSString *)key value:(NSInteger)value succ:(V2TIMGroupCounterResultSucc)succ fail:(V2TIMFail)fail;
  221. /**
  222. * 2.13 递减群计数器(7.0 及其以上版本支持)
  223. *
  224. * @param groupID 群 ID
  225. * @param key 群计数器的 key
  226. * @param value 群计数器的递减的变化量,计数器 key 对应的 value 变更方式为: new_value = old_value - value
  227. * @param succ 成功后的回调,会返回当前计数器做完递减操作后的 value
  228. * @param fail 失败的回调
  229. *
  230. * @note
  231. * - 该计数器的 key 如果存在,则直接在当前值的基础上根据传入的 value 作递减操作;反之,添加 key,并在默认值为 0 的基础上根据传入的 value 作递减操作
  232. * - 除了社群和话题,群计数器支持所有的群组类型。
  233. */
  234. - (void)decreaseGroupCounter:(NSString *)groupID key:(NSString *)key value:(NSInteger)value succ:(V2TIMGroupCounterResultSucc)succ fail:(V2TIMFail)fail;
  235. /////////////////////////////////////////////////////////////////////////////////
  236. // 群成员管理
  237. /////////////////////////////////////////////////////////////////////////////////
  238. /**
  239. * 3.1 获取群成员列表
  240. *
  241. * @param filter 指定群成员类型。
  242. * @param nextSeq 分页拉取标志,第一次拉取填 0,回调成功如果 nextSeq 不为零,需要分页,传入再次拉取,直至为 0。
  243. *
  244. * @note
  245. * - 普通群(工作群、会议群、公开群)的限制:
  246. * 1. filter 只能设置为 V2TIMGroupMemberFilter 定义的数值,SDK 会返回指定角色的成员。
  247. *
  248. * - 直播群(AVChatRoom)的限制:
  249. * 1. 如果设置 filter 为 V2TIMGroupMemberFilter 定义的数值,SDK 返回全部成员。返回的人数规则为:拉取最近入群群成员最多 1000 人,新进来的成员排在前面,需要升级旗舰版,并且在 [控制台](https://console.cloud.tencent.com/im) 开启“直播群在线成员列表”开关(6.3 及以上版本支持)。
  250. * 2. 如果设置 filter 为群成员自定义标记,旗舰版支持拉取指定标记的成员列表。标记群成员的设置请参考 markGroupMemberList:memberList:markType:enableMark:succ:fail: API。
  251. * 3. 程序重启后,请重新加入群组,否则拉取群成员会报 10007 错误码。
  252. * 4. 群成员资料信息仅支持 userID | nickName | faceURL | role 字段。
  253. *
  254. * - 社群(Community)的限制:
  255. * 1. 如果设置 filter 为 V2TIMGroupMemberFilter 定义的数值,SDK 返回指定角色的成员。
  256. * 2. 如果设置 filter 为群成员自定义标记,旗舰版支持拉取指定标记的成员列表(7.5 及以上版本支持)。标记群成员的设置请参考 markGroupMemberList:memberList:markType:enableMark:succ:fail: API。
  257. */
  258. - (void)getGroupMemberList:(NSString*)groupID filter:(uint32_t)filter nextSeq:(uint64_t)nextSeq succ:(V2TIMGroupMemberInfoResultSucc)succ fail:(V2TIMFail)fail;
  259. /**
  260. * 3.2 指定的群成员资料
  261. */
  262. - (void)getGroupMembersInfo:(NSString*)groupID memberList:(NSArray<NSString*>*)memberList succ:(V2TIMGroupMemberInfoListSucc)succ fail:(V2TIMFail)fail;
  263. /**
  264. * 3.3 搜索本地群成员资料(5.4.666 及以上版本支持)
  265. *
  266. * @param searchParam 搜索参数
  267. * @note 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17474)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17176#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)
  268. */
  269. - (void)searchGroupMembers:(V2TIMGroupMemberSearchParam *)searchParam
  270. succ:(V2TIMGroupMemberInfoListSearchSucc)succ
  271. fail:(V2TIMFail)fail;
  272. /**
  273. * 3.4 搜索云端群成员资料(8.4 及以上版本支持)
  274. *
  275. * @param searchParam 搜索参数
  276. * @note 该功能为 IM 增值功能,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17176#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)
  277. */
  278. - (void)searchCloudGroupMembers:(V2TIMGroupMemberSearchParam *)searchParam
  279. succ:(V2TIMGroupMemberSearchResultSucc)succ
  280. fail:(V2TIMFail)fail;
  281. /**
  282. * 3.5 修改指定的群成员资料
  283. */
  284. - (void)setGroupMemberInfo:(NSString*)groupID info:(V2TIMGroupMemberFullInfo *)info succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  285. /**
  286. * 3.6 禁言群成员(只有管理员或群主能够调用)
  287. *
  288. * @param seconds 禁言时间长度,单位秒,表示调用该接口成功后多少秒内不允许被禁言用户再发言。
  289. */
  290. - (void)muteGroupMember:(NSString*)groupID member:(NSString*)userID muteTime:(uint32_t)seconds succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  291. /**
  292. * 3.7 禁言全体群成员,只有管理员或群主能够调用(7.5 及以上版本支持)
  293. *
  294. * @param groupID 群组 ID
  295. * @param isMute YES 表示禁言,NO 表示解除禁言
  296. *
  297. * @note
  298. * - 禁言全体群成员没有时间限制,设置 isMute 为 NO 则解除禁言。
  299. * - 禁言或解除禁言后,会触发 V2TIMGroupListener 中的 onAllGroupMembersMuted:isMute: 回调。
  300. * - 群主和管理员可以禁言普通成员。普通成员不能操作禁言/解除禁言。
  301. */
  302. - (void)muteAllGroupMembers:(NSString*)groupID isMute:(BOOL)isMute succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  303. /**
  304. * 3.8 邀请他人入群
  305. *
  306. * @note 请注意不同类型的群有如下限制:
  307. * - 工作群(Work):群里的任何人都可以邀请其他人进群。
  308. * - 会议群(Meeting)和公开群(Public):默认不允许邀请加入群,您可以修改群资料 V2TIMGroupInfo 的 groupApproveOpt 字段打开邀请入群方式。打开该选项之后,群里的任何人都可以邀请其他人进群。
  309. * - 直播群(AVChatRoom):不支持此功能。
  310. * - 后台限制单次邀请的群成员个数不能超过 20。
  311. */
  312. - (void)inviteUserToGroup:(NSString*)groupID userList:(NSArray<NSString *>*)userList succ:(V2TIMGroupMemberOperationResultListSucc)succ fail:(V2TIMFail)fail;
  313. /**
  314. * 3.9 踢人
  315. *
  316. * @param groupID 群 id
  317. * @param memberList 被踢用户的 userID 列表
  318. * @param reason 被踢的原因
  319. * @param duration 指定自被踢出群组开始算起,禁止被踢用户重新申请加群的时长,单位:秒
  320. * @param succ 成功后的回调
  321. * @param fail 失败后的回调
  322. *
  323. * @note
  324. * - 从 7.2 版本开始,支持设置一个时长参数,用于指定用户从被踢出群组开始算起,禁止重新申请加群的时长;
  325. * - 工作群(Work):只有群主或 APP 管理员可以踢人;
  326. * - 公开群(Public)、会议群(Meeting):群主、管理员和 APP 管理员可以踢人;
  327. * - 直播群(AVChatRoom):6.6 之前版本只支持禁言(muteGroupMember),不支持踢人。6.6 及以上版本支持禁言和踢人。需要您购买旗舰版套餐;
  328. * - 该接口其他使用限制请查阅:https://cloud.tencent.com/document/product/269/75400#.E8.B8.A2.E4.BA.BA。
  329. */
  330. - (void)kickGroupMember:(NSString *)groupID memberList:(NSArray<NSString *> *)memberList reason:(NSString *)reason duration:(uint32_t)duration succ:(V2TIMGroupMemberOperationResultListSucc)succ fail:(V2TIMFail)fail;
  331. /**
  332. * 3.10 切换群成员的角色
  333. *
  334. * @note 请注意不同类型的群有如下限制:
  335. * - 工作群(Work)不支持设置群成员角色。
  336. * - 只有群主才能对群成员进行普通成员和管理员之间的角色切换。
  337. * - 转让群组请调用 @ref transferGroupOwner 接口。
  338. * - 会议群(Meeting)切换群成员角色之后,不会有 onGrantAdministrator 和 onRevokeAdministrator 通知回调。
  339. * - 切换的角色支持普通群成员( V2TIM_GROUP_MEMBER_ROLE_MEMBER) 和管理员(V2TIM_GROUP_MEMBER_ROLE_ADMIN)。
  340. */
  341. - (void)setGroupMemberRole:(NSString*)groupID member:(NSString *)userID newRole:(uint32_t)role succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  342. /**
  343. * 3.11 标记群成员(需要您购买旗舰版套餐)
  344. *
  345. * @param groupID 群 ID。
  346. * @param memberList 群成员 ID 列表。
  347. * @param markType 标记类型。数字类型,大于等于 1000,您可以自定义,一个群组里最多允许定义 10 个标记。
  348. * @param enableMark YES 表示添加标记,NO 表示移除标记。
  349. * @note
  350. * - 直播群从 6.6 版本开始支持。
  351. * - 社群从 7.5 版本开始支持。
  352. * - 只有群主才有权限标记群组中其他人。
  353. */
  354. - (void)markGroupMemberList:(NSString *)groupID memberList:(NSArray<NSString *> *)memberList markType:(uint32_t)markType enableMark:(BOOL)enableMark succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  355. /**
  356. * 3.12 转让群主
  357. *
  358. * @note 请注意不同类型的群有如下限制:
  359. * - 普通类型的群(Work、Public、Meeting):只有群主才有权限进行群转让操作。
  360. * - 直播群(AVChatRoom):不支持转让群主。
  361. */
  362. - (void)transferGroupOwner:(NSString*)groupID member:(NSString*)userID succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  363. /**
  364. * 3.13 踢人(直播群踢人从 6.6 版本开始支持,需要您购买旗舰版套餐)
  365. *
  366. * @note 使用限制如下:
  367. * - 待废弃接口,请使用 kickGroupMember:memberList:reason:duration:succ:fail: 接口;
  368. * - 工作群(Work):只有群主或 APP 管理员可以踢人;
  369. * - 公开群(Public)、会议群(Meeting):群主、管理员和 APP 管理员可以踢人;
  370. * - 直播群(AVChatRoom):6.6 之前版本只支持禁言(muteGroupMember),不支持踢人。6.6 及以上版本支持禁言和踢人;
  371. * - 该接口其他使用限制请查阅:https://cloud.tencent.com/document/product/269/75400#.E8.B8.A2.E4.BA.BA。
  372. */
  373. - (void)kickGroupMember:(NSString *)groupID memberList:(NSArray<NSString *> *)memberList reason:(NSString *)reason succ:(V2TIMGroupMemberOperationResultListSucc)succ fail:(V2TIMFail)fail __attribute__((deprecated("use kickGroupMember:memberList:reason:duration:succ:fail:")));
  374. /////////////////////////////////////////////////////////////////////////////////
  375. // 加群申请
  376. /////////////////////////////////////////////////////////////////////////////////
  377. /**
  378. * 4.1 获取加群申请列表
  379. * @note 最多支持50个
  380. */
  381. - (void)getGroupApplicationList:(V2TIMGroupApplicationResultSucc)succ fail:(V2TIMFail)fail;
  382. /**
  383. * 4.2 同意某一条加群申请
  384. */
  385. - (void)acceptGroupApplication:(V2TIMGroupApplication *)application reason:(NSString*)reason succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  386. /**
  387. * 4.3 拒绝某一条加群申请
  388. */
  389. - (void)refuseGroupApplication:(V2TIMGroupApplication *)application reason:(NSString*)reason succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  390. /**
  391. * 4.4 标记申请列表为已读
  392. */
  393. - (void)setGroupApplicationRead:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  394. @end
  395. /////////////////////////////////////////////////////////////////////////////////
  396. //
  397. // 群基本资料(可以通过 getGroupInfo 获取,不支持由客户自行创建)
  398. //
  399. /////////////////////////////////////////////////////////////////////////////////
  400. /// 群资料
  401. V2TIM_EXPORT @interface V2TIMGroupInfo : NSObject
  402. /**
  403. * 群组 ID
  404. *
  405. * @note 自定义群组 ID 必须为可打印 ASCII 字符(0x20-0x7e),最长 48 个字节,且前缀不能为 @TGS#(避免与默认分配的群组 ID 混淆)
  406. */
  407. @property(nonatomic,strong) NSString* groupID;
  408. /// 群类型
  409. @property(nonatomic,strong) NSString* groupType;
  410. /**
  411. * 社群是否支持创建话题
  412. * @note 只在群类型为 Community 时有效
  413. */
  414. @property(nonatomic,assign) BOOL isSupportTopic;
  415. /**
  416. * 群名称
  417. *
  418. * @note 群名称最长 100 字节,使用 UTF-8 编码
  419. */
  420. @property(nonatomic,strong) NSString* groupName;
  421. /**
  422. * 群公告
  423. *
  424. * @note 群公告最长 400 字节,使用 UTF-8 编码
  425. */
  426. @property(nonatomic,strong) NSString* notification;
  427. /**
  428. * 群简介
  429. *
  430. * @note 群简介最长 400 字节,使用 UTF-8 编码
  431. */
  432. @property(nonatomic,strong) NSString* introduction;
  433. /**
  434. * 群头像
  435. *
  436. * @note 群头像 URL 最长 500 字节,使用 UTF-8 编码
  437. */
  438. @property(nonatomic,strong) NSString* faceURL;
  439. /// 是否全员禁言
  440. @property(nonatomic,assign) BOOL allMuted;
  441. ///设置群自定义字段需要两个步骤:
  442. ///1.在 [控制台](https://console.cloud.tencent.com/im) (功能配置 -> 群自定义字段) 配置群自定义字段的 key 值,Key 为 String 类型,长度不超过 16 字节。
  443. ///2.调用 setGroupInfo 接口设置该字段,value 为 NSData 数据,长度不超过 512 字节。
  444. ///@note 该字段主要用于 V1 和 V2 版本的兼容,如果您直接使用的是 V2 版本的 API ,建议使用 initGroupAttributes 接口设置群属性,其设置更灵活(无需控制台配置),支持的存储也更大(最大支持 16K)
  445. @property(nonatomic,strong) NSDictionary<NSString *,NSData *>* customInfo;
  446. /// 群创建人/管理员
  447. @property(nonatomic,strong,readonly) NSString *owner;
  448. /// 创建群组的 UTC 时间戳
  449. @property(nonatomic,assign,readonly) uint32_t createTime;
  450. /// 申请进群是否需要管理员审批:工作群(Work)默认值为 V2TIM_GROUP_ADD_FORBID,即默认不允许申请入群,您可以修改该字段打开申请入群方式。
  451. @property(nonatomic,assign) V2TIMGroupAddOpt groupAddOpt;
  452. /// 邀请进群是否需要管理员审批 (从 7.1 版本开始支持)
  453. /// - 除工作群(Work)之外的其他群类型默认值都为 V2TIM_GROUP_ADD_FORBID,即默认不允许邀请入群,您可以修改该字段打开邀请入群方式。
  454. /// - 直播群、社群和话题默认不允许邀请入群,也不支持修改。
  455. @property(nonatomic,assign) V2TIMGroupAddOpt groupApproveOpt;
  456. /// 上次修改群信息的 UTC 时间戳
  457. @property(nonatomic,assign,readonly) uint32_t lastInfoTime;
  458. /// 群最近一次发消息时间
  459. @property(nonatomic,assign,readonly) uint32_t lastMessageTime;
  460. /// 已加入的群成员数量
  461. @property(nonatomic,assign,readonly) uint32_t memberCount;
  462. /// 在线的群成员数量(待废弃字段,请使用 getGroupOnlineMemberCount:succ:fail: 接口获取群在线人数)
  463. @property(nonatomic,assign,readonly) uint32_t onlineCount __attribute__((deprecated("use getGroupOnlineMemberCount:succ:fail: instead")));
  464. /// 最多允许加入的群成员数量
  465. /// @note 各类群成员人数限制详见: https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E9.99.90.E5.88.B6.E5.B7.AE.E5.BC.82
  466. @property(nonatomic,assign,readonly) uint32_t memberMaxCount;
  467. /// 当前用户在此群组中的角色(V2TIMGroupMemberRole),切换角色请调用 setGroupMemberRole 接口
  468. @property(nonatomic,assign,readonly) uint32_t role;
  469. /// 当前用户在此群组中的消息接收选项,修改群消息接收选项请调用 setGroupReceiveMessageOpt 接口
  470. @property(nonatomic,assign,readonly) V2TIMReceiveMessageOpt recvOpt;
  471. /// 当前用户加入此群的 UTC 时间戳,不支持设置,系统自动生成
  472. @property(nonatomic,assign,readonly) uint32_t joinTime;
  473. /// 是否开启权限组能力,仅支持社群,7.8 版本开始支持
  474. /// 开启后,管理员角色的权限失效,用群权限、话题权限和权限组能力来对社群、话题进行管理。
  475. @property(nonatomic,assign) BOOL enablePermissionGroup;
  476. /// 群权限,仅支持社群,7.8 版本开始支持
  477. /// 群成员在没有加入任何权限组时的默认权限,仅在 enablePermissionGroup = true 打开权限组之后生效
  478. @property(nonatomic,assign) uint64_t defaultPermissions;
  479. @end
  480. /// 获取群组资料结果
  481. V2TIM_EXPORT @interface V2TIMGroupInfoResult : NSObject
  482. /// 结果 0:成功;非0:失败
  483. @property(nonatomic,assign) int resultCode;
  484. /// 如果获取失败,会返回错误信息
  485. @property(nonatomic,strong) NSString *resultMsg;
  486. /// 如果获取成功,会返回对应的 info
  487. @property(nonatomic,strong) V2TIMGroupInfo *info;
  488. @end
  489. /////////////////////////////////////////////////////////////////////////////////
  490. //
  491. // 群申请信息(可以通过 getGroupApplicationList 获取,不支持由客户自行创建)
  492. //
  493. /////////////////////////////////////////////////////////////////////////////////
  494. /// 群申请信息
  495. V2TIM_EXPORT @interface V2TIMGroupApplication : NSObject
  496. /// 群组 ID
  497. @property(nonatomic,strong,readonly) NSString* groupID;
  498. /// 请求者 userID
  499. @property(nonatomic,strong,readonly) NSString* fromUser;
  500. /// 请求者昵称
  501. @property(nonatomic,strong,readonly) NSString* fromUserNickName;
  502. /// 请求者头像
  503. @property(nonatomic,strong,readonly) NSString* fromUserFaceUrl;
  504. /// 判决者id,有人请求加群:0,邀请其他人加群:被邀请人用户 ID
  505. @property(nonatomic,strong,readonly) NSString* toUser;
  506. /// 申请时间
  507. @property(nonatomic,assign,readonly) uint64_t addTime;
  508. /// 申请或邀请附加信息
  509. @property(nonatomic,strong,readonly) NSString* requestMsg;
  510. /// 审批信息:同意或拒绝信息
  511. @property(nonatomic,strong,readonly) NSString* handledMsg;
  512. /// 请求类型
  513. @property(nonatomic,assign,readonly) V2TIMGroupApplicationType applicationType;
  514. /// 处理标志
  515. @property(nonatomic,assign,readonly) V2TIMGroupApplicationHandleStatus handleStatus;
  516. /// 处理结果
  517. @property(nonatomic,assign,readonly) V2TIMGroupApplicationHandleResult handleResult;
  518. @end
  519. /////////////////////////////////////////////////////////////////////////////////
  520. //
  521. // 邀请其他人入群的操作结果
  522. //
  523. /////////////////////////////////////////////////////////////////////////////////
  524. /// 邀请其他人入群的操作结果
  525. V2TIM_EXPORT @interface V2TIMGroupMemberOperationResult : NSObject
  526. /// 被操作成员
  527. @property(nonatomic,strong) NSString* userID;
  528. /// 返回状态
  529. @property(nonatomic,assign) V2TIMGroupMemberResult result;
  530. @end
  531. /////////////////////////////////////////////////////////////////////////////////
  532. //
  533. // 创建群时指定群成员
  534. //
  535. /////////////////////////////////////////////////////////////////////////////////
  536. /// 创建群时指定群成员
  537. V2TIM_EXPORT @interface V2TIMCreateGroupMemberInfo : NSObject
  538. /// 被操作成员
  539. @property(nonatomic,strong) NSString* userID;
  540. /** 群成员类型,需要注意一下事项:
  541. * 1. role 不设置或则设置为 V2TIM_GROUP_MEMBER_UNDEFINED,进群后默认为群成员。
  542. * 2. 工作群(Work)不支持设置 role 为管理员。
  543. * 3. 所有的群都不支持设置 role 为群主。
  544. */
  545. @property(nonatomic,assign) uint32_t role;
  546. @end
  547. /////////////////////////////////////////////////////////////////////////////////
  548. //
  549. // 加群申请列表(包含已处理和待处理的)
  550. //
  551. /////////////////////////////////////////////////////////////////////////////////
  552. /// 加群申请列表
  553. V2TIM_EXPORT @interface V2TIMGroupApplicationResult : NSObject
  554. /// 未读的申请数量
  555. @property(nonatomic,assign) uint64_t unreadCount;
  556. /// 加群申请的列表
  557. @property(nonatomic,strong) NSMutableArray<V2TIMGroupApplication *> * applicationList;
  558. @end
  559. /////////////////////////////////////////////////////////////////////////////////
  560. //
  561. // 群搜索
  562. //
  563. /////////////////////////////////////////////////////////////////////////////////
  564. V2TIM_EXPORT @interface V2TIMGroupSearchParam : NSObject
  565. /// 搜索关键字列表,最多支持5个。
  566. /// 如果是本地搜索,您需主动设置 keyword 是否匹配群 ID、群名称。
  567. /// 如果是云端搜索,keyword 会自动匹配群 ID、群名称。
  568. @property(nonatomic, strong) NSArray<NSString *> *keywordList;
  569. /// 设置是否搜索群 ID(仅本地搜索有效)
  570. @property(nonatomic, assign) BOOL isSearchGroupID;
  571. /// 设置是否搜索群名称(仅本地搜索有效)
  572. @property(nonatomic, assign) BOOL isSearchGroupName;
  573. /// 指定关键字列表匹配类型,可设置为“或”关系搜索或者“与”关系搜索(仅云端搜索有效)
  574. /// 取值分别为 V2TIM_KEYWORD_LIST_MATCH_TYPE_OR 和 V2TIM_KEYWORD_LIST_MATCH_TYPE_AND,默认为“或”关系搜索。
  575. @property(nonatomic,assign) V2TIMKeywordListMatchType keywordListMatchType;
  576. /// 设置每次云端搜索返回结果的条数(必须大于 0,最大支持 100,默认 20,仅云端搜索有效)
  577. @property(nonatomic,assign) NSUInteger searchCount;
  578. /// 设置每次云端搜索的起始位置。第一次填空字符串,续拉时填写 V2TIMGroupSearchResult 中的返回值(仅云端搜索有效)
  579. @property(nonatomic,strong) NSString *searchCursor;
  580. @end
  581. V2TIM_EXPORT @interface V2TIMGroupSearchResult : NSObject
  582. /// 满足搜索条件的群列表是否已经全部返回
  583. @property(nonatomic,assign) BOOL isFinished;
  584. /// 满足搜索条件的群总数量
  585. @property(nonatomic,assign) NSUInteger totalCount;
  586. /// 下一次云端搜索的起始位置
  587. @property(nonatomic,strong) NSString *nextCursor;
  588. /// 当前一次云端搜索返回的群列表
  589. @property(nonatomic,strong) NSArray<V2TIMGroupInfo *> *groupList;
  590. @end
  591. /////////////////////////////////////////////////////////////////////////////////
  592. //
  593. // 群成员搜索
  594. //
  595. /////////////////////////////////////////////////////////////////////////////////
  596. V2TIM_EXPORT @interface V2TIMGroupMemberSearchParam : NSObject
  597. /// 搜索关键字列表,最多支持 5 个
  598. /// 如果是本地搜索,您需主动设置 keyword 是否匹配群成员 ID、昵称、备注、群名片。
  599. /// 如果是云端搜索,keyword 会自动匹配群成员 ID、昵称、群名片。
  600. @property(nonatomic, strong) NSArray<NSString *> *keywordList;
  601. /// 指定群 ID 列表,若为 null 则搜索全部群中的群成员
  602. @property(nonatomic, strong) NSArray<NSString *> *groupIDList;
  603. /// 设置是否搜索群成员 userID(仅本地搜索有效)
  604. @property(nonatomic, assign) BOOL isSearchMemberUserID;
  605. /// 设置是否搜索群成员昵称(仅本地搜索有效)
  606. @property(nonatomic, assign) BOOL isSearchMemberNickName;
  607. /// 设置是否搜索群成员备注(仅本地搜索有效)
  608. @property(nonatomic, assign) BOOL isSearchMemberRemark;
  609. /// 设置是否搜索群成员名片(仅本地搜索有效)
  610. @property(nonatomic, assign) BOOL isSearchMemberNameCard;
  611. /// 指定关键字列表匹配类型,可设置为“或”关系搜索或者“与”关系搜索(仅云端搜索有效)
  612. /// 取值分别为 V2TIM_KEYWORD_LIST_MATCH_TYPE_OR 和 V2TIM_KEYWORD_LIST_MATCH_TYPE_AND,默认为“或”关系搜索。
  613. @property(nonatomic,assign) V2TIMKeywordListMatchType keywordListMatchType;
  614. /// 设置每次云端搜索返回结果的条数(必须大于 0,最大支持 100,默认 20,仅云端搜索有效)
  615. @property(nonatomic,assign) NSUInteger searchCount;
  616. /// 设置每次云端搜索的起始位置。第一次填空字符串,续拉时填写 V2TIMGroupMemberSearchResult 中的返回值(仅云端搜索有效)
  617. @property(nonatomic,strong) NSString *searchCursor;
  618. @end
  619. V2TIM_EXPORT @interface V2TIMGroupMemberSearchResult : NSObject
  620. /// 满足搜索条件的群成员列表是否已经全部返回
  621. @property(nonatomic,assign) BOOL isFinished;
  622. /// 满足搜索条件的群成员总数量
  623. @property(nonatomic,assign) NSUInteger totalCount;
  624. /// 下一次云端搜索的起始位置
  625. @property(nonatomic,strong) NSString *nextCursor;
  626. /// 当前一次云端搜索返回的群成员列表
  627. @property(nonatomic,strong) NSDictionary<NSString *, NSArray<V2TIMGroupMemberFullInfo *> *> *memberList;
  628. @end