AgoraChatSDK 1.2.0
Instance Methods | List of all members
<IAgoraChatManager> Protocol Reference

#import <IAgoraChatManager.h>

Inheritance diagram for <IAgoraChatManager>:

Instance Methods

(void) - addDelegate:delegateQueue:
 
(void) - removeDelegate:
 
(NSArray< AgoraChatConversation * > *_Nullable) - getAllConversations
 
(NSArray< AgoraChatConversation * > *_Nullable) - getAllConversations:
 
(void) - getConversationsFromServer:
 
(void) - getConversationsFromServerByPage:pageSize:completion:
 
(void) - getConversationsFromServerWithCursor:pageSize:completion:
 
(void) - getPinnedConversationsFromServerWithCursor:pageSize:completion:
 
(void) - pinConversation:isPinned:completionBlock:
 
(AgoraChatConversation *_Nullable) - getConversationWithConvId:
 
(AgoraChatConversation *_Nullable) - getConversation:type:createIfNotExist:
 
(AgoraChatConversation *_Nullable) - getConversation:type:createIfNotExist:isThread:
 
(void) - deleteConversation:isDeleteMessages:completion:
 
(void) - deleteServerConversation:conversationType:isDeleteServerMessages:completion:
 
(void) - deleteConversations:isDeleteMessages:completion:
 
(void) - importConversations:completion:
 
(AgoraChatMessage *_Nullable) - getMessageWithMessageId:
 
(NSString *_Nullable) - getMessageAttachmentPath:
 
(void) - importMessages:completion:
 
(void) - updateMessage:completion:
 
(void) - modifyMessage:body:completion:
 
(void) - sendMessageReadAck:toUser:completion:
 
(void) - sendGroupMessageReadAck:toGroup:content:completion:
 
(void) - ackConversationRead:completion:
 
(void) - recallMessageWithMessageId:completion:
 
(void) - sendMessage:progress:completion:
 
(void) - resendMessage:progress:completion:
 
(void) - downloadMessageThumbnail:progress:completion:
 
(void) - downloadMessageAttachment:progress:completion:
 
(void) - downloadAndParseCombineMessage:completion:
 
(AgoraChatCursorResult< AgoraChatMessage * > *_Nullable) - fetchHistoryMessagesFromServer:conversationType:startMessageId:fetchDirection:pageSize:error:
 
(AgoraChatCursorResult< AgoraChatMessage * > *_Nullable) - fetchHistoryMessagesFromServer:conversationType:startMessageId:pageSize:error:
 
(void) - asyncFetchHistoryMessagesFromServer:conversationType:startMessageId:pageSize:completion:
 
(void) - asyncFetchHistoryMessagesFromServer:conversationType:startMessageId:fetchDirection:pageSize:completion:
 
(void) - asyncFetchGroupMessageAcksFromServer:groupId:startGroupAckId:pageSize:completion:
 
(void) - reportMessageWithId:tag:reason:completion:
 
(void) - deleteMessagesBefore:completion:
 
(void) - removeMessagesFromServerWithConversation:messageIds:completion:
 
(void) - removeMessagesFromServerWithConversation:timeStamp:completion:
 
(void) - translateMessage:targetLanguages:completion:
 
(void) - fetchSupportedLanguages:
 
(NSArray< AgoraChatMessage * > *_Nullable) - loadMessagesWithType:timestamp:count:fromUser:searchDirection:
 
(void) - loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:
 
(NSArray< AgoraChatMessage * > *) - loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:
 
(void) - loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:completion:
 
(void) - addReaction:toMessage:completion:
 
(void) - removeReaction:fromMessage:completion:
 
(void) - getReactionList:groupId:chatType:completion:
 
(void) - getReactionDetail:reaction:cursor:pageSize:completion:
 
(void) - fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion:
 

Detailed Description

This protocol that defines the operations of chat.

Messages are loaded from the local database, not from the server.

Method Documentation

◆ ackConversationRead:completion:

