AgoraChatSDK 1.3.1
|
#import <IAgoraChatManager.h>
This protocol that defines the operations of chat.
Messages are loaded from the local database, not from the server.
|
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.
conversationId | The conversation ID. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Marks conversations.
This method marks conversations both locally and on the server.
conversationIds | The list of conversation IDs. |
mark | The mark to add for the conversations. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Adds a delegate.
aDelegate | The 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. |
|
required |
Adds a Reaction.
reaction | The Reaction content. |
messageId | The message ID. |
completion | The completion block which contains the error code and error information if the method fails. |
|
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.
aMessageId | The message ID. |
aGroupId | The group ID. |
aGroupAckId | The ID of the read receipt to get from the server. |
aPageSize | The number of read receipts that you expect to get on each page. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Fetches conversation messages from server.
This is an asynchronous method.
aConversationId | The conversation ID. |
aConversationType | The conversation type. |
aStartMessageId | The starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one. |
direction | The message search direction. See AgoraChatMessageFetchHistoryDirection . |
aPageSize | The number of messages that you expect to get on each page. The value range is [1,50]. |
aCompletionBlock | The callback block, which contains the error message if the method fails. |
|
required |
Gets messages in a conversation from the server.
This is an asynchronous method.
aConversationId | The conversation ID. |
aConversationType | The conversation type. |
aStartMessageId | The starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one. |
aPageSize | The number of messages that you expect to get on each page. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Clear all conversations in memory to release memory.
|
required |
Clears all conversations and all messages in them.
This is an asynchronous method.
clearSeverData | Whether to clear all conversations and all messages in them on the server.
|
aCompletionBlock | The completion callback, which contains the description of the cause to the failure. |
|
required |
Deletes a conversation from the local database.
aConversationId | The conversation ID. |
aIsDeleteMessages | Whether to delete the messages in the conversation.
|
aCompletionBlock | The completion block, which contains the error message if the method call fails. |
|
required |
Deletes multiple conversations.
aConversations | The conversation list. |
aIsDeleteMessages | Whether to delete the messages with the conversations.
|
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Deletes local historical messages with a Unix timestamp before a specified one.After setting the autoLoadConversations
attribute in AgoraChatOptions
to false
, the filtered session pull messages will not be read accurately.
aTimestamp | The specified Unix timestamp in miliseconds. Messages with a Unix timestamp before the specified one will be deleted. |
aCompletion | The completion block, which contains the error message if the method fails. |
|
required |
Deletes a conversation from the server.
aConversationId | The conversation ID. |
aConversationType | The conversation type. |
aIsDeleteMessages | Whether to delete the related messages with the conversation.
|
aCompletionBlock | The completion block, which contains the error message if the method call fails. |
|
required |
Download and parse the attachment in a combined message.
This is an asynchronous method.
aMessage | The combined message object. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
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.
aMessage | The message object. |
aProgressBlock | The callback block of attachment download progress. The progress value range is [0,100]. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
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.
aMessage | The message object. |
aProgressBlock | The callback block of attachment download progress. The progress value range is [0,100]. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets messages in a conversation from the server.
aConversationId | The conversation ID. |
aConversationType | The conversation type. |
aStartMessageId | The starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one. |
direction | The message search direction. See AgoraChatMessageFetchHistoryDirection . |
aPageSize | The number of messages that you expect to get on each page. |
pError | The error information if the method fails: Error. |
|
required |
Gets messages in a conversation from the server.
aConversationId | The conversation ID. |
aConversationType | The conversation type. |
aStartMessageId | The starting message ID for query. If you set this parameter as nil or "", the SDK gets messages from the latest one. |
aPageSize | The number of messages that you expect to get on each page. |
pError | The error information if the method fails: Error. |
|
required |
Get the historical messages of the specified session from the server page according to the message pull parameter configuration interface (AgoraChatFetchServerMessagesOption
). When the number of returned messages is less than the expected number of messages, it means that the server has no more historical messages.
conversationId | The conversation ID.
|
type | The conversation type. |
cursor | The cursor position from which to start querying data. |
pageSize | The number of messages that you expect to get on each page. The value range is [1,50]. |
option | The parameter configuration class for pulling historical messages from the server. See AgoraChatFetchServerMessagesOption . |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets all languages supported by the translation service.
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets local conversations by filter.
The SDK loads conversations from the local database by the specified filter conditions.
Ensure that you call this method upon login success.
cleanMemoryCache | Whether to clear cached conversations in memory. |
filter | The filter. The return value YES indicates that the conversation is returned and false indicates that the conversation is not returned. |
|
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.
|
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.
isSort | Whether to sort the conversations.
|
|
required |
Gets a conversation from the local database.
aConversationId | The conversation ID. |
aType | The conversation type. |
aIfCreate | Whether to create the conversation if it does not exist:
|
|
required |
Gets a conversation from the local database.
aConversationId | The conversation ID. |
aType | The conversation type. |
aIfCreate | Whether to create the conversation if it does not exist.
|
isThread | Whether it is thread conversation. That is, whether the conversation is of the threadChat type.
|
|
required |
Gets all conversations from the server.
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets conversations from the server with pagination.
pageNumber | The current page number, starting from 1. |
pageSize | The number of conversations that you expect to get on each page. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets the conversations from the server with pagination according to the conversation filter class.
cursor | The position from which to start getting data. If you pass in nil or @"" , the SDK retrieves conversations from the latest marked one. |
filter | The conversation filter options: conversation mark and the number of conversations to retrieve on each page. |
aCompletionBlock | The completion block, which contains the conversation list and the cursor for the next query. When the cursor is empty, all data is already retrieved. |
|
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.
cursor | The position from which to start getting data. If you pass in nil or @"" , the SDK retrieves conversations from the latest active one. |
pageSize | The number of conversations that you expect to get on each page. The value range is [1,50]. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets a conversation from the local database.
aConversationId | The conversation ID. |
|
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.
aConversationId | The conversation ID. |
|
required |
Get the message count from db.
completion | The completion block, which contains the number of message count in db. |
|
required |
Gets the specified message.
aMessageId | The message ID. |
|
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.
cursor | The position from which to start getting data. If you pass in nil or @"" , the SDK retrieves conversations from the latest pinned one. |
pageSize | The number of conversations that you expect to get on each page. The value range is [1,50]. |
completionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Gets the list of pinned messages in a conversation.
conversationId | The conversation ID. |
aCompletionBlock | The completion block, which contains the list of pinned messages if the call succeeds, or contains the error message if the method fails. |
|
required |
Uses the pagination to get the Reaction detail list of a chat group message.
messageId | The message ID. |
reaction | The Reaction content. |
cursor | The 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. |
pageSize | The number of Reactions that you expect to get on each page. The value range is [1,100]. |
completion | The completion block, which contains the Reaction list and the cursor for the next query. When the cursor is nil , all data is already fetched. |
|
required |
Gets the Reaction list.
messageId | The message ID. |
groupId | The group ID. This parameter is invalid only for group chat. |
chatType | The chat type. Only one-to-one chat (AgoraChatTypeChat and group chat (AgoraChatTypeGroupChat ) are allowed. |
completion | The completion block which contains the error code and error information if the method fails. |
|
required |
Imports multiple conversations to the local database.
aConversations | The conversation list. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Imports multiple messages to the local database.
aMessages | The message list. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
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.
aKeyword | The keyword for message search. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aTimestamp | The message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest. |
aCount | The number of messages to load. If you set this parameter less than 1, the SDK gets one message from the local database. |
aSender | The message sender. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aDirection | The message search direction. See AgoraChatMessageSearchDirection .
|
AgoraChatMessage
.
|
required |
Loads messages with the specified keyword from the local database.
This method returns messages in chronological order.
aKeyword | The keyword for message search. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aTimestamp | The message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest. |
aCount | The number of messages to load. If you set this parameter less than 1, the SDK gets one message from the local database. |
aSender | The sender of the message. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aDirection | The message search direction. See AgoraChatMessageSearchDirection .
|
aCompletionBlock | The completion block which contains the error code and error information if the method fails. |
|
required |
Loads messages with the specified keyword from the local database.
The SDK returns messages in the chronological order.
aKeyword | The keyword for message search. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aTimestamp | The Unix timestamp threshold for message search. The unit is millisecond. If you set this parameter as a negative value, the SDK loads messages from the latest one. |
aCount | The number of messages to load. If you set this parameter to 0 or less, the SDK gets one message from the local database. |
aSender | The sender of the message. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aDirection | The message search direction. See AgoraChatMessageSearchDirection .
|
aScope | The message search scope. See AgoraChatMessageSearchScope . |
aCompletionBlock | The completion block which contains the error code and error information if the method fails. |
|
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.
aType | The message type to load. |
aTimestamp | The message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest one. |
aCount | The 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. |
aUsername | The message sender. It is optional. If you set this parameter as nil , the SDK gets messages while ignoring this parameter. |
aDirection | The message search direction. See AgoraChatMessageSearchDirection .
|
AgoraChatMessage
.
|
required |
Loads messages with the specified keyword from the local database.
This method returns messages in chronological order.
aType | The message type to load. |
aTimestamp | The message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest one. |
aCount | The 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. |
aUsername | The message sender. It is optional. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aDirection | The message search direction. See AgoraChatMessageSearchDirection .
|
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Marks all conversations as read.
This method works only for local conversations.
|
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.
message | The ID of the message to modify. |
body | The modified message body(AgoraChatTextMessageBody). |
completionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Sets whether to pin a conversation.
conversationId | The conversation ID. |
isPinned | Whether to pin a conversation:
|
completionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Pins a message.
messageId | The ID of the message to be pinned. |
aCompletionBlock | The completion block, which contains the pinned message object if the call succeeds, or contains the error message if the method fails. |
|
required |
Recalls a message.
This is an asynchronous method.
aMessageId | The message ID |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Recalls a message.
This is an asynchronous method.
aMessageId | The ID of the message to recall. |
ext | The information to be transparently transmitted during message recall. The information can be a string or a JSONString. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Unmarks conversations.
This method unmarks conversations both locally and on the server.
conversationIds | The list of conversation IDs. |
mark | The conversation mark to remove. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Removes a delegate.
aDelegate | The delegate to be removed. |
|
required |
Removes messages in a conversation (from both local storage and the server).
conversation | The AgoraChatConversation object. |
messageIds | A string array of message IDs to delete. |
completion | The completion block, which contains the error message if the method fails. |
|
required |
Removes messages in a conversation (from both local storage and the server).
conversation | The AgoraChatConversation object. |
beforeTimeStamp | The specified Unix timestamp in miliseconds. Messages with a timestamp before the specified one will be removed from the conversation. |
completion | The completion block, which contains the error message if the method fails. |
|
required |
Removes a Reaction.
reaction | The Reaction content. |
messageId | The message ID. |
completion | The completion block which contains the error code and error information if the method fails. |
|
required |
Reports an inappropriate message.
This is an asynchronous method.
aMessageId | The ID of the inappropriate message. |
aTag | The 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. |
aReason | he 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. |
aCompletion | The completion block, which contains the error message if the method fails. |
|
required |
Resends a message.
aMessage | The message object. |
aProgressBlock | The callback block of attachment upload progress. The progress value range is [0,100]. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Loads messages with the specified keyword from the local database.
This method returns messages in chronological order.
aTypes | The message types to load. Types include txt (text message), img (image message), loc (location message), audio (audio message), video (video message), file (file message), and cmd (command message). AgoraChatMessageBodyType |
aTimestamp | The message timestamp threshold for loading. If you set this parameter as a negative value, the SDK loads messages from the latest one. |
aCount | The 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. |
aUsername | The message sender. It is optional. If you set this parameter as nil , the SDK ignores this parameter when retrieving messages. |
aDirection | The message search direction. See AgoraChatMessageSearchDirection .
|
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Sends the read receipt for a group message.
This is an asynchronous method.
aMessageId | The message ID. |
aGroupId | The group ID. |
aContent | The message content. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Sends a message.
This is an asynchronous method.
aMessage | The message instance. |
aProgressBlock | The callback block of attachment upload progress. The progress value range is [0,100]. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Sends the read receipt for a message.
This is an asynchronous method.
aMessageId | The message ID. |
aUsername | The user ID of the recipient of the read receipt. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Translates a message.
aMessage | The message object. |
aLanguages | The list of target language codes. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
|
required |
Unpins a message.
messageId | The ID of the message to be unpinned. |
aCompletionBlock | The completion block, which contains the unpinned message object if the call succeeds, or contains the error message if the method fails. |
|
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.
aMessage | The message instance. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |