AgoraChatSDK 1.2.0
AgoraChatConversation.h
1
9#import <Foundation/Foundation.h>
10
11#import "AgoraChatMessageBody.h"
12#import "AgoraChatCursorResult.h"
13
18typedef NS_ENUM(NSInteger, AgoraChatConversationType) {
19 AgoraChatConversationTypeChat = 0,
20 AgoraChatConversationTypeGroupChat,
21 AgoraChatConversationTypeChatRoom,
22};
23
34typedef NS_ENUM(NSInteger, AgoraChatMessageSearchDirection) {
35 AgoraChatMessageSearchDirectionUp = 0,
36 AgoraChatMessageSearchDirectionDown
37};
38
39@class AgoraChatMessage;
40@class AgoraChatError;
41
46@interface AgoraChatConversation : NSObject
47
55@property (nonatomic, copy, readonly) NSString *conversationId;
56
61@property (nonatomic, assign, readonly) AgoraChatConversationType type;
62
67@property (nonatomic, assign, readonly) int unreadMessagesCount;
68
73@property (nonatomic, assign, readonly) int messagesCount;
74
81@property (nonatomic, copy) NSDictionary *ext;
82
89@property (nonatomic, assign) BOOL isChatThread;
90
97@property (readonly) BOOL isPinned;
98
103@property (readonly) int64_t pinnedTime;
104
109@property (nonatomic, strong, readonly) AgoraChatMessage *latestMessage;
110
118
131- (void)insertMessage:(AgoraChatMessage *_Nonnull)aMessage
132 error:(AgoraChatError ** _Nullable)pError;
133
146- (void)appendMessage:(AgoraChatMessage *_Nonnull)aMessage
147 error:(AgoraChatError **_Nullable)pError;
148
157- (void)deleteMessageWithId:(NSString *_Nonnull)aMessageId
158 error:(AgoraChatError ** _Nullable)pError;
159
166- (void)deleteAllMessages:(AgoraChatError ** _Nullable)pError;
167
168
179- (void)removeMessagesFromServerMessageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
190- (void)removeMessagesFromServerWithTimeStamp:(NSTimeInterval)beforeTimeStamp completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
191
202- (void)updateMessageChange:(AgoraChatMessage *_Nonnull)aMessage
203 error:(AgoraChatError ** _Nullable)pError;
204
213- (void)markMessageAsReadWithId:(NSString *_Nonnull)aMessageId
214 error:(AgoraChatError ** _Nullable)pError;
215
223- (void)markAllMessagesAsRead:(AgoraChatError ** _Nullable)pError;
224
225
226#pragma mark - Load Messages Methods
227
236- (AgoraChatMessage * _Nullable)loadMessageWithId:(NSString * _Nonnull)aMessageId
237 error:(AgoraChatError ** _Nullable)pError;
238
255- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
256 count:(int)aCount
257 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
258
274- (void)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
275 count:(int)aCount
276 searchDirection:(AgoraChatMessageSearchDirection)aDirection
277 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
278
294- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesWithType:(AgoraChatMessageBodyType)aType
295 timestamp:(long long)aTimestamp
296 count:(int)aCount
297 fromUser:(NSString* _Nullable)aUsername
298 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
299
312- (void)loadMessagesWithType:(AgoraChatMessageBodyType)aType
313 timestamp:(long long)aTimestamp
314 count:(int)aCount
315 fromUser:(NSString* _Nullable)aUsername
316 searchDirection:(AgoraChatMessageSearchDirection)aDirection
317 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
318
335- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
336 timestamp:(long long)aTimestamp
337 count:(int)aCount
338 fromUser:(NSString* _Nullable)aSender
339 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
340
354- (void)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
355 timestamp:(long long)aTimestamp
356 count:(int)aCount
357 fromUser:(NSString* _Nullable)aSender
358 searchDirection:(AgoraChatMessageSearchDirection)aDirection
359 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
360
376- (NSArray<AgoraChatMessage *> * _Nullable)loadCustomMsgWithKeyword:(NSString*)aKeyword
377 timestamp:(long long)aTimestamp
378 count:(int)aCount
379 fromUser:(NSString* _Nullable)aSender
380 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
381
395- (void)loadCustomMsgWithKeyword:(NSString* _Nullable)aKeyword
396 timestamp:(long long)aTimestamp
397 count:(int)aCount
398 fromUser:(NSString* _Nullable)aSender
399 searchDirection:(AgoraChatMessageSearchDirection)aDirection
400 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
401
417- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesFrom:(long long)aStartTimestamp
418 to:(long long)aEndTimestamp
419 count:(int)aCount;
420
431- (void)loadMessagesFrom:(long long)aStartTimestamp
432 to:(long long)aEndTimestamp
433 count:(int)aCount
434 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
435
447- (AgoraChatError* _Nullable)removeMessagesStart:(NSInteger)aStartTimestamp
448 to:(NSInteger)aEndTimestamp;
449@end
Definition: AgoraChatConversation.h:47
BOOL isPinned
Definition: AgoraChatConversation.h:97
BOOL isChatThread
Definition: AgoraChatConversation.h:89
AgoraChatMessage *_Nullable lastReceivedMessage()
NSString * conversationId
Definition: AgoraChatConversation.h:55
AgoraChatMessage * latestMessage
Definition: AgoraChatConversation.h:109
int64_t pinnedTime
Definition: AgoraChatConversation.h:103
int unreadMessagesCount
Definition: AgoraChatConversation.h:67
int messagesCount
Definition: AgoraChatConversation.h:73
NSDictionary * ext
Definition: AgoraChatConversation.h:81
AgoraChatConversationType type
Definition: AgoraChatConversation.h:61
Definition: AgoraChatError.h:18
Definition: AgoraChatMessage.h:61