EMChatroom.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. /**
  2. * \~chinese
  3. * @header EMChatroom.h
  4. * @abstract 聊天室
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMChatroom.h
  10. * @abstract Chatroom
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMCommonDefs.h"
  16. /**
  17. * \~chinese
  18. * 聊天室成员类型枚举。
  19. *
  20. * \~english
  21. * The enum of chat room permission types.
  22. */
  23. typedef NS_ENUM(NSInteger, EMChatroomPermissionType) {
  24. EMChatroomPermissionTypeNone = -1, /** \~chinese 未知类型 \~english Unknown type*/
  25. EMChatroomPermissionTypeMember = 0, /** \~chinese 普通成员类型 \~english Normal member type*/
  26. EMChatroomPermissionTypeAdmin, /** \~chinese 聊天室管理员类型 \~english Chatroom admin type*/
  27. EMChatroomPermissionTypeOwner, /** \~chinese 聊天室拥有者类型 \~english Chatroom owner type*/
  28. };
  29. /**
  30. * \~chinese
  31. * 聊天室实例,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  32. *
  33. * \~english
  34. * The chat room object.
  35. */
  36. @interface EMChatroom : NSObject
  37. /**
  38. * \~chinese
  39. * 聊天室 ID,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  40. *
  41. * \~english
  42. * The chat room ID.
  43. */
  44. @property (nonatomic, copy, readonly) NSString * _Nullable chatroomId;
  45. /**
  46. * \~chinese
  47. * 聊天室的主题,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  48. *
  49. * \~english
  50. * The subject of the chat room.
  51. */
  52. @property (nonatomic, copy, readonly) NSString * _Nullable subject;
  53. /**
  54. * \~chinese
  55. * 聊天室的描述,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  56. *
  57. * \~english
  58. * The description of chat room.
  59. */
  60. @property (nonatomic, copy, readonly) NSString * _Nullable description;
  61. /**
  62. * \~chinese
  63. * 聊天室的所有者,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  64. *
  65. * 聊天室的所有者只有一人。
  66. *
  67. * \~english
  68. * The owner of the chat room. There is only one owner per chat room.
  69. */
  70. @property (nonatomic, copy, readonly) NSString * _Nullable owner;
  71. /**
  72. * \~chinese
  73. * 聊天室的公告,需要先调用 getChatroomAnnouncementWithId 方法获取该聊天室详情。
  74. *
  75. * \~english
  76. * The announcement of the chat room.
  77. */
  78. @property (nonatomic, copy, readonly) NSString * _Nullable announcement;
  79. /**
  80. * \~chinese
  81. * 聊天室的管理者,拥有聊天室的最高权限,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  82. *
  83. *
  84. * \~english
  85. * The admins of the chatroom.
  86. *
  87. */
  88. @property (nonatomic, copy, readonly) NSArray<NSString *> * _Nullable adminList;
  89. /**
  90. * \~chinese
  91. * 聊天室的成员列表,通过分页获取聊天室成员列表接口加载。
  92. *
  93. * \~english
  94. * The list of members in the chat room.
  95. */
  96. @property (nonatomic, copy, readonly) NSArray<NSString *> * _Nullable memberList;
  97. /**
  98. * \~chinese
  99. * 聊天室的黑名单,需要先调用获取聊天室黑名单方法。
  100. *
  101. * 只有聊天室所有者有权限调用该方法,非聊天室所有者返回 nil。
  102. *
  103. * \~english
  104. * The blocklist of the chatroom.
  105. *
  106. * Only the chatroom owner can call the method. Returns nil if the user is not the chatroom owner.
  107. */
  108. @property (nonatomic, strong, readonly) NSArray<NSString *> * _Nullable blacklist;
  109. /**
  110. * \~chinese
  111. * 聊天室的被禁言列表。
  112. *
  113. * 只有聊天室所有者有权限调用该方法,非聊天室所有者返回 nil。
  114. *
  115. * \~english
  116. * The list of muted members.
  117. *
  118. * Only the chatroom owner can call the method. Returns nil if the user is not the chatroom owner.
  119. */
  120. @property (nonatomic, strong, readonly) NSArray<NSString *> * _Nullable muteList;
  121. /**
  122. * \~chinese
  123. * 聊天室的白名单列表。
  124. *
  125. * 只有聊天室所有者有权限调用该方法,非聊天室所有者返回 nil。
  126. *
  127. * \~english
  128. * The allowlist members <NSString>
  129. *
  130. * Only the chatroom owner can call the method. Returns nil if the user is not the chatroom owner.
  131. */
  132. @property (nonatomic, strong, readonly) NSArray<NSString *> * _Nullable whitelist;
  133. /**
  134. * \~chinese
  135. * 当前登录账号的聊天室成员类型。
  136. *
  137. * \~english
  138. * The chatroom membership type of the current login account.
  139. */
  140. @property (nonatomic, readonly) EMChatroomPermissionType permissionType;
  141. /**
  142. * \~chinese
  143. * 聊天室的最大人数,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。如果没有获取聊天室详情将返回 0。
  144. *
  145. * \~english
  146. * The maximum member number of the chat room.
  147. */
  148. @property (nonatomic, readonly) NSInteger maxOccupantsCount;
  149. /**
  150. * \~chinese
  151. * 聊天室的当前人数,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。如果没有获取聊天室详情将返回 0。
  152. *
  153. * \~english
  154. * The current number of members in the chat room.
  155. */
  156. @property (nonatomic, readonly) NSInteger occupantsCount;
  157. /**
  158. * \~chinese
  159. * 聊天室成员是否全部被禁言。
  160. *
  161. * \~english
  162. * Whether all members of the chat room are muted.
  163. */
  164. @property (nonatomic, readonly) BOOL isMuteAllMembers;
  165. /**
  166. * \~chinese
  167. * 获取聊天室实例。
  168. *
  169. * @param aChatroomId 聊天室 ID
  170. *
  171. * @result 聊天室实例
  172. *
  173. * \~english
  174. * Constructs a chatroom instance with chatroom ID.
  175. *
  176. * @param aChatroomId The chatroom ID.
  177. *
  178. * @result The chatroom instance.
  179. */
  180. + (instancetype _Nullable)chatroomWithId:(NSString * _Nonnull )aChatroomId;
  181. #pragma mark - EM_DEPRECATED_IOS 3.8.8
  182. /**
  183. * \~chinese
  184. * 聊天室的白名单列表。
  185. *
  186. * 需要owner权限才能查看,非owner返回nil
  187. *
  188. * \~english
  189. * List of whitelist members<NSString>
  190. *
  191. * Need owner's authority to access, return nil if user is not the chatroom owner.
  192. */
  193. @property (nonatomic, strong, readonly) NSArray *whiteList __deprecated_msg("Use whitelist instead");
  194. #pragma mark - EM_DEPRECATED_IOS 3.3.0
  195. /**
  196. * \~chinese
  197. * 该方法已废弃,用 {@link -memberList} 代替。聊天室的成员列表,需要先调用 getChatroomSpecificationFromServerWithId 方法获取该聊天室详情。
  198. *
  199. * \~english
  200. * Deprecated, please use -memberList instead. The list of members in the chat room.
  201. */
  202. @property (nonatomic, copy, readonly) NSArray *members EM_DEPRECATED_IOS(3_1_0, 3_3_0, "Use -memberList instead");
  203. /**
  204. * \~chinese
  205. * 该方法已废弃,用 {@link -occupantsCount} 代替。聊天室的当前人数,如果没有获取聊天室详情将返回 0。
  206. *
  207. * \~english
  208. * Deprecated, please use -occupantsCount instead. The total number of members in the chat room.
  209. */
  210. @property (nonatomic, readonly) NSInteger membersCount EM_DEPRECATED_IOS(3_1_0, 3_3_0, "Use -occupantsCount instead");
  211. /**
  212. * \~chinese
  213. * 该方法已废弃,用 {@link -maxOccupantsCount} 代替。聊天室的最大人数,如果没有获取聊天室详情将返回 0。
  214. *
  215. * \~english
  216. * Deprecated, please use -maxOccupantsCount instead.The maximum member number of the chat room.
  217. */
  218. @property (nonatomic, readonly) NSInteger maxMembersCount EM_DEPRECATED_IOS(3_1_0, 3_3_0, "Use -maxOccupantsCount instead");
  219. #pragma mark - EM_DEPRECATED_IOS < 3.2.3
  220. /**
  221. * \~chinese
  222. * 该方法已废弃,请用 {@link -members} 代替。聊天室的成员列表。
  223. *
  224. * \~english
  225. * Deprecated, please use - members instead. The list of members in the chat room.
  226. */
  227. @property (nonatomic, copy, readonly) NSArray *occupants __deprecated_msg("Use -members instead");
  228. /**
  229. * \~chinese
  230. * 该方法已废弃,请使用 {@link +chatroomWithId:} 方法代替。初始化聊天室实例。
  231. *
  232. *
  233. *
  234. * @result nil
  235. *
  236. * \~english
  237. * Deprecated, please use {@link +chatroomWithId:} instead.Initializes chatroom instance.
  238. *
  239. *
  240. *
  241. * @result nil
  242. */
  243. - (instancetype)init __deprecated_msg("Use +chatroomWithId: instead");
  244. @end