AgoraChatSDK 1.3.1
AgoraChatConversation.h
1
9#import <Foundation/Foundation.h>
10
11#import "AgoraChatMessageBody.h"
12#import "AgoraChatCursorResult.h"
13#import "AgoraChatSilentModeParam.h"
14
19typedef NS_ENUM(NSInteger, AgoraChatConversationType) {
20 AgoraChatConversationTypeChat = 0,
21 AgoraChatConversationTypeGroupChat,
22 AgoraChatConversationTypeChatRoom,
23};
24
31typedef NS_ENUM(NSInteger, AgoraChatMarkType) {
32 AgoraChatMarkType0 = 0,
33 AgoraChatMarkType1 = 1,
34 AgoraChatMarkType2 = 2,
35 AgoraChatMarkType3 = 3,
36 AgoraChatMarkType4 = 4,
37 AgoraChatMarkType5 = 5,
38 AgoraChatMarkType6 = 6,
39 AgoraChatMarkType7 = 7,
40 AgoraChatMarkType8 = 8,
41 AgoraChatMarkType9 = 9,
42 AgoraChatMarkType10 = 10,
43 AgoraChatMarkType11 = 11,
44 AgoraChatMarkType12 = 12,
45 AgoraChatMarkType13 = 13,
46 AgoraChatMarkType14 = 14,
47 AgoraChatMarkType15 = 15,
48 AgoraChatMarkType16 = 16,
49 AgoraChatMarkType17 = 17,
50 AgoraChatMarkType18 = 18,
51 AgoraChatMarkType19 = 19,
52};
53
64typedef NS_ENUM(NSInteger, AgoraChatMessageSearchDirection) {
65 AgoraChatMessageSearchDirectionUp = 0,
66 AgoraChatMessageSearchDirectionDown
67};
68
73typedef NS_ENUM(NSInteger, AgoraChatMessageSearchScope) {
74 AgoraChatMessageSearchScopeContent = 0,
75 AgoraChatMessageSearchScopeExt,
76 AgoraChatMessageSearchScopeAll
77};
78
79@class AgoraChatMessage;
80@class AgoraChatError;
81
86@interface AgoraChatConversation : NSObject
87
95@property (nonatomic, copy, readonly) NSString *conversationId;
96
101@property (nonatomic, assign, readonly) AgoraChatConversationType type;
102
107@property (nonatomic, assign, readonly) int unreadMessagesCount;
108
113@property (nonatomic, assign, readonly) int messagesCount;
114
121@property (nonatomic, copy) NSDictionary *ext;
122
129@property (nonatomic, assign) BOOL isChatThread;
130
137@property (readonly) BOOL isPinned;
138
143@property (readonly) int64_t pinnedTime;
144
149@property (nonatomic, strong, readonly) AgoraChatMessage *latestMessage;
150
155@property (nonatomic, readonly) NSArray<NSNumber*>* marks;
156
161@property (nonatomic, readonly) AgoraChatPushRemindType disturbType;
162
170
183- (void)insertMessage:(AgoraChatMessage *_Nonnull)aMessage
184 error:(AgoraChatError ** _Nullable)pError;
185
198- (void)appendMessage:(AgoraChatMessage *_Nonnull)aMessage
199 error:(AgoraChatError **_Nullable)pError;
200
209- (void)deleteMessageWithId:(NSString *_Nonnull)aMessageId
210 error:(AgoraChatError ** _Nullable)pError;
211
218- (void)deleteAllMessages:(AgoraChatError ** _Nullable)pError;
219
220
231- (void)removeMessagesFromServerMessageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
242- (void)removeMessagesFromServerWithTimeStamp:(NSTimeInterval)beforeTimeStamp completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
243
254- (void)updateMessageChange:(AgoraChatMessage *_Nonnull)aMessage
255 error:(AgoraChatError ** _Nullable)pError;
256
265- (void)markMessageAsReadWithId:(NSString *_Nonnull)aMessageId
266 error:(AgoraChatError ** _Nullable)pError;
267
275- (void)markAllMessagesAsRead:(AgoraChatError ** _Nullable)pError;
276
281- (NSArray<AgoraChatMessage*>* _Nullable)pinnedMessages;
282
283
284#pragma mark - Load Messages Methods
285
294- (AgoraChatMessage * _Nullable)loadMessageWithId:(NSString * _Nonnull)aMessageId
295 error:(AgoraChatError ** _Nullable)pError;
296
313- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
314 count:(int)aCount
315 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
316
332- (void)loadMessagesStartFromId:(NSString * _Nullable)aMessageId
333 count:(int)aCount
334 searchDirection:(AgoraChatMessageSearchDirection)aDirection
335 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
336
352- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesWithType:(AgoraChatMessageBodyType)aType
353 timestamp:(long long)aTimestamp
354 count:(int)aCount
355 fromUser:(NSString* _Nullable)aUsername
356 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
357
370- (void)loadMessagesWithType:(AgoraChatMessageBodyType)aType
371 timestamp:(long long)aTimestamp
372 count:(int)aCount
373 fromUser:(NSString* _Nullable)aUsername
374 searchDirection:(AgoraChatMessageSearchDirection)aDirection
375 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
388- (void)searchMessagesWithTypes:(NSArray <NSNumber*> *_Nonnull)aTypes
389 timestamp:(long long)aTimestamp
390 count:(int)aCount
391 fromUser:(NSString* _Nullable)aUsername
392 searchDirection:(AgoraChatMessageSearchDirection)aDirection
393 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
410- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
411 timestamp:(long long)aTimestamp
412 count:(int)aCount
413 fromUser:(NSString* _Nullable)aSender
414 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
415
429- (void)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
430 timestamp:(long long)aTimestamp
431 count:(int)aCount
432 fromUser:(NSString* _Nullable)aSender
433 searchDirection:(AgoraChatMessageSearchDirection)aDirection
434 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
435
454- (void)loadMessagesWithKeyword:(NSString* _Nullable)aKeyword
455 timestamp:(long long)aTimestamp
456 count:(int)aCount
457 fromUser:(NSString* _Nullable)aSender
458 searchDirection:(AgoraChatMessageSearchDirection)aDirection
459 scope:(AgoraChatMessageSearchScope)aScope
460 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
461
477- (NSArray<AgoraChatMessage *> * _Nullable)loadCustomMsgWithKeyword:(NSString*)aKeyword
478 timestamp:(long long)aTimestamp
479 count:(int)aCount
480 fromUser:(NSString* _Nullable)aSender
481 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
482
496- (void)loadCustomMsgWithKeyword:(NSString* _Nullable)aKeyword
497 timestamp:(long long)aTimestamp
498 count:(int)aCount
499 fromUser:(NSString* _Nullable)aSender
500 searchDirection:(AgoraChatMessageSearchDirection)aDirection
501 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
502
518- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesFrom:(long long)aStartTimestamp
519 to:(long long)aEndTimestamp
520 count:(int)aCount;
521
532- (void)loadMessagesFrom:(long long)aStartTimestamp
533 to:(long long)aEndTimestamp
534 count:(int)aCount
535 completion:(void (^ _Nullable)(NSArray<AgoraChatMessage *> * _Nullable aMessages, AgoraChatError * _Nullable aError))aCompletionBlock;
536
548- (AgoraChatError* _Nullable)removeMessagesStart:(NSInteger)aStartTimestamp
549 to:(NSInteger)aEndTimestamp;
550
559- (NSInteger)getMessageCountStart:(NSInteger)aStartTimestamp
560 to:(NSInteger)aEndTimestamp;
561@end
Definition: AgoraChatConversation.h:87
BOOL isPinned
Definition: AgoraChatConversation.h:137
BOOL isChatThread
Definition: AgoraChatConversation.h:129
AgoraChatMessage *_Nullable lastReceivedMessage()
NSString * conversationId
Definition: AgoraChatConversation.h:95
AgoraChatMessage * latestMessage
Definition: AgoraChatConversation.h:149
int64_t pinnedTime
Definition: AgoraChatConversation.h:143
int unreadMessagesCount
Definition: AgoraChatConversation.h:107
int messagesCount
Definition: AgoraChatConversation.h:113
AgoraChatPushRemindType disturbType
Definition: AgoraChatConversation.h:161
NSArray< NSNumber * > * marks
Definition: AgoraChatConversation.h:155
NSDictionary * ext
Definition: AgoraChatConversation.h:121
NSArray< AgoraChatMessage * > *_Nullable pinnedMessages()
AgoraChatConversationType type
Definition: AgoraChatConversation.h:101
Definition: AgoraChatError.h:18
Definition: AgoraChatMessage.h:87