HyphenateChatSDK 3.9.9.1
IEMChatManager.h
1
15#import <Foundation/Foundation.h>
16
17#import "EMCommonDefs.h"
18#import "EMChatManagerDelegate.h"
19#import "EMConversation.h"
20
21#import "EMChatMessage.h"
22#import "EMTextMessageBody.h"
23#import "EMLocationMessageBody.h"
24#import "EMCmdMessageBody.h"
25#import "EMFileMessageBody.h"
26#import "EMImageMessageBody.h"
27#import "EMVoiceMessageBody.h"
28#import "EMVideoMessageBody.h"
29#import "EMCustomMessageBody.h"
30#import "EMCursorResult.h"
31
32#import "EMGroupMessageAck.h"
33#import "EMTranslateLanguage.h"
34
42typedef NS_ENUM(NSUInteger, EMMessageFetchHistoryDirection) {
43 EMMessageFetchHistoryDirectionUp = 0,
44 EMMessageFetchHistoryDirectionDown
45};
46
47
48@class EMError;
49
59@protocol IEMChatManager <NSObject>
60
61@required
62
63#pragma mark - Delegate
64
78- (void)addDelegate:(id<EMChatManagerDelegate> _Nullable)aDelegate
79 delegateQueue:(dispatch_queue_t _Nullable)aQueue;
80
92- (void)removeDelegate:(id<EMChatManagerDelegate> _Nonnull)aDelegate;
93
94#pragma mark - Conversation
95
107- (NSArray<EMConversation *> * _Nullable)getAllConversations;
108
120- (void)getConversationsFromServer:(void (^_Nullable)(NSArray<EMConversation *> * _Nullable aConversations, EMError * _Nullable aError))aCompletionBlock;
121
137- (EMConversation *_Nullable)getConversationWithConvId:(NSString * _Nullable)aConversationId;
138
158- (EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
159 type:(EMConversationType)aType
160 createIfNotExist:(BOOL)aIfCreate;
161
181- (EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
182 type:(EMConversationType)aType
183 createIfNotExist:(BOOL)aIfCreate isThread:(BOOL)isThread;
184
206- (EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
207 type:(EMConversationType)iType
208 createIfNotExist:(BOOL)bIfCreate
209 isThread:(BOOL)isThread
210 isChannel:(BOOL)isChannel;
211
231- (void)deleteConversation:(NSString * _Nonnull)aConversationId
232 isDeleteMessages:(BOOL)aIsDeleteMessages
233 completion:(void (^_Nullable)(NSString * _Nullable aConversationId, EMError *_Nullable aError))aCompletionBlock;
234
257 - (void)deleteServerConversation:(NSString * _Nonnull)aConversationId
258 conversationType:(EMConversationType)aConversationType
259 isDeleteServerMessages:(BOOL)aIsDeleteServerMessages
260 completion:(void (^_Nullable)(NSString * _Nullable aConversationId, EMError * _Nullable aError))aCompletionBlock;
261
282- (void)deleteConversations:(NSArray<EMConversation *> * _Nullable)aConversations
283 isDeleteMessages:(BOOL)aIsDeleteMessages
284 completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
285
301- (void)importConversations:(NSArray<EMConversation *> * _Nullable)aConversations
302 completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
303
304#pragma mark - Message
305
320- (EMChatMessage * _Nullable)getMessageWithMessageId:(NSString * _Nonnull)aMessageId;
321
339- (NSString * _Nullable)getMessageAttachmentPath:(NSString * _Nonnull)aConversationId;
340
355- (void)importMessages:(NSArray<EMChatMessage *> * _Nonnull)aMessages
356 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
357
372- (void)updateMessage:(EMChatMessage *_Nonnull)aMessage
373 completion:(void (^_Nullable)(EMChatMessage * _Nullable aMessage, EMError * _Nullable aError))aCompletionBlock;
374
395- (void)sendMessageReadAck:(NSString * _Nonnull)aMessageId
396 toUser:(NSString * _Nonnull)aUsername
397 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
398
399
422- (void)sendGroupMessageReadAck:(NSString * _Nonnull)aMessageId
423 toGroup:(NSString * _Nonnull)aGroupId
424 content:(NSString * _Nullable)aContent
425 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
426
459- (void)ackConversationRead:(NSString * _Nonnull)conversationId
460 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
461
480- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId
481 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
482
483
503- (void)sendMessage:(EMChatMessage *_Nonnull)aMessage
504 progress:(void (^_Nullable)(int progress))aProgressBlock
505 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
506
522- (void)resendMessage:(EMChatMessage *_Nonnull)aMessage
523 progress:(void (^_Nullable)(int progress))aProgressBlock
524 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
525
545- (void)downloadMessageThumbnail:(EMChatMessage *_Nonnull)aMessage
546 progress:(void (^_Nullable)(int progress))aProgressBlock
547 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
548
572- (void)downloadMessageAttachment:(EMChatMessage *_Nonnull)aMessage
573 progress:(void (^_Nullable)(int progress))aProgressBlock
574 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
575
576
577
604- (EMCursorResult<EMChatMessage*> *_Nullable)fetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
605 conversationType:(EMConversationType)aConversationType
606 startMessageId:(NSString *_Nullable)aStartMessageId
607 fetchDirection:(EMMessageFetchHistoryDirection)direction
608 pageSize:(int)aPageSize
609 error:(EMError **_Nullable)pError;
634- (EMCursorResult<EMChatMessage*> *_Nullable)fetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
635 conversationType:(EMConversationType)aConversationType
636 startMessageId:(NSString *_Nullable)aStartMessageId
637 pageSize:(int)aPageSize
638 error:(EMError **_Nullable)pError;
639
640
665- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
666 conversationType:(EMConversationType)aConversationType
667 startMessageId:(NSString *_Nullable)aStartMessageId
668 pageSize:(int)aPageSize
669 completion:(void (^_Nullable)(EMCursorResult<EMChatMessage*> *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
696- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
697 conversationType:(EMConversationType)aConversationType
698 startMessageId:(NSString *_Nullable)aStartMessageId
699 fetchDirection:(EMMessageFetchHistoryDirection)direction
700 pageSize:(int)aPageSize
701 completion:(void (^_Nullable)(EMCursorResult<EMChatMessage*> *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
702
703
704
705
730- (void)asyncFetchGroupMessageAcksFromServer:(NSString *_Nonnull)aMessageId
731 groupId:(NSString *_Nonnull)aGroupId
732 startGroupAckId:(NSString *_Nonnull)aGroupAckId
733 pageSize:(int)aPageSize
734 completion:(void (^_Nullable)(EMCursorResult<EMGroupMessageAck *> *_Nullable aResult, EMError *_Nullable error, int totalCount))aCompletionBlock;
735
756- (void)reportMessageWithId:(NSString *_Nonnull )aMessageId
757 tag:(NSString *_Nonnull)aTag
758 reason:(NSString *_Nonnull)aReason
759 completion:(void(^_Nullable)(EMError* _Nullable error))aCompletion;
760
777- (void)deleteMessagesBefore:(NSUInteger)aTimestamp
778 completion:(void(^)(EMError*error))aCompletion;
779
780
781
796- (void)removeMessagesFromServerWithConversation:(EMConversation *_Nonnull)conversation messageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
812- (void)removeMessagesFromServerWithConversation:(EMConversation *_Nonnull)conversation timeStamp:(NSTimeInterval)beforeTimeStamp completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
813
814
830- (void)translateMessage:(EMChatMessage * _Nonnull)aMessage
831 targetLanguages:(NSArray<NSString*>* _Nonnull)aLanguages
832 completion:(void (^_Nullable)(EMChatMessage * _Nullable message, EMError * _Nullable error))aCompletionBlock;
833
845- (void)fetchSupportedLanguages:(void(^_Nullable)(NSArray<EMTranslateLanguage*>* _Nullable languages,EMError* _Nullable error))aCompletionBlock;
846
883- (NSArray<EMChatMessage *> * _Nullable)loadMessagesWithType:(EMMessageBodyType)aType
884 timestamp:(long long)aTimestamp
885 count:(int)aCount
886 fromUser:(NSString* _Nullable)aUsername
887 searchDirection:(EMMessageSearchDirection)aDirection;
888
919- (void)loadMessagesWithType:(EMMessageBodyType)aType
920 timestamp:(long long)aTimestamp
921 count:(int)aCount
922 fromUser:(NSString*)aUsername
923 searchDirection:(EMMessageSearchDirection)aDirection
924 completion:(void (^)(NSArray<EMChatMessage *> *aMessages, EMError *aError))aCompletionBlock;
925
962- (NSArray<EMChatMessage *> *)loadMessagesWithKeyword:(NSString*)aKeywords
963 timestamp:(long long)aTimestamp
964 count:(int)aCount
965 fromUser:(NSString*)aSender
966 searchDirection:(EMMessageSearchDirection)aDirection;
967
998- (void)loadMessagesWithKeyword:(NSString*)aKeywords
999 timestamp:(long long)aTimestamp
1000 count:(int)aCount
1001 fromUser:(NSString*)aSender
1002 searchDirection:(EMMessageSearchDirection)aDirection
1003 completion:(void (^)(NSArray<EMChatMessage *> *aMessages, EMError *aError))aCompletionBlock;
1004
1005NS_ASSUME_NONNULL_BEGIN
1021- (void)addReaction:(NSString *)reaction toMessage:(NSString *)messageId completion:(nullable void(^)(EMError * _Nullable))completion;
1022
1038- (void)removeReaction:(NSString *)reaction fromMessage:(NSString *)messageId completion:(nullable void(^)(EMError * _Nullable))completion;
1039
1057- (void)getReactionList:(NSArray <NSString *>*)messageIds
1058 groupId:(nullable NSString *)groupId
1059 chatType:(EMChatType)chatType
1060 completion:(void (^)(NSDictionary <NSString *, NSArray<EMMessageReaction *> *> *, EMError * _Nullable))completion;
1061
1081- (void)getReactionDetail:(NSString *)messageId
1082 reaction:(NSString *)reaction
1083 cursor:(nullable NSString *)cursor
1084 pageSize:(uint64_t)pageSize
1085 completion:(void (^)(EMMessageReaction *, NSString * _Nullable cursor, EMError * _Nullable))completion;
1086
1087NS_ASSUME_NONNULL_END
1088
1089@end
Definition: EMChatMessage.h:82
Definition: EMConversation.h:55
Definition: EMCursorResult.h:27
Definition: EMError.h:27
Definition: EMGroupMessageAck.h:21
Definition: EMMessageReaction.h:21
Definition: EMTranslateLanguage.h:20
Definition: EMChatManagerDelegate.h:31
Definition: IEMChatManager.h:59
NSArray< EMConversation * > *_Nullable getAllConversations()