HyphenateChatSDK 3.9.9.1
EMConversation.h
1
15#import <Foundation/Foundation.h>
16
17#import "EMMessageBody.h"
18
26typedef NS_ENUM(NSInteger, EMConversationType) {
27 EMConversationTypeChat = 0,
28 EMConversationTypeGroupChat,
29 EMConversationTypeChatRoom,
30};
31
39typedef NS_ENUM(NSInteger, EMMessageSearchDirection) {
40 EMMessageSearchDirectionUp = 0,
41 EMMessageSearchDirectionDown
42};
43
44@class EMChatMessage;
45@class EMError;
46
54@interface EMConversation : NSObject
55
71@property (nonatomic, copy, readonly) NSString *conversationId;
72
80@property (nonatomic, assign, readonly) EMConversationType type;
81
89@property (nonatomic, assign, readonly) int unreadMessagesCount;
90
98@property (nonatomic, assign, readonly) int messagesCount;
99
107@property (nonatomic, copy) NSDictionary *ext;
108
116@property (nonatomic, assign) BOOL isChatThread;
117
125@property (nonatomic, strong, readonly) EMChatMessage *latestMessage;
126
139
161- (void)insertMessage:(EMChatMessage *_Nonnull)aMessage
162 error:(EMError ** _Nullable)pError;
163
178- (void)appendMessage:(EMChatMessage *_Nonnull)aMessage
179 error:(EMError **_Nullable)pError;
180
195- (void)deleteMessageWithId:(NSString *_Nonnull)aMessageId
196 error:(EMError ** _Nullable)pError;
197
209- (void)deleteAllMessages:(EMError ** _Nullable)pError;
210
211
224- (void)removeMessagesFromServerMessageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
238- (void)removeMessagesFromServerWithTimeStamp:(NSTimeInterval)beforeTimeStamp completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
239
258- (void)updateMessageChange:(EMChatMessage *_Nonnull)aMessage
259 error:(EMError ** _Nullable)pError;
260
275- (void)markMessageAsReadWithId:(NSString *_Nonnull)aMessageId
276 error:(EMError ** _Nullable)pError;
277
290- (void)markAllMessagesAsRead:(EMError ** _Nullable)pError;
291
292
293#pragma mark - Load Messages Methods
294
309- (EMChatMessage * _Nullable)loadMessageWithId:(NSString * _Nonnull)aMessageId
310 error:(EMError ** _Nullable)pError;
311
342- (NSArray<EMChatMessage *> * _Nullable)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
343 count:(int)aCount
344 searchDirection:(EMMessageSearchDirection)aDirection;
345
370- (void)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
371 count:(int)aCount
372 searchDirection:(EMMessageSearchDirection)aDirection
373 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
374
407- (NSArray<EMChatMessage *> * _Nullable)loadMessagesWithType:(EMMessageBodyType)aType
408 timestamp:(long long)aTimestamp
409 count:(int)aCount
410 fromUser:(NSString* _Nullable)aUsername
411 searchDirection:(EMMessageSearchDirection)aDirection;
412
437- (void)loadMessagesWithType:(EMMessageBodyType)aType
438 timestamp:(long long)aTimestamp
439 count:(int)aCount
440 fromUser:(NSString* _Nullable)aUsername
441 searchDirection:(EMMessageSearchDirection)aDirection
442 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
443
474- (NSArray<EMChatMessage *> * _Nullable)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
475 timestamp:(long long)aTimestamp
476 count:(int)aCount
477 fromUser:(NSString* _Nullable)aSender
478 searchDirection:(EMMessageSearchDirection)aDirection;
479
504- (void)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
505 timestamp:(long long)aTimestamp
506 count:(int)aCount
507 fromUser:(NSString* _Nullable)aSender
508 searchDirection:(EMMessageSearchDirection)aDirection
509 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
510
542- (NSArray<EMChatMessage *> * _Nullable)loadCustomMsgWithKeyword:(NSString*)aKeyword
543 timestamp:(long long)aTimestamp
544 count:(int)aCount
545 fromUser:(NSString* _Nullable)aSender
546 searchDirection:(EMMessageSearchDirection)aDirection;
547
572- (void)loadCustomMsgWithKeyword:(NSString* _Nullable)aKeyword
573 timestamp:(long long)aTimestamp
574 count:(int)aCount
575 fromUser:(NSString* _Nullable)aSender
576 searchDirection:(EMMessageSearchDirection)aDirection
577 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
578
606- (NSArray<EMChatMessage *> * _Nullable)loadMessagesFrom:(long long)aStartTimestamp
607 to:(long long)aEndTimestamp
608 count:(int)aCount;
609
628- (void)loadMessagesFrom:(long long)aStartTimestamp
629 to:(long long)aEndTimestamp
630 count:(int)aCount
631 completion:(void (^ _Nullable)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
632
633@end
Definition: EMChatMessage.h:82
Definition: EMConversation.h:55
NSDictionary * ext
Definition: EMConversation.h:107
int messagesCount
Definition: EMConversation.h:98
BOOL isChatThread
Definition: EMConversation.h:116
EMChatMessage * latestMessage
Definition: EMConversation.h:125
EMConversationType type
Definition: EMConversation.h:80
int unreadMessagesCount
Definition: EMConversation.h:89
NSString * conversationId
Definition: EMConversation.h:71
EMChatMessage *_Nullable lastReceivedMessage()
Definition: EMError.h:27