AgoraChatSDK 1.2.0
IAgoraChatManager.h
1
9#import <Foundation/Foundation.h>
10
11#import "AgoraChatCommonDefs.h"
12#import "AgoraChatManagerDelegate.h"
13#import "AgoraChatConversation.h"
14
15#import "AgoraChatMessage.h"
16#import "AgoraChatTextMessageBody.h"
17#import "AgoraChatLocationMessageBody.h"
18#import "AgoraChatCmdMessageBody.h"
19#import "AgoraChatFileMessageBody.h"
20#import "AgoraChatImageMessageBody.h"
21#import "AgoraChatVoiceMessageBody.h"
22#import "AgoraChatVideoMessageBody.h"
23#import "AgoraChatCustomMessageBody.h"
24#import "AgoraChatCombineMessageBody.h"
25#import "AgoraChatCursorResult.h"
26
27#import "AgoraChatGroupMessageAck.h"
28#import "AgoraChatTranslateLanguage.h"
29#import "AgoraChatFetchServerMessagesOption.h"
30
35typedef NS_ENUM(NSUInteger, AgoraChatMessageFetchHistoryDirection) {
36 AgoraChatMessageFetchHistoryDirectionUp = 0,
37 AgoraChatMessageFetchHistoryDirectionDown
39};
40
41
42@class AgoraChatError;
43
50@protocol IAgoraChatManager <NSObject>
51
52@required
53
54#pragma mark - Delegate
55
63- (void)addDelegate:(id<AgoraChatManagerDelegate> _Nullable)aDelegate
64 delegateQueue:(dispatch_queue_t _Nullable)aQueue;
65
72- (void)removeDelegate:(id<AgoraChatManagerDelegate> _Nonnull)aDelegate;
73
74#pragma mark - Conversation
75
84- (NSArray<AgoraChatConversation *> * _Nullable)getAllConversations;
85
97- (NSArray<AgoraChatConversation *> * _Nullable)getAllConversations:(BOOL)isSort;
98
105- (void)getConversationsFromServer:(void (^_Nullable)(NSArray<AgoraChatConversation *> * _Nullable aConversations, AgoraChatError * _Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(4_0_0, "Use -IAgoraChatManager getConversationsFromServerWithCursor:pageSize:completion");
106
115- (void)getConversationsFromServerByPage:(NSUInteger)pageNumber
116 pageSize:(NSUInteger)pageSize
117 completion:(void (^_Nullable)(NSArray<AgoraChatConversation *> * _Nullable aConversations, AgoraChatError * _Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(4_0_0, "Use -IAgoraChatManager getConversationsFromServerWithCursor:pageSize:completion");
130- (void)getConversationsFromServerWithCursor:(nullable NSString *)cursor pageSize:(UInt8)pageSize completion:(nonnull void (^)(AgoraChatCursorResult<AgoraChatConversation *> * _Nullable result, AgoraChatError * _Nullable error))completionBlock;
131
142- (void)getPinnedConversationsFromServerWithCursor:(nullable NSString *)cursor pageSize:(UInt8)limit completion:(nonnull void (^)(AgoraChatCursorResult<AgoraChatConversation *> * _Nullable result, AgoraChatError * _Nullable error))completionBlock;
143
154- (void)pinConversation:(nonnull NSString *)conversationId isPinned:(BOOL)isPinned completionBlock:(nullable void(^)(AgoraChatError * _Nullable error))completionBlock;
155
164- (AgoraChatConversation *_Nullable)getConversationWithConvId:(NSString * _Nullable)aConversationId;
165
178- (AgoraChatConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
179 type:(AgoraChatConversationType)aType
180 createIfNotExist:(BOOL)aIfCreate;
181
196- (AgoraChatConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
197 type:(AgoraChatConversationType)aType
198 createIfNotExist:(BOOL)aIfCreate isThread:(BOOL)isThread;
199
211- (void)deleteConversation:(NSString * _Nonnull)aConversationId
212 isDeleteMessages:(BOOL)aIsDeleteMessages
213 completion:(void (^_Nullable)(NSString * _Nullable aConversationId, AgoraChatError *_Nullable aError))aCompletionBlock;
214
227 - (void)deleteServerConversation:(NSString * _Nonnull)aConversationId
228 conversationType:(AgoraChatConversationType)aConversationType
229 isDeleteServerMessages:(BOOL)aIsDeleteServerMessages
230 completion:(void (^_Nullable)(NSString * _Nullable aConversationId, AgoraChatError * _Nullable aError))aCompletionBlock;
231
243- (void)deleteConversations:(NSArray<AgoraChatConversation *> * _Nullable)aConversations
244 isDeleteMessages:(BOOL)aIsDeleteMessages
245 completion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
246
255- (void)importConversations:(NSArray<AgoraChatConversation *> * _Nullable)aConversations
256 completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
257
258#pragma mark - Message
259
267- (AgoraChatMessage * _Nullable)getMessageWithMessageId:(NSString * _Nonnull)aMessageId;
268
279- (NSString * _Nullable)getMessageAttachmentPath:(NSString * _Nonnull)aConversationId;
280
289- (void)importMessages:(NSArray<AgoraChatMessage *> * _Nonnull)aMessages
290 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
291
304- (void)updateMessage:(AgoraChatMessage *_Nonnull)aMessage
305 completion:(void (^_Nullable)(AgoraChatMessage * _Nullable aMessage, AgoraChatError * _Nullable aError))aCompletionBlock;
317- (void)modifyMessage:(NSString *_Nonnull)messageId body:(AgoraChatMessageBody *_Nonnull)body completion:(void (^_Nonnull)(AgoraChatError * _Nullable error,AgoraChatMessage *_Nullable message))completionBlock;
318
330- (void)sendMessageReadAck:(NSString * _Nonnull)aMessageId
331 toUser:(NSString * _Nonnull)aUsername
332 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
333
334
347- (void)sendGroupMessageReadAck:(NSString * _Nonnull)aMessageId
348 toGroup:(NSString * _Nonnull)aGroupId
349 content:(NSString * _Nullable)aContent
350 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
351
368- (void)ackConversationRead:(NSString * _Nonnull)conversationId
369 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
370
381- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId
382 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
383
384
395- (void)sendMessage:(AgoraChatMessage *_Nonnull)aMessage
396 progress:(void (^_Nullable)(int progress))aProgressBlock
397 completion:(void (^_Nullable)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))aCompletionBlock;
398
407- (void)resendMessage:(AgoraChatMessage *_Nonnull)aMessage
408 progress:(void (^_Nullable)(int progress))aProgressBlock
409 completion:(void (^_Nullable)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))aCompletionBlock;
410
421- (void)downloadMessageThumbnail:(AgoraChatMessage *_Nonnull)aMessage
422 progress:(void (^_Nullable)(int progress))aProgressBlock
423 completion:(void (^_Nullable)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))aCompletionBlock;
424
437- (void)downloadMessageAttachment:(AgoraChatMessage *_Nonnull)aMessage
438 progress:(void (^_Nullable)(int progress))aProgressBlock
439 completion:(void (^_Nullable)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))aCompletionBlock;
440
450- (void)downloadAndParseCombineMessage:(AgoraChatMessage* _Nonnull)aMessage
451 completion:(void (^_Nullable)(NSArray<AgoraChatMessage *>*_Nullable messages, AgoraChatError *_Nullable error))aCompletionBlock;
452
466- (AgoraChatCursorResult<AgoraChatMessage*> *_Nullable)fetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
467 conversationType:(AgoraChatConversationType)aConversationType
468 startMessageId:(NSString *_Nullable)aStartMessageId
469 fetchDirection:(AgoraChatMessageFetchHistoryDirection)direction
470 pageSize:(int)aPageSize
471 error:(AgoraChatError **_Nullable)pError;
484- (AgoraChatCursorResult<AgoraChatMessage*> *_Nullable)fetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
485 conversationType:(AgoraChatConversationType)aConversationType
486 startMessageId:(NSString *_Nullable)aStartMessageId
487 pageSize:(int)aPageSize
488 error:(AgoraChatError **_Nullable)pError;
489
490
503- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
504 conversationType:(AgoraChatConversationType)aConversationType
505 startMessageId:(NSString *_Nullable)aStartMessageId
506 pageSize:(int)aPageSize
507 completion:(void (^_Nullable)(AgoraChatCursorResult<AgoraChatMessage*> *_Nullable aResult, AgoraChatError *_Nullable aError))aCompletionBlock;
521- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
522 conversationType:(AgoraChatConversationType)aConversationType
523 startMessageId:(NSString *_Nullable)aStartMessageId
524 fetchDirection:(AgoraChatMessageFetchHistoryDirection)direction
525 pageSize:(int)aPageSize
526 completion:(void (^_Nullable)(AgoraChatCursorResult<AgoraChatMessage*> *_Nullable aResult, AgoraChatError *_Nullable aError))aCompletionBlock;
527
528
529
530
545- (void)asyncFetchGroupMessageAcksFromServer:(NSString *_Nonnull)aMessageId
546 groupId:(NSString *_Nonnull)aGroupId
547 startGroupAckId:(NSString *_Nonnull)aGroupAckId
548 pageSize:(int)aPageSize
549 completion:(void (^_Nullable)(AgoraChatCursorResult<AgoraChatGroupMessageAck *> *_Nullable aResult, AgoraChatError *_Nullable error, int totalCount))aCompletionBlock;
550
562- (void)reportMessageWithId:(NSString *_Nonnull )aMessageId
563 tag:(NSString *_Nonnull)aTag
564 reason:(NSString *_Nonnull)aReason
565 completion:(void(^_Nullable)(AgoraChatError* _Nullable error))aCompletion;
566
575- (void)deleteMessagesBefore:(NSUInteger)aTimestamp
576 completion:(void(^)(AgoraChatError*error))aCompletion;
577
578
579
589- (void)removeMessagesFromServerWithConversation:(AgoraChatConversation *_Nonnull)conversation messageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
599- (void)removeMessagesFromServerWithConversation:(AgoraChatConversation *_Nonnull)conversation timeStamp:(NSTimeInterval)beforeTimeStamp completion:(void (^ _Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
600
601
610- (void)translateMessage:(AgoraChatMessage * _Nonnull)aMessage
611 targetLanguages:(NSArray<NSString*>* _Nonnull)aLanguages
612 completion:(void (^_Nullable)(AgoraChatMessage * _Nullable message, AgoraChatError * _Nullable error))aCompletionBlock;
613
621- (void)fetchSupportedLanguages:(void(^_Nullable)(NSArray<AgoraChatTranslateLanguage*>* _Nullable languages,AgoraChatError* _Nullable error))aCompletionBlock;
622
642- (NSArray<AgoraChatMessage *> * _Nullable)loadMessagesWithType:(AgoraChatMessageBodyType)aType
643 timestamp:(long long)aTimestamp
644 count:(int)aCount
645 fromUser:(NSString* _Nullable)aUsername
646 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
647
664- (void)loadMessagesWithType:(AgoraChatMessageBodyType)aType
665 timestamp:(long long)aTimestamp
666 count:(int)aCount
667 fromUser:(NSString*)aUsername
668 searchDirection:(AgoraChatMessageSearchDirection)aDirection
669 completion:(void (^)(NSArray<AgoraChatMessage *> *aMessages, AgoraChatError *aError))aCompletionBlock;
670
690- (NSArray<AgoraChatMessage *> *)loadMessagesWithKeyword:(NSString*)aKeywords
691 timestamp:(long long)aTimestamp
692 count:(int)aCount
693 fromUser:(NSString*)aSender
694 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
695
711- (void)loadMessagesWithKeyword:(NSString*)aKeywords
712 timestamp:(long long)aTimestamp
713 count:(int)aCount
714 fromUser:(NSString*)aSender
715 searchDirection:(AgoraChatMessageSearchDirection)aDirection
716 completion:(void (^)(NSArray<AgoraChatMessage *> *aMessages, AgoraChatError *aError))aCompletionBlock;
717
718NS_ASSUME_NONNULL_BEGIN
727- (void)addReaction:(NSString *)reaction toMessage:(NSString *)messageId completion:(nullable void(^)(AgoraChatError * _Nullable))completion;
728
737- (void)removeReaction:(NSString *)reaction fromMessage:(NSString *)messageId completion:(nullable void(^)(AgoraChatError * _Nullable))completion;
738
748- (void)getReactionList:(NSArray <NSString *>*)messageIds
749 groupId:(nullable NSString *)groupId
750 chatType:(AgoraChatType)chatType
751 completion:(void (^)(NSDictionary <NSString *, NSArray<AgoraChatMessageReaction *> *> *, AgoraChatError * _Nullable))completion;
752
763- (void)getReactionDetail:(NSString *)messageId
764 reaction:(NSString *)reaction
765 cursor:(nullable NSString *)cursor
766 pageSize:(uint64_t)pageSize
767 completion:(void (^)(AgoraChatMessageReaction *, NSString * _Nullable cursor, AgoraChatError * _Nullable))completion;
768
780- (void)fetchMessagesFromServerBy:(NSString* )conversationId
781 conversationType:(AgoraChatConversationType)type
782 cursor:(NSString* _Nullable)cursor
783 pageSize:(NSUInteger)pageSize
784 option:(AgoraChatFetchServerMessagesOption* _Nullable)option
785 completion:(void (^_Nullable)(AgoraChatCursorResult<AgoraChatMessage*>* _Nullable result, AgoraChatError* _Nullable aError))aCompletionBlock;
786NS_ASSUME_NONNULL_END
787
788@end
Definition: AgoraChatConversation.h:47
Definition: AgoraChatCursorResult.h:16
Definition: AgoraChatError.h:18
Definition: AgoraChatFetchServerMessagesOption.h:20
Definition: AgoraChatGroupMessageAck.h:18
Definition: AgoraChatMessageBody.h:33
Definition: AgoraChatMessage.h:61
Definition: AgoraChatMessageReaction.h:18
Definition: AgoraChatTranslateLanguage.h:17
Definition: AgoraChatManagerDelegate.h:22
Definition: IAgoraChatManager.h:50
NSArray< AgoraChatConversation * > *_Nullable getAllConversations()