V2TIMManager+Friendship.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. /////////////////////////////////////////////////////////////////////
  2. //
  3. // 腾讯云通信服务 IMSDK
  4. //
  5. // 模块名称:V2TIMManager+Friendship
  6. //
  7. // 关系链接口,里面包含了好友的添加、删除,黑名单的添加、删除等逻辑
  8. //
  9. /////////////////////////////////////////////////////////////////////
  10. #import "V2TIMManager.h"
  11. V2TIM_EXPORT @protocol V2TIMFriendshipListener;
  12. @class V2TIMFriendOperationResult;
  13. @class V2TIMFriendInfoResult;
  14. @class V2TIMFriendInfo;
  15. @class V2TIMFriendCheckResult;
  16. @class V2TIMFriendApplicationResult;
  17. @class V2TIMFriendAddApplication;
  18. @class V2TIMFriendApplication;
  19. @class V2TIMFriendGroup;
  20. @class V2TIMFriendSearchParam;
  21. @class V2TIMOfficialAccountInfo;
  22. @class V2TIMOfficialAccountInfoResult;
  23. @class V2TIMFollowOperationResult;
  24. @class V2TIMFollowInfo;
  25. @class V2TIMFollowTypeCheckResult;
  26. V2TIM_EXPORT @interface V2TIMManager (Friendship)
  27. /// 获取好友列表成功回调
  28. typedef void (^V2TIMFriendInfoListSucc)(NSArray<V2TIMFriendInfo *> *infoList);
  29. /// 获取指定好友信息成功回调
  30. typedef void (^V2TIMFriendInfoResultListSucc)(NSArray<V2TIMFriendInfoResult *> *resultList);
  31. /// 好友操作成功回调
  32. typedef void (^V2TIMFriendOperationResultSucc)(V2TIMFriendOperationResult *result);
  33. /// 好友列表操作成功回调
  34. typedef void (^V2TIMFriendOperationResultListSucc)(NSArray<V2TIMFriendOperationResult *> *resultList);
  35. /// 好友检查成功回调
  36. typedef void (^V2TIMFriendCheckResultListSucc)(NSArray<V2TIMFriendCheckResult *> *resultList);
  37. /// 获取群分组列表成功回调
  38. typedef void (^V2TIMFriendGroupListSucc)(NSArray<V2TIMFriendGroup *> *groups);
  39. /// 获取好友申请列表成功回调
  40. typedef void (^V2TIMFriendApplicationResultSucc)(V2TIMFriendApplicationResult *result);
  41. /// 获取公众号列表成功回调
  42. typedef void (^V2TIMOfficialAccountInfoResultListSucc)(NSArray<V2TIMOfficialAccountInfoResult *> *resultList);
  43. /// 关注/取关用户操作成功的回调
  44. typedef void (^V2TIMFollowOperationResultListSucc)(NSArray<V2TIMFollowOperationResult *> *resultList);
  45. /// 获取自己 关注/粉丝/互关 列表成功的回调
  46. typedef void (^V2TIMUserInfoResultSucc)(NSString *nextCursor, NSArray<V2TIMUserFullInfo *> *userInfoList);
  47. /// 获取用户关注数量信息成功的回调
  48. typedef void (^V2TIMFollowInfoResultListSucc)(NSArray<V2TIMFollowInfo *> *resultList);
  49. /// 用户关注类型检查成功回调
  50. typedef void (^V2TIMFollowTypeCheckResultListSucc)(NSArray<V2TIMFollowTypeCheckResult *> *resultList);
  51. /// 好友申请类型
  52. typedef NS_ENUM(NSInteger, V2TIMFriendApplicationType) {
  53. V2TIM_FRIEND_APPLICATION_COME_IN = 1, ///< 别人发给我的
  54. V2TIM_FRIEND_APPLICATION_SEND_OUT = 2, ///< 我发给别人的
  55. V2TIM_FRIEND_APPLICATION_BOTH = 3, ///< 别人发给我的 和 我发给别人的。仅拉取时有效
  56. };
  57. /// 好友类型
  58. typedef NS_ENUM(NSInteger, V2TIMFriendType) {
  59. V2TIM_FRIEND_TYPE_SINGLE = 1, ///< 单向好友
  60. V2TIM_FRIEND_TYPE_BOTH = 2, ///< 双向好友
  61. };
  62. /// 好友关系类型
  63. typedef NS_ENUM(NSInteger, V2TIMFriendRelationType) {
  64. V2TIM_FRIEND_RELATION_TYPE_NONE = 0x0, ///< 不是好友
  65. V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST = 0x1, ///< 对方在我的好友列表中
  66. V2TIM_FRIEND_RELATION_TYPE_IN_OTHER_FRIEND_LIST = 0x2, ///< 我在对方的好友列表中
  67. V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY = 0x3, ///< 互为好友
  68. };
  69. /// 好友申请接受类型
  70. typedef NS_ENUM(NSInteger, V2TIMFriendAcceptType) {
  71. V2TIM_FRIEND_ACCEPT_AGREE = 0, ///< 接受加好友(建立单向好友)
  72. V2TIM_FRIEND_ACCEPT_AGREE_AND_ADD = 1, ///< 接受加好友并加对方为好友(建立双向好友)
  73. };
  74. /// 关注类型
  75. typedef NS_ENUM(NSInteger, V2TIMFollowType) {
  76. V2TIM_FOLLOW_TYPE_NONE = 0x0, ///< 无任何关注关系
  77. V2TIM_FOLLOW_TYPE_IN_MY_FOLLOWING_LIST = 0x1, ///< 对方在我的关注列表中
  78. V2TIM_FOLLOW_TYPE_IN_MY_FOLLOWERS_LIST = 0x2, ///< 对方在我的粉丝列表中
  79. V2TIM_FOLLOW_TYPE_IN_BOTH_FOLLOWERS_LIST = 0x3, ///< 对方与我互相关注
  80. };
  81. /////////////////////////////////////////////////////////////////////////////////
  82. //
  83. // 关系链和用户资料监听器
  84. //
  85. /////////////////////////////////////////////////////////////////////////////////
  86. /**
  87. * 1.1 添加关系链监听器
  88. */
  89. - (void)addFriendListener:(id<V2TIMFriendshipListener>)listener NS_SWIFT_NAME(addFriendListener(listener:));
  90. /**
  91. * 1.2 移除关系链监听器
  92. */
  93. - (void)removeFriendListener:(id<V2TIMFriendshipListener>)listener NS_SWIFT_NAME(removeFriendListener(listener:));
  94. /**
  95. * 设置关系链监听器(待废弃接口,请使用 addFriendListener 和 removeFriendListener 接口)
  96. */
  97. - (void)setFriendListener:(id<V2TIMFriendshipListener>)listener __attribute__((deprecated("use addFriendListener: instead")));
  98. /////////////////////////////////////////////////////////////////////////////////
  99. //
  100. // 好友添加、删除、列表获取、资料设置相关接口
  101. //
  102. /////////////////////////////////////////////////////////////////////////////////
  103. /**
  104. * 2.1 获取好友列表
  105. */
  106. - (void)getFriendList:(V2TIMFriendInfoListSucc)succ fail:(V2TIMFail)fail;
  107. /**
  108. * 2.2 获取指定好友资料
  109. * @param userIDList 好友 userID 列表
  110. * - ID 建议一次最大 100 个,因为数量过多可能会导致数据包太大被后台拒绝,后台限制数据包最大为 1M。
  111. */
  112. - (void)getFriendsInfo:(NSArray<NSString *> *)userIDList succ:(V2TIMFriendInfoResultListSucc)succ fail:(V2TIMFail)fail;
  113. /**
  114. * 2.3 设置指定好友资料
  115. */
  116. - (void)setFriendInfo:(V2TIMFriendInfo *)info succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  117. /**
  118. * 2.4 搜索好友(5.4.666 及以上版本支持)
  119. * @note
  120. * - 该功能为 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)
  121. * - 该接口返回的是本地存储的用户资料,包含好友和非好友资料,您可以根据 V2TIMFriendInfoResult 中的 getRelation 来判断是否为好友。
  122. */
  123. - (void)searchFriends:(V2TIMFriendSearchParam *)searchParam succ:(V2TIMFriendInfoResultListSucc)succ fail:(V2TIMFail)fail;
  124. /**
  125. * 2.5 添加好友
  126. */
  127. - (void)addFriend:(V2TIMFriendAddApplication *)application succ:(V2TIMFriendOperationResultSucc)succ fail:(V2TIMFail)fail;
  128. /**
  129. * 2.6 删除好友
  130. * @param userIDList 要删除的好友 userID 列表
  131. * - ID 建议一次最大 100 个,因为数量过多可能会导致数据包太大被后台拒绝,后台限制数据包最大为 1M。
  132. * @param deleteType 删除类型(单向好友、双向好友)
  133. */
  134. - (void)deleteFromFriendList:(NSArray *)userIDList deleteType:(V2TIMFriendType)deleteType succ:(V2TIMFriendOperationResultListSucc)succ fail:(V2TIMFail)fail;
  135. /**
  136. * 2.7 检查指定用户的好友关系
  137. * @param userIDList 要检查的 userID 列表
  138. * @param checkType 检查类型 (单向好友检查、双向好友检查)
  139. * @param succ 成功后的回调
  140. * @param fail 失败后的回调
  141. *
  142. * @note checkType 的使用需要注意:
  143. * - checkType 如果传入 V2TIM_FRIEND_TYPE_SINGLE,结果返回:V2TIM_FRIEND_RELATION_TYPE_NONE、V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST 两种情况
  144. * - checkType 如果传入 V2TIM_FRIEND_TYPE_BOTH,结果返回:V2TIM_FRIEND_RELATION_TYPE_NONE、V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST、
  145. * V2TIM_FRIEND_RELATION_TYPE_IN_OTHER_FRIEND_LIST、V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY 四种情况
  146. */
  147. - (void)checkFriend:(NSArray<NSString *> *)userIDList checkType:(V2TIMFriendType)checkType succ:(V2TIMFriendCheckResultListSucc)succ fail:(V2TIMFail)fail;
  148. /////////////////////////////////////////////////////////////////////////////////
  149. //
  150. // 好友申请、删除相关逻辑
  151. //
  152. /////////////////////////////////////////////////////////////////////////////////
  153. /**
  154. * 3.1 获取好友申请列表
  155. *
  156. * @note
  157. * - 好友申请列表包括发起的好友申请和收到的好友申请。
  158. * - 最多支持100个。
  159. */
  160. - (void)getFriendApplicationList:(V2TIMFriendApplicationResultSucc)succ fail:(V2TIMFail)fail;
  161. /**
  162. * 3.2 同意好友申请
  163. *
  164. * @param application 好友申请信息,getFriendApplicationList 成功后会返回
  165. * @param acceptType 建立单向/双向好友关系
  166. */
  167. - (void)acceptFriendApplication:(V2TIMFriendApplication *)application type:(V2TIMFriendAcceptType)acceptType succ:(V2TIMFriendOperationResultSucc)succ fail:(V2TIMFail)fail;
  168. /**
  169. * 3.3 同意好友申请,并设置备注
  170. *
  171. * @param application 好友申请信息,getFriendApplicationList 成功后会返回
  172. * @param acceptType 建立单向/双向好友关系
  173. * - @ref V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE:同意添加单向好友
  174. * - @ref V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE_AND_ADD:同意并添加为双向好友
  175. * @param remark 好友备注
  176. */
  177. - (void)acceptFriendApplication:(V2TIMFriendApplication *)application type:(V2TIMFriendAcceptType)acceptType remark:(NSString*)remark succ:(V2TIMFriendOperationResultSucc)succ fail:(V2TIMFail)fail;
  178. /**
  179. * 3.4 拒绝好友申请
  180. *
  181. * @param application 好友申请信息,getFriendApplicationList 成功后会返回
  182. */
  183. - (void)refuseFriendApplication:(V2TIMFriendApplication *)application succ:(V2TIMFriendOperationResultSucc)succ fail:(V2TIMFail)fail;
  184. /**
  185. * 3.5 删除好友申请
  186. *
  187. * @param application 好友申请信息,getFriendApplicationList 成功后会返回
  188. */
  189. - (void)deleteFriendApplication:(V2TIMFriendApplication *)application succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  190. /**
  191. * 3.6 设置好友申请已读
  192. */
  193. - (void)setFriendApplicationRead:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  194. /////////////////////////////////////////////////////////////////////////////////
  195. //
  196. // 黑名单
  197. //
  198. /////////////////////////////////////////////////////////////////////////////////
  199. /**
  200. * 4.1 添加用户到黑名单
  201. */
  202. - (void)addToBlackList:(NSArray *)userIDList succ:(V2TIMFriendOperationResultListSucc)succ fail:(V2TIMFail)fail;
  203. /**
  204. * 4.2 把用户从黑名单中删除
  205. */
  206. - (void)deleteFromBlackList:(NSArray *)userIDList succ:(V2TIMFriendOperationResultListSucc)succ fail:(V2TIMFail)fail;
  207. /**
  208. * 4.3 获取黑名单列表
  209. */
  210. - (void)getBlackList:(V2TIMFriendInfoListSucc)succ fail:(V2TIMFail)fail;
  211. /////////////////////////////////////////////////////////////////////////////////
  212. //
  213. // 好友分组
  214. //
  215. /////////////////////////////////////////////////////////////////////////////////
  216. /**
  217. * 5.1 新建好友分组
  218. *
  219. * @param groupName 分组名称
  220. * @param userIDList 要添加到分组中的好友
  221. */
  222. - (void)createFriendGroup:(NSString *)groupName userIDList:(NSArray *)userIDList succ:(V2TIMFriendOperationResultListSucc)succ fail:(V2TIMFail)fail;
  223. /**
  224. * 5.2 获取分组信息
  225. *
  226. * @param groupNameList 要获取信息的好友分组名称列表,传入 nil 获得所有分组信息
  227. */
  228. - (void)getFriendGroupList:(NSArray *)groupNameList succ:(V2TIMFriendGroupListSucc)succ fail:(V2TIMFail)fail;
  229. /**
  230. * 5.3 删除好友分组
  231. */
  232. - (void)deleteFriendGroup:(NSArray *)groupNameList succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  233. /**
  234. * 5.4 修改好友分组的名称
  235. */
  236. - (void)renameFriendGroup:(NSString*)oldName newName:(NSString*)newName succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  237. /**
  238. * 5.5 添加好友到一个好友分组
  239. */
  240. - (void)addFriendsToFriendGroup:(NSString *)groupName userIDList:(NSArray *)userIDList succ:(V2TIMFriendOperationResultListSucc)succ fail:(V2TIMFail)fail;
  241. /**
  242. * 5.6 从好友分组中删除好友
  243. */
  244. - (void)deleteFriendsFromFriendGroup:(NSString *)groupName userIDList:(NSArray *)userIDList succ:(V2TIMFriendOperationResultListSucc)succ fail:(V2TIMFail)fail;
  245. /////////////////////////////////////////////////////////////////////////////////
  246. //
  247. // 公众号订阅、取消订阅、获取公众号列表接口
  248. //
  249. /////////////////////////////////////////////////////////////////////////////////
  250. /**
  251. * 6.1 订阅公众号(7.6 及其以上版本支持)
  252. */
  253. - (void)subscribeOfficialAccount:(NSString *)officialAccountID succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  254. /**
  255. * 6.2 取消订阅公众号(7.6 及其以上版本支持)
  256. */
  257. - (void)unsubscribeOfficialAccount:(NSString *)officialAccountID succ:(V2TIMSucc)succ fail:(V2TIMFail)fail;
  258. /**
  259. * 6.3 获取公众号列表(7.6 及其以上版本支持)
  260. * @note officialAccountIDList 传空时,获取订阅的公众号列表
  261. */
  262. - (void)getOfficialAccountsInfo:(NSArray<NSString *> *)officialAccountIDList succ:(V2TIMOfficialAccountInfoResultListSucc)succ fail:(V2TIMFail)fail;
  263. /////////////////////////////////////////////////////////////////////////////////
  264. //
  265. // 关注/粉丝 相关接口
  266. //
  267. /////////////////////////////////////////////////////////////////////////////////
  268. /**
  269. * 7.1 关注用户(从 7.8 版本开始支持)
  270. *
  271. * @note
  272. * - 一次最多支持关注 20 个用户。
  273. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  274. */
  275. - (void)followUser:(NSArray<NSString *> *)userIDList succ:(V2TIMFollowOperationResultListSucc)succ fail:(V2TIMFail)fail;
  276. /**
  277. * 7.2 取消关注用户(从 7.8 版本开始支持)
  278. *
  279. * @note
  280. * - 一次最多支持取消关注 20 个用户。
  281. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  282. */
  283. - (void)unfollowUser:(NSArray<NSString *> *)userIDList succ:(V2TIMFollowOperationResultListSucc)succ fail:(V2TIMFail)fail;
  284. /**
  285. * 7.3 获取我的关注列表(从 7.8 版本开始支持)
  286. *
  287. * @note
  288. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  289. *
  290. * @param nextCursor 分页拉取标志,第一次拉取填 nil 或 @"",回调成功如果 nextCursor 不为 @"",需要分页,可以传入该值再次拉取,直至 nextCursor 返回为 @""
  291. *
  292. * @note
  293. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  294. */
  295. - (void)getMyFollowingList:(NSString *)nextCursor succ:(V2TIMUserInfoResultSucc)succ fail:(V2TIMFail)fail;
  296. /**
  297. * 7.4 获取我的粉丝列表(从 7.8 版本开始支持)
  298. *
  299. * @param nextCursor 分页拉取标志,第一次拉取填 nil 或 @"",回调成功如果 nextCursor 不为 @"",需要分页,可以传入该值再次拉取,直至 nextCursor 返回为 @""
  300. *
  301. * @note
  302. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  303. */
  304. - (void)getMyFollowersList:(NSString *)nextCursor succ:(V2TIMUserInfoResultSucc)succ fail:(V2TIMFail)fail;
  305. /**
  306. * 7.5 获取我的互关列表(从 7.8 版本开始支持)
  307. *
  308. * @param nextCursor 分页拉取标志,第一次拉取填 nil 或 @"",回调成功如果 nextCursor 不为 @"",需要分页,可以传入该值再次拉取,直至 nextCursor 返回为 @""
  309. *
  310. * @note
  311. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  312. */
  313. - (void)getMutualFollowersList:(NSString *)nextCursor succ:(V2TIMUserInfoResultSucc)succ fail:(V2TIMFail)fail;
  314. /**
  315. * 7.6 获取指定用户的 关注/粉丝/互关 数量信息(从 7.8 版本开始支持)
  316. *
  317. * @note
  318. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  319. */
  320. - (void)getUserFollowInfo:(NSArray *)userIDList succ:(V2TIMFollowInfoResultListSucc)succ fail:(V2TIMFail)fail;
  321. /**
  322. * 7.7 检查指定用户的关注类型(从 7.8 版本开始支持)
  323. *
  324. * @note
  325. * - 该功能为 IM 旗舰版功能,[购买旗舰版套餐包](https://buy.cloud.tencent.com/avc?from=17491)后可使用,详见[价格说明](https://cloud.tencent.com/document/product/269/11673?from=17472#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1.E8.AF.A6.E6.83.85)。
  326. */
  327. - (void)checkFollowType:(NSArray<NSString *> *)userIDList succ:(V2TIMFollowTypeCheckResultListSucc)succ fail:(V2TIMFail)fail;
  328. @end
  329. /////////////////////////////////////////////////////////////////////////////////
  330. //
  331. // 资料关系链回调
  332. //
  333. /////////////////////////////////////////////////////////////////////////////////
  334. /// 资料关系链回调
  335. V2TIM_EXPORT @protocol V2TIMFriendshipListener <NSObject>
  336. @optional
  337. /**
  338. * 好友申请新增通知,两种情况会收到这个回调:
  339. * 1. 自己申请加别人好友
  340. * 2. 别人申请加自己好友
  341. */
  342. - (void)onFriendApplicationListAdded:(NSArray<V2TIMFriendApplication *> *)applicationList;
  343. /**
  344. * 好友申请删除通知,四种情况会收到这个回调:
  345. * 1. 调用 deleteFriendApplication 主动删除好友申请
  346. * 2. 调用 refuseFriendApplication 拒绝好友申请
  347. * 3. 调用 acceptFriendApplication 同意好友申请
  348. * 4. 申请加别人好友被拒绝
  349. */
  350. - (void)onFriendApplicationListDeleted:(NSArray *)userIDList;
  351. /**
  352. * 好友申请已读通知,如果调用 setFriendApplicationRead 设置好友申请列表已读,会收到这个回调(主要用于多端同步)
  353. */
  354. - (void)onFriendApplicationListRead;
  355. /**
  356. * 好友新增通知
  357. */
  358. - (void)onFriendListAdded:(NSArray<V2TIMFriendInfo *>*)infoList;
  359. /**
  360. * 好友删除通知,两种情况会收到这个回调:
  361. * 1. 自己删除好友(单向和双向删除都会收到回调)
  362. * 2. 好友把自己删除(双向删除会收到)
  363. */
  364. - (void)onFriendListDeleted:(NSArray*)userIDList;
  365. /**
  366. * 黑名单新增通知
  367. */
  368. - (void)onBlackListAdded:(NSArray<V2TIMFriendInfo *>*)infoList;
  369. /**
  370. * 黑名单删除通知
  371. */
  372. - (void)onBlackListDeleted:(NSArray*)userIDList;
  373. /**
  374. * 好友资料变更通知
  375. */
  376. - (void)onFriendProfileChanged:(NSArray<V2TIMFriendInfo *> *)infoList;
  377. /**
  378. * 好友分组被创建
  379. */
  380. - (void)onFriendGroupCreated:(NSString *)groupName friendInfoList:(NSArray<V2TIMFriendInfo *> *)friendInfoList;
  381. /**
  382. * 好友分组被删除
  383. */
  384. - (void)onFriendGroupDeleted:(NSArray<NSString *> *)groupNameList;
  385. /**
  386. * 好友分组名变更
  387. */
  388. - (void)onFriendGroupNameChanged:(NSString *)oldGroupName newGroupName:(NSString *)newGroupName;
  389. /**
  390. * 好友分组新增好友
  391. */
  392. - (void)onFriendsAddedToGroup:(NSString *)groupName friendInfoList:(NSArray<V2TIMFriendInfo *> *)friendInfoList NS_SWIFT_NAME(onFriendsAddedToGroup(groupName:friendInfoList:));
  393. /**
  394. * 好友分组删除好友
  395. */
  396. - (void)onFriendsDeletedFromGroup:(NSString *)groupName friendIDList:(NSArray<NSString *> *)friendIDList NS_SWIFT_NAME(onFriendsDeletedFromGroup(groupName:friendIDList:));
  397. /**
  398. * 订阅公众号通知
  399. */
  400. - (void)onOfficialAccountSubscribed:(V2TIMOfficialAccountInfo *)officialAccountInfo;
  401. /**
  402. * 取消订阅公众号通知
  403. */
  404. - (void)onOfficialAccountUnsubscribed:(NSString *)officialAccountID;
  405. /**
  406. * 订阅的公众号被删除通知
  407. */
  408. - (void)onOfficialAccountDeleted:(NSString *)officialAccountID;
  409. /**
  410. * 订阅的公众号资料更新通知
  411. */
  412. - (void)onOfficialAccountInfoChanged:(V2TIMOfficialAccountInfo *)officialAccountInfo;
  413. /**
  414. * 关注列表变更通知
  415. */
  416. - (void)onMyFollowingListChanged:(NSArray<V2TIMUserFullInfo *> *)userInfoList isAdd:(BOOL)isAdd NS_SWIFT_NAME(onMyFollowingListChanged(userInfoList:isAdd:));
  417. /**
  418. * 粉丝列表变更通知
  419. */
  420. - (void)onMyFollowersListChanged:(NSArray<V2TIMUserFullInfo *> *)userInfoList isAdd:(BOOL)isAdd;
  421. /**
  422. * 互关列表变更通知
  423. */
  424. - (void)onMutualFollowersListChanged:(NSArray<V2TIMUserFullInfo *> *)userInfoList isAdd:(BOOL)isAdd;
  425. @end
  426. /////////////////////////////////////////////////////////////////////////////////
  427. //
  428. // 好友资料获取结果
  429. //
  430. /////////////////////////////////////////////////////////////////////////////////
  431. /// 好友资料获取结果
  432. V2TIM_EXPORT @interface V2TIMFriendInfoResult : NSObject
  433. /// 返回码
  434. @property(nonatomic,assign) int resultCode;
  435. /// 返结果表述
  436. @property(nonatomic,strong) NSString *resultInfo;
  437. /// 好友类型
  438. @property(nonatomic,assign) V2TIMFriendRelationType relation;
  439. /// 好友个人资料,如果不是好友,除了 userID 字段,其他字段都为空
  440. @property(nonatomic,strong) V2TIMFriendInfo *friendInfo;
  441. @end
  442. /////////////////////////////////////////////////////////////////////////////////
  443. //
  444. // 好友资料
  445. //
  446. /////////////////////////////////////////////////////////////////////////////////
  447. /// 好友资料
  448. V2TIM_EXPORT @interface V2TIMFriendInfo : NSObject
  449. /// 好友 ID
  450. @property(nonatomic,strong) NSString *userID;
  451. /**
  452. * 好友备注
  453. *
  454. * @note
  455. * - 备注长度最长不得超过 96 个字节;
  456. * - 字段描述详见 [控制台](https://cloud.tencent.com/document/product/269/1501#.E6.A0.87.E9.85.8D.E5.A5.BD.E5.8F.8B.E5.AD.97.E6.AE.B5)。
  457. */
  458. @property(nonatomic,strong) NSString *friendRemark;
  459. /// 添加好友的 UTC 时间戳
  460. @property(nonatomic,assign,readonly) uint64_t friendAddTime;
  461. /// 好友自定义字段
  462. /// 首先要在 [控制台](https://console.cloud.tencent.com/im) (功能配置 -> 好友自定义字段) 配置好友自定义字段,然后再调用该接口进行设置,key 值不需要加 Tag_SNS_Custom_ 前缀。
  463. @property(nonatomic,strong) NSDictionary<NSString *,NSData *> *friendCustomInfo;
  464. /**
  465. * 好友所在分组列表
  466. *
  467. * @note
  468. * - 最多支持 32 个分组;
  469. * - 不允许分组名为空;
  470. * - 分组名长度不得超过 30 个字节;
  471. * - 同一个好友可以有多个不同的分组。
  472. * - 字段描述详见 [控制台](https://cloud.tencent.com/document/product/269/1501#.E6.A0.87.E9.85.8D.E5.A5.BD.E5.8F.8B.E5.AD.97.E6.AE.B5)。
  473. */
  474. @property(nonatomic,strong,readonly) NSArray *friendGroups;
  475. /// 好友个人资料
  476. @property(nonatomic,strong,readonly) V2TIMUserFullInfo *userFullInfo;
  477. @end
  478. /////////////////////////////////////////////////////////////////////////////////
  479. //
  480. // 好友申请相关对象
  481. //
  482. /////////////////////////////////////////////////////////////////////////////////
  483. /// 加好友
  484. V2TIM_EXPORT @interface V2TIMFriendAddApplication : NSObject
  485. /// 用户 userID(必填)
  486. @property (nonatomic,strong) NSString* userID;
  487. /// 备注(备注最大96字节)
  488. @property (nonatomic,strong) NSString* friendRemark;
  489. /// 预分组名(最大96字节)
  490. @property (nonatomic,strong) NSString* friendGroup;
  491. /// 请求说明(最大120字节)
  492. @property (nonatomic,strong) NSString* addWording;
  493. /// 添加来源
  494. @property (nonatomic,strong) NSString* addSource;
  495. /// 加好友方式
  496. @property (nonatomic,assign) V2TIMFriendType addType;
  497. @end
  498. /// 好友申请列表
  499. V2TIM_EXPORT @interface V2TIMFriendApplicationResult : NSObject
  500. /// 好友申请未读数量
  501. @property(nonatomic,assign) uint64_t unreadCount;
  502. /// 好友申请列表
  503. @property(nonatomic,strong) NSMutableArray<V2TIMFriendApplication *> * applicationList;
  504. @end
  505. /// 好友申请
  506. V2TIM_EXPORT @interface V2TIMFriendApplication : NSObject
  507. /// 用户标识
  508. @property(nonatomic,strong,readonly) NSString* userID;
  509. /// 用户昵称
  510. @property(nonatomic,strong,readonly) NSString* nickName;
  511. /// 用户头像
  512. @property(nonatomic,strong,readonly) NSString* faceUrl;
  513. /// 添加好友的 UTC 时间戳
  514. @property(nonatomic,assign,readonly) uint64_t addTime;
  515. /// 来源
  516. @property(nonatomic,strong,readonly) NSString* addSource;
  517. /// 加好友附言
  518. @property(nonatomic,strong,readonly) NSString* addWording;
  519. /// 好友申请类型
  520. @property(nonatomic,assign,readonly) V2TIMFriendApplicationType type;
  521. @end
  522. /////////////////////////////////////////////////////////////////////////////////
  523. //
  524. // 好友关系链检查结果
  525. //
  526. /////////////////////////////////////////////////////////////////////////////////
  527. /// 好友关系链检查结果
  528. V2TIM_EXPORT @interface V2TIMFriendCheckResult : NSObject
  529. /// 用户id
  530. @property(nonatomic,strong) NSString* userID;
  531. /// 返回码
  532. @property(nonatomic,assign) NSInteger resultCode;
  533. /// 返回信息
  534. @property(nonatomic,strong) NSString *resultInfo;
  535. /// 检查结果
  536. @property(nonatomic,assign) V2TIMFriendRelationType relationType;
  537. @end
  538. /////////////////////////////////////////////////////////////////////////////////
  539. //
  540. // 好友操作结果(添加、删除、加黑名单、添加分组等)
  541. //
  542. /////////////////////////////////////////////////////////////////////////////////
  543. /// 好友操作结果(添加、删除、加黑名单、添加分组等)
  544. V2TIM_EXPORT @interface V2TIMFriendOperationResult : NSObject
  545. /// 用户Id
  546. @property(nonatomic,strong) NSString* userID;
  547. /// 返回码
  548. @property(nonatomic,assign) NSInteger resultCode;
  549. /// 返回信息
  550. @property(nonatomic,strong) NSString *resultInfo;
  551. @end
  552. /////////////////////////////////////////////////////////////////////////////////
  553. //
  554. // 好友分组
  555. //
  556. /////////////////////////////////////////////////////////////////////////////////
  557. /// 好友分组
  558. V2TIM_EXPORT @interface V2TIMFriendGroup : NSObject
  559. /// 好友分组名称
  560. @property(nonatomic,strong) NSString* groupName;
  561. /// 分组成员数量
  562. @property(nonatomic,assign) uint64_t userCount;
  563. /// 分组成员列表
  564. @property(nonatomic,strong) NSMutableArray* friendList;
  565. @end
  566. /////////////////////////////////////////////////////////////////////////////////
  567. //
  568. // 好友搜索
  569. //
  570. /////////////////////////////////////////////////////////////////////////////////
  571. V2TIM_EXPORT @interface V2TIMFriendSearchParam : NSObject
  572. /// 搜索的关键字列表,关键字列表最多支持 5 个
  573. @property(nonatomic, strong) NSArray<NSString *> *keywordList;
  574. /// 设置是否搜索 userID
  575. @property(nonatomic, assign) BOOL isSearchUserID;
  576. /// 是否设置搜索昵称
  577. @property(nonatomic, assign) BOOL isSearchNickName;
  578. /// 是否设置搜索备注
  579. @property(nonatomic, assign) BOOL isSearchRemark;;
  580. @end
  581. /////////////////////////////////////////////////////////////////////////////////
  582. //
  583. // 公众号资料
  584. //
  585. /////////////////////////////////////////////////////////////////////////////////
  586. V2TIM_EXPORT @interface V2TIMOfficialAccountInfo : NSObject
  587. /// 公众号 ID
  588. @property(nonatomic,strong,readonly) NSString* officialAccountID;
  589. /// 公众号名称
  590. @property(nonatomic,strong,readonly) NSString* officialAccountName;
  591. /// 公众号头像
  592. @property(nonatomic,strong,readonly) NSString* faceUrl;
  593. /// 公众号所有者
  594. @property(nonatomic,strong,readonly) NSString* ownerUserID;
  595. /// 公众号组织
  596. @property(nonatomic,strong,readonly) NSString* organization;
  597. /// 公众号简介
  598. @property(nonatomic,strong,readonly) NSString* introduction;
  599. /// 公众号自定义数据
  600. @property(nonatomic,strong,readonly) NSString* customData;
  601. /// 公众号创建时间,单位:秒
  602. @property(nonatomic,assign,readonly) uint64_t createTime;
  603. /// 公众号订阅者数量
  604. @property(nonatomic,assign,readonly) uint64_t subscriberCount;
  605. /// 订阅公众号的时间,单位:秒
  606. @property(nonatomic,assign,readonly) uint64_t subscribeTime;
  607. @end
  608. /////////////////////////////////////////////////////////////////////////////////
  609. //
  610. // 公众号资料获取结果
  611. //
  612. /////////////////////////////////////////////////////////////////////////////////
  613. /// 公众号资料获取结果
  614. V2TIM_EXPORT @interface V2TIMOfficialAccountInfoResult : NSObject
  615. /// 返回码
  616. @property(nonatomic,assign) int resultCode;
  617. /// 返回结果表述
  618. @property(nonatomic,strong) NSString *resultInfo;
  619. /// 公众号资料
  620. @property(nonatomic,strong) V2TIMOfficialAccountInfo *officialAccountInfo;
  621. @end
  622. /////////////////////////////////////////////////////////////////////////////////
  623. //
  624. // 关注/取关用户的操作结果
  625. //
  626. /////////////////////////////////////////////////////////////////////////////////
  627. /// 关注/取关用户的操作结果
  628. V2TIM_EXPORT @interface V2TIMFollowOperationResult : NSObject
  629. /// 用户 ID
  630. @property(nonatomic,strong) NSString* userID;
  631. /// 返回码
  632. @property(nonatomic,assign) NSInteger resultCode;
  633. /// 返回信息
  634. @property(nonatomic,strong) NSString *resultInfo;
  635. @end
  636. /////////////////////////////////////////////////////////////////////////////////
  637. //
  638. // 用户关注数量信息获取结果
  639. //
  640. /////////////////////////////////////////////////////////////////////////////////
  641. /// 用户关注数量信息获取结果
  642. V2TIM_EXPORT @interface V2TIMFollowInfo : NSObject
  643. /// 返回码
  644. @property(nonatomic,assign) NSInteger resultCode;
  645. /// 返回结果表述
  646. @property(nonatomic,strong) NSString *resultInfo;
  647. /// 用户 ID
  648. @property(nonatomic,strong) NSString *userID;
  649. /// 用户的关注数量
  650. @property(nonatomic,assign) uint64_t followingCount;
  651. /// 用户的粉丝数量
  652. @property(nonatomic,assign) uint64_t followersCount;
  653. /// 用户的互关数量
  654. @property(nonatomic,assign) uint64_t mutualFollowersCount;
  655. @end
  656. /////////////////////////////////////////////////////////////////////////////////
  657. //
  658. // 指定用户的关注类型检查结果
  659. //
  660. /////////////////////////////////////////////////////////////////////////////////
  661. /// 指定用户的关注类型检查结果
  662. V2TIM_EXPORT @interface V2TIMFollowTypeCheckResult : NSObject
  663. /// 用户 ID
  664. @property(nonatomic,strong) NSString* userID;
  665. /// 返回码
  666. @property(nonatomic,assign) NSInteger resultCode;
  667. /// 返回信息
  668. @property(nonatomic,strong) NSString *resultInfo;
  669. /// 关注类型
  670. @property(nonatomic,assign) V2TIMFollowType followType;
  671. @end