HyphenateChatSDK  4.6.0
IEMChatroomManager.h
1 
15 #import <Foundation/Foundation.h>
16 
17 #import "EMCommonDefs.h"
18 #import "EMChatroomManagerDelegate.h"
19 #import "EMChatroomOptions.h"
20 #import "EMChatroom.h"
21 #import "EMPageResult.h"
22 
23 #import "EMCursorResult.h"
24 
25 @class EMError;
26 
34 @protocol IEMChatroomManager <NSObject>
35 
36 @required
37 
38 #pragma mark - Delegate
39 
53 - (void)addDelegate:(id<EMChatroomManagerDelegate> _Nonnull)aDelegate
54  delegateQueue:(dispatch_queue_t _Nullable)aQueue;
55 
67 - (void)removeDelegate:(id<EMChatroomManagerDelegate> _Nonnull)aDelegate;
68 
69 #pragma mark - Fetch Chatrooms
70 
94 - (EMPageResult<EMChatroom*> *_Nullable)getChatroomsFromServerWithPage:(NSInteger)aPageNum
95  pageSize:(NSInteger)aPageSize
96  error:(EMError **_Nullable)pError;
97 
119 - (void)getChatroomsFromServerWithPage:(NSInteger)aPageNum
120  pageSize:(NSInteger)aPageSize
121  completion:(void (^_Nullable)(EMPageResult<EMChatroom*> *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
122 
123 #pragma mark - Create
124 
154 - (EMChatroom *_Nullable)createChatroomWithSubject:(NSString *_Nullable)aSubject
155  description:(NSString *_Nullable)aDescription
156  invitees:(NSArray<NSString *> *_Nullable)aInvitees
157  message:(NSString *_Nullable)aMessage
158  maxMembersCount:(NSInteger)aMaxMembersCount
159  error:(EMError **_Nullable)pError;
160 
188 - (void)createChatroomWithSubject:(NSString *_Nullable)aSubject
189  description:(NSString *_Nullable)aDescription
190  invitees:(NSArray<NSString *> *_Nullable)aInvitees
191  message:(NSString *_Nullable)aMessage
192  maxMembersCount:(NSInteger)aMaxMembersCount
193  completion:(void (^_Nullable)(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
194 
195 #pragma mark - Edit Chatroom
196 
218 - (EMChatroom *)joinChatroom:(NSString * _Nonnull)aChatroomId
219  error:(EMError ** _Nullable)pError;
220 
240 - (void)joinChatroom:(NSString *_Nonnull)aChatroomId
241  completion:(void (^_Nullable)(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
242 
262 - (void)leaveChatroom:(NSString *_Nonnull)aChatroomId
263  error:(EMError **_Nullable)pError;
264 
284 - (void)leaveChatroom:(NSString *_Nonnull)aChatroomId
285  completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
286 
312 - (EMError *_Nullable)destroyChatroom:(NSString *_Nonnull)aChatroomId;
313 
336 - (void)destroyChatroom:(NSString *_Nonnull)aChatroomId
337  completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
338 
339 #pragma mark - Fetch
340 
362 - (EMChatroom *_Nullable)getChatroomSpecificationFromServerWithId:(NSString *_Nonnull)aChatroomId
363  error:(EMError *_Nullable*)pError;
364 
383 - (void)getChatroomSpecificationFromServerWithId:(NSString *_Nonnull)aChatroomId
384  completion:(void (^_Nullable)(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
385 
406 - (void)getChatroomSpecificationFromServerWithId:(NSString *_Nonnull)aChatroomId
407  fetchMembers:(bool)aFetchMembers
408  completion:(void (^_Nullable)(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
409 
436 - (EMCursorResult<NSString*> *_Nullable)getChatroomMemberListFromServerWithId:(NSString *_Nonnull)aChatroomId
437  cursor:(NSString *_Nullable)aCursor
438  pageSize:(NSInteger)aPageSize
439  error:(EMError **_Nullable)pError;
440 
464 - (void)getChatroomMemberListFromServerWithId:(NSString *_Nonnull)aChatroomId
465  cursor:(NSString *_Nullable)aCursor
466  pageSize:(NSInteger)aPageSize
467  completion:(void (^_Nullable)(EMCursorResult<NSString*> *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
468 
496 - (NSArray<NSString *> *_Nullable)getChatroomBlacklistFromServerWithId:(NSString *_Nonnull)aChatroomId
497  pageNumber:(NSInteger)aPageNum
498  pageSize:(NSInteger)aPageSize
499  error:(EMError **_Nullable)pError;
500 
528 - (void)getChatroomBlacklistFromServerWithId:(NSString *_Nonnull)aChatroomId
529  pageNumber:(NSInteger)aPageNum
530  pageSize:(NSInteger)aPageSize
531  completion:(void (^_Nullable)(NSArray<NSString *> *_Nullable aList, EMError *_Nullable aError))aCompletionBlock;
532 
560 - (NSArray<NSString *> *_Nullable)getChatroomMuteListFromServerWithId:(NSString *_Nonnull)aChatroomId
561  pageNumber:(NSInteger)aPageNum
562  pageSize:(NSInteger)aPageSize
563  error:(EMError **_Nullable)pError;
564 
592 - (void)getChatroomMuteListFromServerWithId:(NSString *_Nonnull)aChatroomId
593  pageNumber:(NSInteger)aPageNum
594  pageSize:(NSInteger)aPageSize
595  completion:(void (^_Nullable)(NSArray<NSString *> *_Nullable aList, EMError *_Nullable aError))aCompletionBlock;
596 
597 
621 - (NSArray<NSString *> *_Nullable)getChatroomWhiteListFromServerWithId:(NSString *_Nonnull)aChatroomId
622  error:(EMError **_Nullable)pError;
623 
624 
648 - (void)getChatroomWhiteListFromServerWithId:(NSString *_Nonnull)aChatroomId
649  completion:(void (^_Nullable)(NSArray<NSString *> *_Nullable aList, EMError *_Nullable aError))aCompletionBlock;
650 
670 - (BOOL)isMemberInWhiteListFromServerWithChatroomId:(NSString *_Nonnull)aChatroomId
671  error:(EMError **_Nullable )pError;
672 
692 - (void)isMemberInWhiteListFromServerWithChatroomId:(NSString *_Nonnull)aChatroomId
693  completion:(void (^_Nullable)(BOOL inWhiteList, EMError *_Nullable aError))aCompletionBlock;
694 
714 - (void)isMemberInMuteListFromServerWithChatroomId:(NSString *_Nonnull)aChatroomId
715  completion:(void (^_Nullable)(BOOL inMuteList, EMError *_Nullable aError))aCompletionBlock;
737 - (NSString *_Nullable)getChatroomAnnouncementWithId:(NSString *_Nonnull)aChatroomId
738  error:(EMError **_Nullable )pError;
739 
758 - (void)getChatroomAnnouncementWithId:(NSString *_Nonnull)aChatroomId
759  completion:(void (^_Nullable)(NSString *_Nullable aAnnouncement, EMError *_Nullable aError))aCompletionBlock;
760 
761 #pragma mark - Edit
762 
790 - (EMChatroom *)updateSubject:(NSString *_Nullable )aSubject
791  forChatroom:(NSString *_Nonnull)aChatroomId
792  error:(EMError **_Nullable )pError;
793 
819 - (void)updateSubject:(NSString *_Nullable )aSubject
820  forChatroom:(NSString *_Nonnull)aChatroomId
821  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
822 
850 - (EMChatroom *_Nullable )updateDescription:(NSString *_Nullable )aDescription
851  forChatroom:(NSString *_Nonnull)aChatroomId
852  error:(EMError **_Nullable )pError;
853 
879 - (void)updateDescription:(NSString *_Nullable )aDescription
880  forChatroom:(NSString *_Nonnull)aChatroomId
881  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
882 
910 - (EMChatroom *_Nullable )removeMembers:(NSArray<NSString *> *_Nonnull)aMembers
911  fromChatroom:(NSString *_Nonnull)aChatroomId
912  error:(EMError **_Nullable )pError;
913 
939 - (void)removeMembers:(NSArray<NSString *> *_Nonnull)aMembers
940  fromChatroom:(NSString *_Nonnull)aChatroomId
941  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
942 
970 - (EMChatroom *_Nullable )blockMembers:(NSArray<NSString *> *_Nonnull)aMembers
971  fromChatroom:(NSString *_Nonnull)aChatroomId
972  error:(EMError **_Nullable )pError;
973 
999 - (void)blockMembers:(NSArray<NSString *> *_Nonnull)aMembers
1000  fromChatroom:(NSString *_Nonnull)aChatroomId
1001  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1002 
1003 
1031 - (EMChatroom *_Nullable )unblockMembers:(NSArray<NSString *> *_Nonnull)aMembers
1032  fromChatroom:(NSString *_Nonnull)aChatroomId
1033  error:(EMError **_Nullable )pError;
1034 
1060 - (void)unblockMembers:(NSArray<NSString *> *_Nonnull)aMembers
1061  fromChatroom:(NSString *_Nonnull)aChatroomId
1062  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1063 
1091 - (EMChatroom *_Nullable )updateChatroomOwner:(NSString *_Nonnull)aChatroomId
1092  newOwner:(NSString *_Nonnull)aNewOwner
1093  error:(EMError **_Nullable )pError;
1094 
1120 - (void)updateChatroomOwner:(NSString *_Nonnull)aChatroomId
1121  newOwner:(NSString *_Nonnull)aNewOwner
1122  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1123 
1151 - (EMChatroom *_Nullable )addAdmin:(NSString *_Nonnull)aAdmin
1152  toChatroom:(NSString *_Nonnull)aChatroomId
1153  error:(EMError **_Nullable )pError;
1154 
1180 - (void)addAdmin:(NSString *_Nonnull)aAdmin
1181  toChatroom:(NSString *_Nonnull)aChatroomId
1182  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroomp, EMError *_Nullable aError))aCompletionBlock;
1183 
1211 - (EMChatroom *_Nullable )removeAdmin:(NSString *_Nonnull)aAdmin
1212  fromChatroom:(NSString *_Nonnull)aChatroomId
1213  error:(EMError **_Nullable )pError;
1214 
1240 - (void)removeAdmin:(NSString *_Nonnull)aAdmin
1241  fromChatroom:(NSString *_Nonnull)aChatroomId
1242  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1243 
1244 
1274 - (EMChatroom *_Nullable )muteMembers:(NSArray<NSString *> *_Nonnull)aMuteMembers
1275  muteMilliseconds:(NSInteger)aMuteMilliseconds
1276  fromChatroom:(NSString *_Nonnull)aChatroomId
1277  error:(EMError **_Nullable )pError;
1278 
1305 - (void)muteMembers:(NSArray<NSString *> *_Nonnull)aMuteMembers
1306  muteMilliseconds:(NSInteger)aMuteMilliseconds
1307  fromChatroom:(NSString *_Nonnull)aChatroomId
1308  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1309 
1337 - (EMChatroom *_Nullable )unmuteMembers:(NSArray<NSString *> *_Nonnull)aMembers
1338  fromChatroom:(NSString *_Nonnull)aChatroomId
1339  error:(EMError **_Nullable )pError;
1340 
1365 - (void)unmuteMembers:(NSArray<NSString *> *_Nonnull)aMembers
1366  fromChatroom:(NSString *_Nonnull)aChatroomId
1367  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1368 
1369 
1370 
1396 - (EMChatroom *_Nullable )muteAllMembersFromChatroom:(NSString *_Nonnull)aChatroomId
1397  error:(EMError **_Nullable )pError;
1398 
1421 - (void)muteAllMembersFromChatroom:(NSString *_Nonnull)aChatroomId
1422  completion:(void(^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1423 
1424 
1450 - (EMChatroom *_Nullable )unmuteAllMembersFromChatroom:(NSString *_Nonnull)aChatroomId
1451  error:(EMError **_Nullable )pError;
1452 
1453 
1476 - (void)unmuteAllMembersFromChatroom:(NSString *_Nonnull)aChatroomId
1477  completion:(void(^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1478 
1479 
1507 - (EMChatroom *_Nullable )addWhiteListMembers:(NSArray<NSString *> *_Nonnull)aMembers
1508  fromChatroom:(NSString *_Nonnull)aChatroomId
1509  error:(EMError **_Nullable )pError;
1510 
1535 - (void)addWhiteListMembers:(NSArray<NSString *> *_Nonnull)aMembers
1536  fromChatroom:(NSString *_Nonnull)aChatroomId
1537  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1538 
1566 - (EMChatroom *_Nullable )removeWhiteListMembers:(NSArray<NSString *> *_Nonnull)aMembers
1567  fromChatroom:(NSString *_Nonnull)aChatroomId
1568  error:(EMError **_Nullable )pError;
1569 
1594 - (void)removeWhiteListMembers:(NSArray<NSString *> *_Nonnull)aMembers
1595  fromChatroom:(NSString *_Nonnull)aChatroomId
1596  completion:(void (^_Nullable )(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1597 
1625 - (EMChatroom *_Nullable )updateChatroomAnnouncementWithId:(NSString *_Nonnull)aChatroomId
1626  announcement:(NSString *_Nullable )aAnnouncement
1627  error:(EMError **_Nullable )pError;
1628 
1653 - (void)updateChatroomAnnouncementWithId:(NSString *_Nonnull)aChatroomId
1654  announcement:(NSString *_Nullable)aAnnouncement
1655  completion:(void (^_Nullable)(EMChatroom *_Nullable aChatroom, EMError *_Nullable aError))aCompletionBlock;
1688 - (void)setChatroomAttributes:(NSString *_Nonnull)roomId attributes:(NSDictionary<NSString*,NSString*> *_Nonnull)keyValues autoDelete:(BOOL)autoDelete completionBlock:(void (^_Nullable)(EMError *_Nullable aError,NSDictionary<NSString*,EMError*> *_Nullable failureKeys))completionBlock ;
1732 - (void)setChatroomAttribute:(NSString *_Nonnull)roomId key:(NSString *_Nonnull)key value:(NSString *_Nonnull)value autoDelete:(BOOL)autoDelete completionBlock:(void (^_Nullable)(EMError *_Nullable aError))completionBlock;
1758 - (void)setChatroomAttributesForced:(NSString *_Nonnull)roomId attributes:(NSDictionary<NSString*,NSString*> *_Nonnull)keyValues autoDelete:(BOOL)autoDelete completionBlock:(void (^_Nullable)(EMError *_Nullable aError,NSDictionary<NSString*,EMError*> *_Nullable failureKeys))completionBlock;
1759 
1803 - (void)setChatroomAttributeForced:(NSString *_Nonnull)roomId key:(NSString *_Nonnull)key value:(NSString *_Nonnull)value autoDelete:(BOOL)autoDelete completionBlock:(void (^_Nullable)(EMError *_Nullable aError))completionBlock;
1804 
1831 - (void)removeChatroomAttributes:(NSString *_Nonnull)roomId attributes:(NSArray <__kindof NSString*> * _Nonnull)keyValues completionBlock:(void (^_Nullable)(EMError *_Nullable aError,NSDictionary<NSString*,EMError*> *_Nullable failureKeys))completionBlock;
1858 - (void)removeChatroomAttribute:(NSString *_Nonnull)roomId key:(NSString * _Nonnull)key completionBlock:(void (^_Nullable)(EMError *_Nullable aError))completionBlock;
1885 - (void)removeChatroomAttributesForced:(NSString *_Nonnull)roomId attributes:(NSArray <__kindof NSString*> * _Nonnull)keyValues completionBlock:(void (^_Nullable)(EMError *_Nullable aError,NSDictionary<NSString*,EMError*> *_Nullable failureKeys))completionBlock;
1886 
1913 - (void)removeChatroomAttributeForced:(NSString *_Nonnull)roomId key:(NSString * _Nonnull)key completionBlock:(void (^_Nullable)(EMError *_Nullable aError))completionBlock;
1932 - (void)fetchChatroomAttributes:(NSString *_Nonnull)roomId keys:(NSArray <__kindof NSString *> * _Nullable)keys completion:(void (^_Nullable)(EMError *_Nullable aError,NSDictionary<NSString*,NSString*> *_Nullable properties ))completionBlock;
1949 - (void)fetchChatroomAllAttributes:(NSString * _Nonnull)roomId completion:(void (^ _Nullable)(EMError * _Nullable error,NSDictionary<NSString*,NSString*> * _Nullable properties))completionBlock;
1950 
1951 #pragma mark - EM_DEPRECATED_IOS 3.3.0
1952 
1980 - (EMChatroom *)fetchChatroomInfo:(NSString *)aChatroomId
1981  includeMembersList:(BOOL)aIncludeMembersList
1982  error:(EMError **)pError EM_DEPRECATED_IOS(3_1_0, 3_3_0, "Use -IEMChatroomManager getChatroomSpecificationFromServerWithId:error: instead");
1983 
2004 - (void)getChatroomSpecificationFromServerByID:(NSString *)aChatroomId
2005  includeMembersList:(BOOL)aIncludeMembersList
2006  completion:(void (^)(EMChatroom *aChatroom, EMError *aError))aCompletionBlock EM_DEPRECATED_IOS(3_1_0, 3_3_0, "Use -IEMChatroomManager getChatroomSpecificationFromServerWithId:completion: instead");
2007 
2008 #pragma mark - EM_DEPRECATED_IOS 3.2.3
2009 
2025 - (void)addDelegate:(id<EMChatroomManagerDelegate>)aDelegate EM_DEPRECATED_IOS(3_1_0, 3_2_2, "Use -IEMChatroomManager addDelegate:delegateQueue: instead");
2026 
2027 #pragma mark - EM_DEPRECATED_IOS < 3.2.3
2028 
2052 - (NSArray *)getAllChatroomsFromServerWithError:(EMError **)pError __deprecated_msg("Use -getChatroomsFromServerWithPage instead");
2053 
2070 - (void)getAllChatroomsFromServerWithCompletion:(void (^)(NSArray *aList, EMError *aError))aCompletionBlock __deprecated_msg("Use -getChatroomsFromServerWithPage instead");
2071 
2090 - (void)asyncGetAllChatroomsFromServer:(void (^)(NSArray *aList))aSuccessBlock
2091  failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -getAllChatroomsFromServerWithCompletion: instead");
2092 
2114 - (void)asyncJoinChatroom:(NSString *)aChatroomId
2115  success:(void (^)(EMChatroom *aRoom))aSuccessBlock
2116  failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -joinChatroom:completion: instead");
2117 
2141 - (void)asyncLeaveChatroom:(NSString *)aChatroomId
2142  success:(void (^)(EMChatroom *aRoom))aSuccessBlock
2143  failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -leaveChatroom:completion: instead");
2144 
2167 - (void)asyncFetchChatroomInfo:(NSString *)aChatroomId
2168  includeMembersList:(BOOL)aIncludeMembersList
2169  success:(void (^)(EMChatroom *aChatroom))aSuccessBlock
2170  failure:(void (^)(EMError *aError))aFailureBlock __deprecated_msg("Use -getChatroomSpecificationFromServerByID:includeMembersList:completion: instead");
2171 @end
Definition: EMChatroomManagerDelegate.h:41
Definition: EMError.h:26
Definition: EMPageResult.h:24
Definition: EMChatroom.h:41
Definition: EMCursorResult.h:27
Definition: IEMChatroomManager.h:34