HyphenateChatSDK 4.10.0
EMConversation.h
1
15#import <Foundation/Foundation.h>
16
17#import "EMMessageBody.h"
18#import "EMCursorResult.h"
19#import "EMSilentModeParam.h"
20
28typedef NS_ENUM(NSInteger, EMConversationType) {
29 EMConversationTypeChat = 0,
30 EMConversationTypeGroupChat,
31 EMConversationTypeChatRoom,
32};
33
45typedef NS_ENUM(NSInteger, EMMarkType) {
46 EMMarkType0 = 0,
47 EMMarkType1 = 1,
48 EMMarkType2 = 2,
49 EMMarkType3 = 3,
50 EMMarkType4 = 4,
51 EMMarkType5 = 5,
52 EMMarkType6 = 6,
53 EMMarkType7 = 7,
54 EMMarkType8 = 8,
55 EMMarkType9 = 9,
56 EMMarkType10 = 10,
57 EMMarkType11 = 11,
58 EMMarkType12 = 12,
59 EMMarkType13 = 13,
60 EMMarkType14 = 14,
61 EMMarkType15 = 15,
62 EMMarkType16 = 16,
63 EMMarkType17 = 17,
64 EMMarkType18 = 18,
65 EMMarkType19 = 19,
66};
67
86typedef NS_ENUM(NSInteger, EMMessageSearchDirection) {
87 EMMessageSearchDirectionUp = 0,
88 EMMessageSearchDirectionDown
89};
90
98typedef NS_ENUM(NSInteger, EMMessageSearchScope) {
99 EMMessageSearchScopeContent = 0,
100 EMMessageSearchScopeExt,
101 EMMessageSearchScopeAll
102};
103
104@class EMChatMessage;
105@class EMError;
106
114@interface EMConversation : NSObject
115
129@property (nonatomic, copy, readonly) NSString *conversationId;
130
138@property (nonatomic, assign, readonly) EMConversationType type;
139
147@property (nonatomic, assign, readonly) int unreadMessagesCount;
148
156@property (nonatomic, assign, readonly) int messagesCount;
157
169@property (nonatomic, copy) NSDictionary *ext;
170
182@property (nonatomic, assign) BOOL isChatThread;
183
195@property (readonly) BOOL isPinned;
196
204@property (readonly) int64_t pinnedTime;
205
213@property (nonatomic, strong, readonly) EMChatMessage *latestMessage;
214
222@property (nonatomic, readonly) NSArray<NSNumber*>* marks;
223
231@property (nonatomic, readonly) EMPushRemindType disturbType;
232
245
268- (void)insertMessage:(EMChatMessage *_Nonnull)aMessage
269 error:(EMError ** _Nullable)pError;
270
293- (void)appendMessage:(EMChatMessage *_Nonnull)aMessage
294 error:(EMError **_Nullable)pError;
295
310- (void)deleteMessageWithId:(NSString *_Nonnull)aMessageId
311 error:(EMError ** _Nullable)pError;
312
324- (void)deleteAllMessages:(EMError ** _Nullable)pError;
325
326
343- (void)removeMessagesFromServerMessageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
360- (void)removeMessagesFromServerWithTimeStamp:(NSTimeInterval)beforeTimeStamp completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
361
382- (void)updateMessageChange:(EMChatMessage *_Nonnull)aMessage
383 error:(EMError ** _Nullable)pError;
384
399- (void)markMessageAsReadWithId:(NSString *_Nonnull)aMessageId
400 error:(EMError ** _Nullable)pError;
401
414- (void)markAllMessagesAsRead:(EMError ** _Nullable)pError;
415
423- (NSArray<EMChatMessage*>* _Nullable)pinnedMessages;
424
425
426#pragma mark - Load Messages Methods
427
442- (EMChatMessage * _Nullable)loadMessageWithId:(NSString * _Nonnull)aMessageId
443 error:(EMError ** _Nullable)pError;
444
475- (NSArray<EMChatMessage *> * _Nullable)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
476 count:(int)aCount
477 searchDirection:(EMMessageSearchDirection)aDirection;
478
505- (void)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
506 count:(int)aCount
507 searchDirection:(EMMessageSearchDirection)aDirection
508 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
509
538- (NSArray<EMChatMessage *> * _Nullable)loadMessagesWithType:(EMMessageBodyType)aType
539 timestamp:(long long)aTimestamp
540 count:(int)aCount
541 fromUser:(NSString* _Nullable)aUsername
542 searchDirection:(EMMessageSearchDirection)aDirection;
543
566- (void)loadMessagesWithType:(EMMessageBodyType)aType
567 timestamp:(long long)aTimestamp
568 count:(int)aCount
569 fromUser:(NSString* _Nullable)aUsername
570 searchDirection:(EMMessageSearchDirection)aDirection
571 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
594- (void)searchMessagesWithTypes:(NSArray <NSNumber*> *_Nonnull)aTypes
595 timestamp:(long long)aTimestamp
596 count:(int)aCount
597 fromUser:(NSString* _Nullable)aUsername
598 searchDirection:(EMMessageSearchDirection)aDirection
599 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
630- (NSArray<EMChatMessage *> * _Nullable)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
631 timestamp:(long long)aTimestamp
632 count:(int)aCount
633 fromUser:(NSString* _Nullable)aSender
634 searchDirection:(EMMessageSearchDirection)aDirection;
635
659- (void)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
660 timestamp:(long long)aTimestamp
661 count:(int)aCount
662 fromUser:(NSString* _Nullable)aSender
663 searchDirection:(EMMessageSearchDirection)aDirection
664 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
665
697- (void)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
698 timestamp:(long long)aTimestamp
699 count:(int)aCount
700 fromUser:(NSString* _Nullable)aSender
701 searchDirection:(EMMessageSearchDirection)aDirection
702 scope:(EMMessageSearchScope)aScope
703 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
704
734- (NSArray<EMChatMessage *> * _Nullable)loadCustomMsgWithKeyword:(NSString*)aKeyword
735 timestamp:(long long)aTimestamp
736 count:(int)aCount
737 fromUser:(NSString* _Nullable)aSender
738 searchDirection:(EMMessageSearchDirection)aDirection;
739
763- (void)loadCustomMsgWithKeyword:(NSString* _Nullable)aKeyword
764 timestamp:(long long)aTimestamp
765 count:(int)aCount
766 fromUser:(NSString* _Nullable)aSender
767 searchDirection:(EMMessageSearchDirection)aDirection
768 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
769
799- (NSArray<EMChatMessage *> * _Nullable)loadMessagesFrom:(long long)aStartTimestamp
800 to:(long long)aEndTimestamp
801 count:(int)aCount;
802
821- (void)loadMessagesFrom:(long long)aStartTimestamp
822 to:(long long)aEndTimestamp
823 count:(int)aCount
824 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
825
846- (EMError* _Nullable)removeMessagesStart:(NSInteger)aStartTimestamp
847 to:(NSInteger)aEndTimestamp;
848
864- (NSInteger)getMessageCountStart:(NSInteger)aStartTimestamp
865 to:(NSInteger)aEndTimestamp;
866@end
Definition: EMChatMessage.h:114
Definition: EMConversation.h:115
NSDictionary * ext
Definition: EMConversation.h:169
int64_t pinnedTime
Definition: EMConversation.h:204
int messagesCount
Definition: EMConversation.h:156
BOOL isChatThread
Definition: EMConversation.h:182
EMChatMessage * latestMessage
Definition: EMConversation.h:213
EMConversationType type
Definition: EMConversation.h:138
NSArray< NSNumber * > * marks
Definition: EMConversation.h:222
NSArray< EMChatMessage * > *_Nullable pinnedMessages()
BOOL isPinned
Definition: EMConversation.h:195
EMPushRemindType disturbType
Definition: EMConversation.h:231
int unreadMessagesCount
Definition: EMConversation.h:147
NSString * conversationId
Definition: EMConversation.h:129
EMChatMessage *_Nullable lastReceivedMessage()
Definition: EMError.h:27