- (void) ackConversationRead: (NSString *_Nonnull)  conversationId
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Sends the conversation read receipt to the server.

This method applies to one-to-one chats only.

This method call notifies the server to set the number of unread messages of the specified conversation as 0, and triggers the onConversationRead callback on the recipient's client.

To reduce the number of method calls, we recommend that you call this method when the user enters a conversation with many unread messages, and call sendMessageReadAck during a conversation to send the message read receipts.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ addDelegate:delegateQueue:

- (void) addDelegate: (id< AgoraChatManagerDelegate > _Nullable)  aDelegate
delegateQueue: (dispatch_queue_t _Nullable)  aQueue 
required

Adds a delegate.

Parameters
aDelegateThe object that implements the protocol.
aQueue(optional) The queue of calling delegate methods. If you want to run the app on the main thread, set this parameter as nil.

◆ addReaction:toMessage:completion:

- (void) addReaction: (NSString *)  reaction
toMessage: (NSString *)  messageId
completion: (nullable void(^)(AgoraChatError *_Nullable))  completion 
required

Adds a Reaction.

Parameters
reactionThe Reaction content.
messageIdThe message ID.
completionThe completion block which contains the error code and error information if the method fails.

◆ asyncFetchGroupMessageAcksFromServer:groupId:startGroupAckId:pageSize:completion:

- (void) asyncFetchGroupMessageAcksFromServer: (NSString *_Nonnull)  aMessageId
groupId: (NSString *_Nonnull)  aGroupId
startGroupAckId: (NSString *_Nonnull)  aGroupAckId
pageSize: (int)  aPageSize
completion: (void(^)(AgoraChatCursorResult< AgoraChatGroupMessageAck * > *_Nullable aResult, AgoraChatError *_Nullable error, int totalCount))  aCompletionBlock 
required

Gets the read receipts of a specified group message from the server.

By getting the read receipts of a group message, you can see how many group members have read this message.

This is an asynchronous method.

Parameters
aMessageIdThe message ID.
aGroupIdThe group ID.
aGroupAckIdThe ID of the read receipt to get from the server.
aPageSizeThe number of read receipts that you expect to get on each page.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ asyncFetchHistoryMessagesFromServer:conversationType:startMessageId:fetchDirection:pageSize:completion:

- (void) asyncFetchHistoryMessagesFromServer: (NSString *_Nonnull)  aConversationId
conversationType: (AgoraChatConversationType)  aConversationType
startMessageId: (NSString *_Nullable)  aStartMessageId
fetchDirection: (AgoraChatMessageFetchHistoryDirection)  direction
pageSize: (int)  aPageSize
completion: (void(^)(AgoraChatCursorResult< AgoraChatMessage * > *_Nullable aResult, AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Fetches conversation messages from server.

This is an asynchronous method.

Parameters
aConversationIdThe conversation ID.
aConversationTypeThe conversation type.
aStartMessageIdThe starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one.
directionThe message search direction. See AgoraChatMessageFetchHistoryDirection.
aPageSizeThe number of messages that you expect to get on each page. The value range is [1,50].
aCompletionBlockThe callback block, which contains the error message if the method fails.

◆ asyncFetchHistoryMessagesFromServer:conversationType:startMessageId:pageSize:completion:

- (void) asyncFetchHistoryMessagesFromServer: (NSString *_Nonnull)  aConversationId
conversationType: (AgoraChatConversationType)  aConversationType
startMessageId: (NSString *_Nullable)  aStartMessageId
pageSize: (int)  aPageSize
completion: (void(^)(AgoraChatCursorResult< AgoraChatMessage * > *_Nullable aResult, AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Gets messages in a conversation from the server.

This is an asynchronous method.

Parameters
aConversationIdThe conversation ID.
aConversationTypeThe conversation type.
aStartMessageIdThe starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one.
aPageSizeThe number of messages that you expect to get on each page.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ deleteConversation:isDeleteMessages:completion:

- (void) deleteConversation: (NSString *_Nonnull)  aConversationId
isDeleteMessages: (BOOL)  aIsDeleteMessages
completion: (void(^)(NSString *_Nullable aConversationId, AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Deletes a conversation from the local database.

Parameters
aConversationIdThe conversation ID.
aIsDeleteMessagesWhether to delete the messages in the conversation.
  • YES: Yes;
  • NO: No.
aCompletionBlockThe completion block, which contains the error message if the method call fails.

◆ deleteConversations:isDeleteMessages:completion:

- (void) deleteConversations: (NSArray< AgoraChatConversation * > *_Nullable)  aConversations
isDeleteMessages: (BOOL)  aIsDeleteMessages
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Deletes multiple conversations.

Parameters
aConversationsThe conversation list.
aIsDeleteMessagesWhether to delete the messages with the conversations.
  • YES: Yes;
  • NO: No.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ deleteMessagesBefore:completion:

- (void) deleteMessagesBefore: (NSUInteger)  aTimestamp
completion: (void(^)(AgoraChatError *error))  aCompletion 
required

Deletes local historical messages with a Unix timestamp before a specified one.

Parameters
aTimestampThe specified Unix timestamp in miliseconds. Messages with a Unix timestamp before the specified one will be deleted.
aCompletionThe completion block, which contains the error message if the method fails.

◆ deleteServerConversation:conversationType:isDeleteServerMessages:completion:

- (void) deleteServerConversation: (NSString *_Nonnull)  aConversationId
conversationType: (AgoraChatConversationType)  aConversationType
isDeleteServerMessages: (BOOL)  aIsDeleteServerMessages
completion: (void(^)(NSString *_Nullable aConversationId, AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Deletes a conversation from the server.

Parameters
aConversationIdThe conversation ID.
aConversationTypeThe conversation type.
aIsDeleteMessagesWhether to delete the related messages with the conversation.
  • YES: Yes;
  • NO: No.
aCompletionBlockThe completion block, which contains the error message if the method call fails.

◆ downloadAndParseCombineMessage:completion:

- (void) downloadAndParseCombineMessage: (AgoraChatMessage *_Nonnull)  aMessage
completion: (void(^)(NSArray< AgoraChatMessage * > *_Nullable messages, AgoraChatError *_Nullable error))  aCompletionBlock 
required

Download and parse the attachment in a combined message.

This is an asynchronous method.

Parameters
aMessageThe combined message object.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ downloadMessageAttachment:progress:completion:

- (void) downloadMessageAttachment: (AgoraChatMessage *_Nonnull)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))  aCompletionBlock 
required

Downloads message attachment (voice, video, image or file).

The SDK automatically downloads voice messages. If the automatic download fails, you can call this method to download voice messages manually.

This is an asynchronous method.

Parameters
aMessageThe message object.
aProgressBlockThe callback block of attachment download progress. The progress value range is [0,100].
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ downloadMessageThumbnail:progress:completion:

- (void) downloadMessageThumbnail: (AgoraChatMessage *_Nonnull)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))  aCompletionBlock 
required

Downloads the message thumbnail (the thumbnail of an image or the first frame of a video).

The SDK automatically downloads the thumbnail. If the auto-download fails, you can call this method to manually download the thumbnail.

Parameters
aMessageThe message object.
aProgressBlockThe callback block of attachment download progress. The progress value range is [0,100].
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ fetchHistoryMessagesFromServer:conversationType:startMessageId:fetchDirection:pageSize:error:

- (AgoraChatCursorResult< AgoraChatMessage * > *_Nullable) fetchHistoryMessagesFromServer: (NSString *_Nonnull)  aConversationId
conversationType: (AgoraChatConversationType)  aConversationType
startMessageId: (NSString *_Nullable)  aStartMessageId
fetchDirection: (AgoraChatMessageFetchHistoryDirection)  direction
pageSize: (int)  aPageSize
error: (AgoraChatError **_Nullable)  pError 
required

Gets messages in a conversation from the server.

Parameters
aConversationIdThe conversation ID.
aConversationTypeThe conversation type.
aStartMessageIdThe starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one.
directionThe message search direction. See AgoraChatMessageFetchHistoryDirection.
aPageSizeThe number of messages that you expect to get on each page.
pErrorThe error information if the method fails: Error.
Returns
The list of retrieved messages.

◆ fetchHistoryMessagesFromServer:conversationType:startMessageId:pageSize:error:

- (AgoraChatCursorResult< AgoraChatMessage * > *_Nullable) fetchHistoryMessagesFromServer: (NSString *_Nonnull)  aConversationId
conversationType: (AgoraChatConversationType)  aConversationType
startMessageId: (NSString *_Nullable)  aStartMessageId
pageSize: (int)  aPageSize
error: (AgoraChatError **_Nullable)  pError 
required

Gets messages in a conversation from the server.

Parameters
aConversationIdThe conversation ID.
aConversationTypeThe conversation type.
aStartMessageIdThe starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one.
aPageSizeThe number of messages that you expect to get on each page.
pErrorThe error information if the method fails: Error.
Returns
The list of retrieved messages.

◆ fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion:

- (void) fetchMessagesFromServerBy: (NSString *)  conversationId
conversationType: (AgoraChatConversationType)  type
cursor: (NSString *_Nullable)  cursor
pageSize: (NSUInteger)  pageSize
option: (AgoraChatFetchServerMessagesOption *_Nullable)  option
completion: (void(^)(AgoraChatCursorResult< AgoraChatMessage * > *_Nullable result, AgoraChatError *_Nullable aError))  aCompletionBlock 
required
Parameters
conversationIdThe conversation ID, which is the user ID of the peer user for one-to-one chat, but the group ID for group chat.
typeThe conversation type. You can set this parameter only to AgoraChatConversationTypeChat (one-to-one chat) or AgoraChatConversationTypeGroupChat (group chat).
cursorThe cursor position from which to start querying data.
pageSizeThe number of messages that you expect to get on each page. The value range is [1,50].
optionThe parameter configuration class for pulling historical messages from the server. See AgoraChatFetchServerMessagesOption.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ fetchSupportedLanguages:

- (void) fetchSupportedLanguages: (void(^)(NSArray< AgoraChatTranslateLanguage * > *_Nullable languages, AgoraChatError *_Nullable error))  aCompletionBlock
required

Gets all languages supported by the translation service.

Parameters
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ getAllConversations

- (NSArray< AgoraChatConversation * > *_Nullable) getAllConversations
required

Gets all local conversations.

The SDK loads the conversations from the memory first. If no conversation is found in the memory, the SDK loads from the local database.

Returns
The conversation list of the NSArray<AgoraChatConversation *> * type.

◆ getAllConversations:

- (NSArray< AgoraChatConversation * > *_Nullable) getAllConversations: (BOOL)  isSort
required

Gets all local conversations.

The SDK loads the conversations from the memory first. If there is no conversation is in the memory, the SDK loads from the local database.

Parameters
isSortWhether to sort the conversations.
  • YES: Yes. The SDK returns conversations in the descending order of the timestamp of the latest message in them, with the pinned ones at the top of the list and followed by the unpinned ones.
  • NO: No.
Returns
The conversation list of the NSArray<AgoraChatConversation *> * type.

◆ getConversation:type:createIfNotExist:

- (AgoraChatConversation *_Nullable) getConversation: (NSString *_Nonnull)  aConversationId
type: (AgoraChatConversationType)  aType
createIfNotExist: (BOOL)  aIfCreate 
required

Gets a conversation from the local database.

Parameters
aConversationIdThe conversation ID.
aTypeThe conversation type.
aIfCreateWhether to create the conversation if it does not exist:
  • YES: Yes;
  • NO: No.
Returns
The conversation object.

◆ getConversation:type:createIfNotExist:isThread:

- (AgoraChatConversation *_Nullable) getConversation: (NSString *_Nonnull)  aConversationId
type: (AgoraChatConversationType)  aType
createIfNotExist: (BOOL)  aIfCreate
isThread: (BOOL)  isThread 
required

Gets a conversation from the local database.

Parameters
aConversationIdThe conversation ID.
aTypeThe conversation type.
aIfCreateWhether to create the conversation if it does not exist.
  • YES: Yes;
  • NO: No.
isThreadWhether it is thread conversation. That is, whether the conversation is of the threadChat type.
  • YES: Yes;
  • NO: No.
Returns
The conversation object.

◆ getConversationsFromServer:

- (void) getConversationsFromServer: (4_0_0) 
("Use -IAgoraChatManager getConversationsFromServerWithCursor:pageSize:completion")  EM_DEPRECATED_IOS 
required

Gets all conversations from the server.

Parameters
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ getConversationsFromServerByPage:pageSize:completion:

- (void) getConversationsFromServerByPage: (NSUInteger)  pageNumber
pageSize: (NSUInteger)  pageSize
completion: (4_0_0) 
("Use -IAgoraChatManager getConversationsFromServerWithCursor:pageSize:completion")  EM_DEPRECATED_IOS 
required

Gets conversations from the server with pagination.

Parameters
pageNumberThe current page number, starting from 1.
pageSizeThe number of conversations that you expect to get on each page.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ getConversationsFromServerWithCursor:pageSize:completion:

- (void) getConversationsFromServerWithCursor: (nullable NSString *)  cursor
pageSize: (UInt8)  pageSize
completion: (nonnull void(^)(AgoraChatCursorResult< AgoraChatConversation * > *_Nullable result, AgoraChatError *_Nullable error))  completionBlock 
required

Get the list of conversations from the server with pagination.

The SDK retrieves the list of conversations in the reverse chronological order of their active time (the timestamp of the last message).

If there is no message in the conversation, the SDK retrieves the list of conversations in the reverse chronological order of their creation time.

Parameters
cursorThe position from which to start getting data. If you pass in nil or @"", the SDK retrieves conversations from the latest active one.
pageSizeThe number of conversations that you expect to get on each page. The value range is [1,50].
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ getConversationWithConvId:

- (AgoraChatConversation *_Nullable) getConversationWithConvId: (NSString *_Nullable)  aConversationId
required

Gets a conversation from the local database.

Parameters
aConversationIdThe conversation ID.
Returns
The conversation object.

◆ getMessageAttachmentPath:

- (NSString *_Nullable) getMessageAttachmentPath: (NSString *_Nonnull)  aConversationId
required

Gets the local path of message attachments in a conversation.

When a conversation is deleted, the message attachments in the conversation will also be deleted.

Parameters
aConversationIdThe conversation ID.
Returns
The attachment path.

◆ getMessageWithMessageId:

- (AgoraChatMessage *_Nullable) getMessageWithMessageId: (NSString *_Nonnull)  aMessageId
required

Gets the specified message.

Parameters
aMessageIdThe message ID.
Returns
AgoraChatMessage The message content.

◆ getPinnedConversationsFromServerWithCursor:pageSize:completion:

- (void) getPinnedConversationsFromServerWithCursor: (nullable NSString *)  cursor
pageSize: (UInt8)  limit
completion: (nonnull void(^)(AgoraChatCursorResult< AgoraChatConversation * > *_Nullable result, AgoraChatError *_Nullable error))  completionBlock 
required

Gets the list of pinned conversations from the server with pagination.

The SDK returns the pinned conversations in the reverse chronological order of their pinning.

Parameters
cursorThe position from which to start getting data. If you pass in nil or @"", the SDK retrieves conversations from the latest pinned one.
pageSizeThe number of conversations that you expect to get on each page. The value range is [1,50].
completionBlockThe completion block, which contains the error message if the method fails.

◆ getReactionDetail:reaction:cursor:pageSize:completion:

- (void) getReactionDetail: (NSString *)  messageId
reaction: (NSString *)  reaction
cursor: (nullable NSString *)  cursor
pageSize: (uint64_t)  pageSize
completion: (void(^)(AgoraChatMessageReaction *, NSString *_Nullable cursor, AgoraChatError *_Nullable))  completion 
required

Uses the pagination to get the Reaction detail list of a chat group message.

Parameters
messageIdThe message ID.
reactionThe Reaction content.
cursorThe position from which to start getting data. If it is set to nil or @"" at the first call, the SDK retrieves Reactions in the chronological order of their creation time.
pageSizeThe number of Reactions that you expect to get on each page. The value range is [1,100].
completionThe completion block, which contains the Reaction list and the cursor for the next query. When the cursor is nil, all data is already fetched.

◆ getReactionList:groupId:chatType:completion:

- (void) getReactionList: (NSArray< NSString * > *)  messageIds
groupId: (nullable NSString *)  groupId
chatType: (AgoraChatType)  chatType
completion: (void(^)(NSDictionary< NSString *, NSArray< AgoraChatMessageReaction * > * > *, AgoraChatError *_Nullable))  completion 
required

Gets the Reaction list.

Parameters
messageIdThe message ID.
groupIdThe group ID. This parameter is invalid only for group chat.
chatTypeThe chat type. Only one-to-one chat (AgoraChatTypeChat and group chat (AgoraChatTypeGroupChat) are allowed.
completionThe completion block which contains the error code and error information if the method fails.

◆ importConversations:completion:

- (void) importConversations: (NSArray< AgoraChatConversation * > *_Nullable)  aConversations
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Imports multiple conversations to the local database.

Parameters
aConversationsThe conversation list.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ importMessages:completion:

- (void) importMessages: (NSArray< AgoraChatMessage * > *_Nonnull)  aMessages
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Imports multiple messages to the local database.

Parameters
aMessagesThe message list.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:

- (NSArray< AgoraChatMessage * > *) loadMessagesWithKeyword: (NSString *)  aKeywords
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aSender
searchDirection: (AgoraChatMessageSearchDirection)  aDirection 
required

Loads messages with the specified keyword from the local database.

This method returns messages in chronological order.

This is a synchronous method and blocks the current thread.

Parameters
aKeywordThe keyword for message search. If you set this parameter as nil, the SDK ignores this parameter when retrieving messages.
aTimestampThe message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest.
aCountThe number of messages to load. If you set this parameter less than 1, the SDK gets one message from the local database.
aSenderThe message sender. If you set this parameter as nil, the SDK ignores this parameter when retrieving messages.
aDirectionThe message search direction. See AgoraChatMessageSearchDirection.
  • UP: The SDK retrieves messages in the descending order of the timestamp included in them.
  • DOWN:The SDK retrieves messages in the ascending order of the timestamp included in them.
Returns
The list of retrieved messages. The message list is of the array type. For elements in the array, see AgoraChatMessage.

◆ loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:completion:

- (void) loadMessagesWithKeyword: (NSString *)  aKeywords
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aSender
searchDirection: (AgoraChatMessageSearchDirection)  aDirection
completion: (void(^)(NSArray< AgoraChatMessage * > *aMessages, AgoraChatError *aError))  aCompletionBlock 
required

Loads messages with the specified keyword from the local database.

This method returns messages in chronological order.

Parameters
aKeywordThe keyword for message search. If you set this parameter as nil, the SDK ignores this parameter when retrieving messages.
aTimestampThe message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest.
aCountThe number of messages to load. If you set this parameter less than 1, the SDK gets one message from the local database.
aSenderThe sender of the message. If you set this parameter as nil, the SDK ignores this parameter when retrieving messages.
aDirectionThe message search direction. See AgoraChatMessageSearchDirection.
  • UP: The SDK retrieves messages in the descending order of the timestamp included in them.
  • DOWN:The SDK retrieves messages in the ascending order of the timestamp included in them.
aCompletionBlockThe completion block which contains the error code and error information if the method fails.

◆ loadMessagesWithType:timestamp:count:fromUser:searchDirection:

- (NSArray< AgoraChatMessage * > *_Nullable) loadMessagesWithType: (AgoraChatMessageBodyType)  aType
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *_Nullable)  aUsername
searchDirection: (AgoraChatMessageSearchDirection)  aDirection 
required

Loads messages with the specified keyword from the local database.

This method returns messages in chronological order.

This is a synchronous method and blocks the current thread.

Parameters
aTypeThe message type to load.
aTimestampThe message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest one.
aCountThe number of messages to load. If you set this parameter to a value less than 1, the SDK gets one message from the local database.
aUsernameThe message sender. It is optional. If you set this parameter as nil, the SDK gets messages while ignoring this parameter.
aDirectionThe message search direction. See AgoraChatMessageSearchDirection.
  • UP: The SDK retrieves messages in the descending order of the timestamp included in them.
  • DOWN:The SDK retrieves messages in the ascending order of the timestamp included in them.
Returns
The list of retrieved messages. The message list is of the array type. For elements in the array, see AgoraChatMessage.

◆ loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:

- (void) loadMessagesWithType: (AgoraChatMessageBodyType)  aType
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aUsername
searchDirection: (AgoraChatMessageSearchDirection)  aDirection
completion: (void(^)(NSArray< AgoraChatMessage * > *aMessages, AgoraChatError *aError))  aCompletionBlock 
required

Loads messages with the specified keyword from the local database.

This method returns messages in chronological order.

Parameters
aTypeThe message type to load.
aTimestampThe message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest one.
aCountThe number of messages to load. If you set this parameter to a value less than 1, the SDK gets one message from the local database.
aUsernameThe message sender. It is optional. If you set this parameter as nil, the SDK ignores this parameter when retrieving messages.
aDirectionThe message search direction. See AgoraChatMessageSearchDirection.
  • UP: The SDK retrieves messages in the descending order of the timestamp included in them.
  • DOWN:The SDK retrieves messages in the ascending order of the timestamp included in them.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ modifyMessage:body:completion:

- (void) modifyMessage: (NSString *_Nonnull)  messageId
body: (AgoraChatMessageBody *_Nonnull)  body
completion: (void(^)(AgoraChatError *_Nullable error, AgoraChatMessage *_Nullable message))  completionBlock 
required

Modifies a local message or a message at the server side.

You can call this method to only modify a text message in one-to-one chats or group chats, but not in chat rooms.

Parameters
messageThe ID of the message to modify.
bodyThe modified message body(AgoraChatTextMessageBody).
completionBlockThe completion block, which contains the error message if the method fails.

◆ pinConversation:isPinned:completionBlock:

- (void) pinConversation: (nonnull NSString *)  conversationId
isPinned: (BOOL)  isPinned
completionBlock: (nullable void(^)(AgoraChatError *_Nullable error))  completionBlock 
required

Sets whether to pin a conversation.

Parameters
conversationIdThe conversation ID.
isPinnedWhether to pin a conversation:
  • true:Yes.
    • false: No. The conversation is unpinned.
completionBlockThe completion block, which contains the error message if the method fails.

◆ recallMessageWithMessageId:completion:

- (void) recallMessageWithMessageId: (NSString *_Nonnull)  aMessageId
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Recalls a message.

This is an asynchronous method.

Parameters
aMessageIdThe message ID
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ removeDelegate:

- (void) removeDelegate: (id< AgoraChatManagerDelegate > _Nonnull)  aDelegate
required

Removes a delegate.

Parameters
aDelegateThe delegate to be removed.

◆ removeMessagesFromServerWithConversation:messageIds:completion:

- (void) removeMessagesFromServerWithConversation: (AgoraChatConversation *_Nonnull)  conversation
messageIds: (NSArray< __kindof NSString * > *_Nonnull)  messageIds
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Removes messages in a conversation (from both local storage and the server).

Parameters
conversationThe AgoraChatConversation object.
messageIdsA string array of message IDs to delete.
completionThe completion block, which contains the error message if the method fails.

◆ removeMessagesFromServerWithConversation:timeStamp:completion:

- (void) removeMessagesFromServerWithConversation: (AgoraChatConversation *_Nonnull)  conversation
timeStamp: (NSTimeInterval)  beforeTimeStamp
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Removes messages in a conversation (from both local storage and the server).

Parameters
conversationThe AgoraChatConversation object.
messageIdsThe specified Unix timestamp in miliseconds. Messages with a timestamp before the specified one will be removed from the conversation.
completionThe completion block, which contains the error message if the method fails.

◆ removeReaction:fromMessage:completion:

- (void) removeReaction: (NSString *)  reaction
fromMessage: (NSString *)  messageId
completion: (nullable void(^)(AgoraChatError *_Nullable))  completion 
required

Removes a Reaction.

Parameters
reactionThe Reaction content.
messageIdThe message ID.
completionThe completion block which contains the error code and error information if the method fails.

◆ reportMessageWithId:tag:reason:completion:

- (void) reportMessageWithId: (NSString *_Nonnull)  aMessageId
tag: (NSString *_Nonnull)  aTag
reason: (NSString *_Nonnull)  aReason
completion: (void(^)(AgoraChatError *_Nullable error))  aCompletion 
required

Reports an inappropriate message.

This is an asynchronous method.

Parameters
aMessageIdThe ID of the inappropriate message.
aTagThe tag of the illegal message. You need to type a custom tag, like porn or ad. This parameter corresponds to the "Label" field on the message reporting history page of the console.
aReasonhe reporting reason. You need to type a specific reason. This parameter corresponds to the "Reason" field on the message reporting history page of the console.
aCompletionThe completion block, which contains the error message if the method fails.

◆ resendMessage:progress:completion:

- (void) resendMessage: (AgoraChatMessage *_Nonnull)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))  aCompletionBlock 
required

Resends a message.

Parameters
aMessageThe message object.
aProgressBlockThe callback block of attachment upload progress. The progress value range is [0,100].
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ sendGroupMessageReadAck:toGroup:content:completion:

- (void) sendGroupMessageReadAck: (NSString *_Nonnull)  aMessageId
toGroup: (NSString *_Nonnull)  aGroupId
content: (NSString *_Nullable)  aContent
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Sends the read receipt for a group message.

This is an asynchronous method.

Parameters
aMessageIdThe message ID.
aGroupIdThe group ID.
aContentThe message content.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ sendMessage:progress:completion:

- (void) sendMessage: (AgoraChatMessage *_Nonnull)  aMessage
progress: (void(^)(int progress))  aProgressBlock
completion: (void(^)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))  aCompletionBlock 
required

Sends a message.

This is an asynchronous method.

Parameters
aMessageThe message instance.
aProgressBlockThe callback block of attachment upload progress. The progress value range is [0,100].
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ sendMessageReadAck:toUser:completion:

- (void) sendMessageReadAck: (NSString *_Nonnull)  aMessageId
toUser: (NSString *_Nonnull)  aUsername
completion: (void(^)(AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Sends the read receipt for a message.

This is an asynchronous method.

Parameters
aMessageIdThe message ID.
aUsernameThe user ID of the recipient of the read receipt.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ translateMessage:targetLanguages:completion:

- (void) translateMessage: (AgoraChatMessage *_Nonnull)  aMessage
targetLanguages: (NSArray< NSString * > *_Nonnull)  aLanguages
completion: (void(^)(AgoraChatMessage *_Nullable message, AgoraChatError *_Nullable error))  aCompletionBlock 
required

Translates a message.

Parameters
aMessageThe message object.
aLanguagesThe list of target language codes.
aCompletionBlockThe completion block, which contains the error message if the method fails.

◆ updateMessage:completion:

- (void) updateMessage: (AgoraChatMessage *_Nonnull)  aMessage
completion: (void(^)(AgoraChatMessage *_Nullable aMessage, AgoraChatError *_Nullable aError))  aCompletionBlock 
required

Updates a message in the local database.

This method updates the message in both the memory and the local database at the same time.

The message ID cannot be updated.

Parameters
aMessageThe message instance.
aCompletionBlockThe completion block, which contains the error message if the method fails.

The documentation for this protocol was generated from the following file: