Chat SDK for Unity and Windows v1.3.0
|
Public Member Functions | |
bool | DeleteConversation (string conversationId, bool deleteMessages=true) |
void | DownloadAttachment (string messageId, CallBack callback=null) |
void | DownloadThumbnail (string messageId, CallBack callback=null) |
void | FetchHistoryMessagesFromServer (string conversationId, ConversationType type=ConversationType.Chat, string startMessageId=null, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< CursorResult< Message > > callback=null) |
void | FetchHistoryMessagesFromServerBy (string conversationId, ConversationType type=ConversationType.Chat, string cursor=null, int pageSize=10, FetchServerMessagesOption option=null, ValueCallBack< CursorResult< Message > > callback=null) |
Conversation | GetConversation (string conversationId, ConversationType type=ConversationType.Chat, bool createIfNeed=true) |
Conversation | GetThreadConversation (string threadId) |
void | GetConversationsFromServer (ValueCallBack< List< Conversation > > callback=null) |
void | GetConversationsFromServerWithCursor (bool pinOnly, string cursor="", int limit=20, ValueCallBack< CursorResult< Conversation > > callback=null) |
void | GetConversationsFromServerWithCursor (MarkType mark, string cursor="", int limit=20, ValueCallBack< CursorResult< Conversation > > callback=null) |
int | GetUnreadMessageCount () |
void | ImportMessages (List< Message > messages, CallBack callback=null) |
List< Conversation > | LoadAllConversations () |
Message | LoadMessage (string messageId) |
bool | MarkAllConversationsAsRead () |
void | RecallMessage (string messageId, CallBack callback=null) |
Message | ResendMessage (string messageId, CallBack callback=null) |
void | SearchMsgFromDB (string keywords, long timestamp=0, int maxCount=20, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
void | SearchMsgFromDB (string keywords, long timestamp=0, int maxCount=20, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP, MessageSearchScope scope=MessageSearchScope.CONTENT, ValueCallBack< List< Message > > callback=null) |
void | SendConversationReadAck (string conversationId, CallBack callback=null) |
void | SendMessage (ref Message message, CallBack callback=null) |
void | SendMessageReadAck (string messageId, CallBack callback=null) |
void | SendReadAckForGroupMessage (string messageId, string ackContent, CallBack callback=null) |
bool | UpdateMessage (Message message) |
void | ModifyMessage (string messageId, MessageBody.TextBody body, ValueCallBack< Message > callback=null) |
void | RemoveMessagesBeforeTimestamp (long timeStamp, CallBack callback=null) |
void | DeleteConversationFromServer (string conversationId, ConversationType conversationType, bool isDeleteServerMessages, CallBack callback=null) |
void | FetchSupportLanguages (ValueCallBack< List< SupportLanguage > > callback=null) |
void | TranslateMessage (Message message, List< string > targetLanguages, ValueCallBack< Message > callback=null) |
void | FetchGroupReadAcks (string messageId, string groupId, int pageSize=20, string startAckId=null, ValueCallBack< CursorResult< GroupReadAck > > callback=null) |
void | ReportMessage (string messageId, string tag, string reason, CallBack callback=null) |
void | AddReaction (string messageId, string reaction, CallBack callback=null) |
void | RemoveReaction (string messageId, string reaction, CallBack callback=null) |
void | GetReactionList (List< string > messageIdList, MessageType chatType, string groupId, ValueCallBack< Dictionary< string, List< MessageReaction > > > callback=null) |
void | GetReactionDetail (string messageId, string reaction, string cursor=null, int pageSize=20, ValueCallBack< CursorResult< MessageReaction > > callback=null) |
void | GetConversationsFromServerWithPage (int pageNum, int pageSize, ValueCallBack< List< Conversation > > callback=null) |
void | RemoveMessagesFromServer (string conversationId, ConversationType conversationType, List< string > messageIdList, CallBack callback=null) |
void | RemoveMessagesFromServer (string conversationId, ConversationType conversationType, long timeStamp, CallBack callback=null) |
void | PinConversation (string conversationId, bool isPinned, CallBack callback=null) |
void | FetchCombineMessageDetail (Message msg, ValueCallBack< List< Message > > callback=null) |
void | MarkConversations (List< string > conversationIds, bool isMarked, MarkType mark, CallBack callback=null) |
void | DeleteAllMessagesAndConversations (bool clearServerData, CallBack callback=null) |
void | PinMessage (string messageId, bool isPinned, CallBack callback=null) |
void | GetPinnedMessagesFromServer (string conversationId, ValueCallBack< List< Message > > callback=null) |
void | AddChatManagerDelegate (IChatManagerDelegate chatManagerDelegate) |
void | RemoveChatManagerDelegate (IChatManagerDelegate chatManagerDelegate) |
bool AgoraChat.ChatManager.DeleteConversation | ( | string | conversationId, |
bool | deleteMessages = true |
||
) |
Deletes a conversation from the local database.
If you set deleteMessages
to true
, local historical messages will be deleted with the conversation.
conversationId | The conversation ID. |
deleteMessages | Whether to delete local historical messages with the conversation.
|
true
: Yes.false
: No. void AgoraChat.ChatManager.DownloadAttachment | ( | string | messageId, |
CallBack | callback = null |
||
) |
Downloads the message attachment.
You can also call this method if the attachment fails to be downloaded automatically.
messageId | The ID of the message with the attachment to be downloaded. |
callback | The download status callback. See CallBack . |
void AgoraChat.ChatManager.DownloadThumbnail | ( | string | messageId, |
CallBack | callback = null |
||
) |
Downloads the message thumbnail.
You can also call this method if the message thumbnail fails to be downloaded automatically.
messageId | The ID of the message with the thumbnail to be downloaded. |
callback | The download status callback. See CallBack . |
void AgoraChat.ChatManager.FetchHistoryMessagesFromServer | ( | string | conversationId, |
ConversationType | type = ConversationType.Chat , |
||
string | startMessageId = null , |
||
int | count = 20 , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP , |
||
ValueCallBack< CursorResult< Message > > | callback = null |
||
) |
Gets historical messages of the conversation from the server.
Historical messages of a conversation can also be obtained with pagination.
This is an asynchronous method.
conversationId | The conversation ID. |
type | The conversation type. See ConversationType . |
startMessageId | The starting message ID for the query. If null is passed, the SDK gets messages in the reverse chronological order of when the server received the messages. |
count | The number of messages that you expect to get on each page. |
direction | The direction in which the message is fetched. MessageSearchDirection can be set with following:
|
callback | The result callback. Returns the list of obtained messages. |
void AgoraChat.ChatManager.FetchHistoryMessagesFromServerBy | ( | string | conversationId, |
ConversationType | type = ConversationType.Chat , |
||
string | cursor = null , |
||
int | pageSize = 10 , |
||
FetchServerMessagesOption | option = null , |
||
ValueCallBack< CursorResult< Message > > | callback = null |
||
) |
Gets historical messages of a conversation from the server according to the parameter configuration class for pulling historical messages FetchServerMessagesOption
.
Historical messages of a conversation can be obtained with pagination.
This is an asynchronous method.
conversationId | The conversation ID. |
type | The conversation type. See ConversationType . |
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 FetchServerMessagesOption . |
callback | The result callback. The SDK returns the list of obtained messages. |
Conversation AgoraChat.ChatManager.GetConversation | ( | string | conversationId, |
ConversationType | type = ConversationType.Chat , |
||
bool | createIfNeed = true |
||
) |
Gets the local conversation object.
The SDK wil return null
if the conversation is not found.
conversationId | The conversation ID. |
type | The conversation type. See ConversationType . |
createIfNeed | Whether to automatically create a conversation if the conversation is not found.
|
null
if the conversation is not found. Conversation AgoraChat.ChatManager.GetThreadConversation | ( | string | threadId | ) |
Gets the local thread conversation object.
The SDK wil return null
if the conversation is not found.
threadId | The thread ID. |
null
if the conversation is not found. void AgoraChat.ChatManager.GetConversationsFromServer | ( | ValueCallBack< List< Conversation > > | callback = null | ) |
Gets all conversations from the server.
An empty list will be returned if no conversation is found.
callback | The list of obtained conversations. See ValueCallBack . |
void AgoraChat.ChatManager.GetConversationsFromServerWithCursor | ( | bool | pinOnly, |
string | cursor = "" , |
||
int | limit = 20 , |
||
ValueCallBack< CursorResult< Conversation > > | callback = null |
||
) |
Gets the conversations from the server.
pingOnly | Whether to return pinned conversations only:
|
cursor | The position from which to start getting data. |
limit | The number of conversations that you expect to get on each page. The value range is [1,50]. |
callback | The list of obtained conversations. See ValueCallBack . |
void AgoraChat.ChatManager.GetConversationsFromServerWithCursor | ( | MarkType | mark, |
string | cursor = "" , |
||
int | limit = 20 , |
||
ValueCallBack< CursorResult< Conversation > > | callback = null |
||
) |
Gets the conversations from the server based on the conversation mark.
mark | The mark value used for searching. |
cursor | The position from which to start getting data. |
limit | The number of conversations that you expect to get on each page. The value range is [1,50]. |
callback | The list of obtained conversations. See ValueCallBack . |
int AgoraChat.ChatManager.GetUnreadMessageCount | ( | ) |
Gets the unread message count.
Imports messages to the local database.
You can only import messages that you sent or received.
messages | The messages to be imported. |
true
: Yes.false
: No. List< Conversation > AgoraChat.ChatManager.LoadAllConversations | ( | ) |
Loads all conversations from the local database into the memory.
To accelerate the loading, call this method immediately after the user is logged in.
Message AgoraChat.ChatManager.LoadMessage | ( | string | messageId | ) |
Loads a specified message from the local database into the memory.
messageId | The ID of the message to be loaded. |
bool AgoraChat.ChatManager.MarkAllConversationsAsRead | ( | ) |
Marks all local conversations as read.
true
: Yes.false
: No. void AgoraChat.ChatManager.RecallMessage | ( | string | messageId, |
CallBack | callback = null |
||
) |
Recalls the message.
This is an asynchronous method.
message | The ID of the message to be recalled. |
callback | The recall status callback. See CallBack . |
Resends the message.[Deprecated]
This is an asynchronous method.
message | The ID of the message to be resent. |
callback | The resending status callback. See CallBack . |
void AgoraChat.ChatManager.SearchMsgFromDB | ( | string | keywords, |
long | timestamp = 0 , |
||
int | maxCount = 20 , |
||
string | from = null , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP , |
||
ValueCallBack< List< Message > > | callback = null |
||
) |
Retrieves local messages of a certain quantity.
Note If you want to query a great number of messages, pay attention to the memory consumption. A maximum number of 200 messages can be retrieved each time.
keywords | The keyword for query. The data format is String. |
timestamp | The starting Unix timestamp for query, which is in milliseconds. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the the Unix timestamp included in them. |
maxCount | The maximum number of messages to retrieve. |
from | The user ID of the message sender. If you do not set this parameter, the SDK ignores this parameter when retrieving messages. |
direction | The query direction. See MessageSearchDirection . |
callback | If success, a list of original messages included in the combined message are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.ChatManager.SearchMsgFromDB | ( | string | keywords, |
long | timestamp = 0 , |
||
int | maxCount = 20 , |
||
string | from = null , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP , |
||
MessageSearchScope | scope = MessageSearchScope.CONTENT , |
||
ValueCallBack< List< Message > > | callback = null |
||
) |
Queries local messages based on the message scope.
Note If you want to query a great number of messages, pay attention to the memory consumption. A maximum number of 200 messages can be retrieved each time.
keywords | The keyword for query. The data format is String. |
timestamp | The starting Unix timestamp for query, which is in milliseconds. |
maxCount | The maximum number of messages to retrieve. |
from | The user ID of the message sender. If you do not set this parameter, the SDK ignores this parameter when retrieving messages. |
direction | The query direction. See MessageSearchDirection . |
scope | The query direction. See MessageSearchScope . |
callback | If success, a list of original messages included in the combined message are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.ChatManager.SendConversationReadAck | ( | string | conversationId, |
CallBack | callback = null |
||
) |
Sends the conversation read receipt to the server.
After this method is called, the sever will set the message status from unread to read.
The SDK triggers the IChatManagerDelegate#OnConversationRead(string from, string to)
callback on the message sender's client, notifying that the messages are read. This also applies to multi-device scenarios.
conversationId | The conversation ID. |
callback | The result callback. See CallBack . |
Sends a message。
This is an asynchronous method.
For attachment messages such as voice or image, the SDK will automatically upload the attachment by default. See Options#ServerTransfer
.
msg | The message object to be sent. Ensure that you set this parameter. |
callback | The result callback. See CallBack . |
void AgoraChat.ChatManager.SendMessageReadAck | ( | string | messageId, |
CallBack | callback = null |
||
) |
Sends the read receipt of a one-to-one message to the server.
After this method is called, the sever will set the message status from unread to read.
The SDK triggers the IChatManagerDelegate#OnMessagesRead(List<Message>)
callback on the message sender's client, notifying that the messages are read. This also applies to multi-device scenarios.
messageId | The message ID. |
callback | The result callback. See CallBack . |
void AgoraChat.ChatManager.SendReadAckForGroupMessage | ( | string | messageId, |
string | ackContent, | ||
CallBack | callback = null |
||
) |
Sends a read receipt for a group message to the server.
You can only call the method after setting Options#RequireAck(boolean)
and Message#IsNeedGroupAck(boolean)
.
To send the read recipient for a one-to-one chat message to the server, call SendMessageReadAck(String)
.
To send the conversation read receipt to the server, call SendConversationReadAck(String)
.
messageId | The message ID. |
ackContent | The content of the read receipt. The content is a self-defined string that can be used for specifying custom action/command. |
callback | The result callback. See{@ link CallBack}. |
bool AgoraChat.ChatManager.UpdateMessage | ( | Message | message | ) |
Updates the local message.
After this method is called, messages in both the local memory and local database will be updated.
message | The message object to update. |
true
: Yes.false
: No. void AgoraChat.ChatManager.ModifyMessage | ( | string | messageId, |
MessageBody.TextBody | body, | ||
ValueCallBack< Message > | callback = null |
||
) |
Modifies a message.
After this method is called to modify a message, both the local message and the message on the server are modified.
This method can only modify a text message in one-to-one chats or group chats, but not in chat rooms.
messageId | The ID of the message to modify. |
body | The modified message body. |
callBack | The result callback. See CallBack() . |
void AgoraChat.ChatManager.RemoveMessagesBeforeTimestamp | ( | long | timeStamp, |
CallBack | callback = null |
||
) |
Removes messages that are sent and received before the Unix timestamp from the local memory and database.
timeStamp | The starting Unix timestamp for removal. |
callback | The removal result callback. See CallBack . |
void AgoraChat.ChatManager.DeleteConversationFromServer | ( | string | conversationId, |
ConversationType | conversationType, | ||
bool | isDeleteServerMessages, | ||
CallBack | callback = null |
||
) |
Deletes the specified conversation and its historical messages from the server.
This is an asynchronous method.
conversationId | The conversation ID. |
conversationType | The conversation type. See ConversationType . |
isDeleteServerMessages | Whether to delete the historical messages with the conversation.
|
callback | Callback for whether the conversation is deleted. See CallBack . |
void AgoraChat.ChatManager.FetchSupportLanguages | ( | ValueCallBack< List< SupportLanguage > > | callback = null | ) |
获取翻译服务支持的语言。
callBack | 完成的回调,详见 ValueCallBack() 。 |
Gets all languages supported by the translation service.
callBack | The result callback. See ValueCallBack() . |
void AgoraChat.ChatManager.TranslateMessage | ( | Message | message, |
List< string > | targetLanguages, | ||
ValueCallBack< Message > | callback = null |
||
) |
Translates a message.
message | The message object. |
languages | The code list of the target languages. |
callBack | The result callback. See CallBack() . |
void AgoraChat.ChatManager.FetchGroupReadAcks | ( | string | messageId, |
string | groupId, | ||
int | pageSize = 20 , |
||
string | startAckId = null , |
||
ValueCallBack< CursorResult< GroupReadAck > > | callback = null |
||
) |
Uses the pagination to get read receipts for a group message from the server.
To send a read receipt for a group message, you can call SendReadAckForGroupMessage
.
This is an asynchronous method.
msgId | The message ID. |
groupId | The group ID。 |
pageSize | The number of read receipts for the group message that you expect to get on each page. The value range is [1,50]. |
startAckId | The starting read receipt ID for query. After this parameter is set, the SDK retrieves read receipts, from the specified one, in the reverse chronological order of when the server receives them. If you set this parameter as null, the SDK will retrieve from the latest read receipt. |
callBack | The result callback. If the call succeeds, the SDK executes ValueCallBack#onSuccess(Object) ; if the call fails, the SDK executes ValueCallBack#onError(int, String) . |
void AgoraChat.ChatManager.ReportMessage | ( | string | messageId, |
string | tag, | ||
string | reason, | ||
CallBack | callback = null |
||
) |
Reports an inappropriate message.
messageId | The ID of the message to report. |
tag | The tag of the inappropriate message. You need to type a custom tag, like porn or ad . |
reason | The reporting reason. You need to type a specific reason. |
callBack | The result callback,see CallBack() . |
void AgoraChat.ChatManager.AddReaction | ( | string | messageId, |
string | reaction, | ||
CallBack | callback = null |
||
) |
Adds a Reaction.
This is an asynchronous method.
messageId | The message ID. |
reaction | The message Reaction. |
callback | The result callback which contains the error information if the method fails. |
void AgoraChat.ChatManager.RemoveReaction | ( | string | messageId, |
string | reaction, | ||
CallBack | callback = null |
||
) |
Deletes a Reaction.
This is an asynchronous method.
messageId | The message ID. |
reaction | The Reaction content. |
callback | The result callback which contains the error information if the method fails. |
void AgoraChat.ChatManager.GetReactionList | ( | List< string > | messageIdList, |
MessageType | chatType, | ||
string | groupId, | ||
ValueCallBack< Dictionary< string, List< MessageReaction > > > | callback = null |
||
) |
Gets the list of Reactions.
This is an asynchronous method.
messageIdList | The message ID. |
chatType | The chat type. Only one-to-one chat (ConversationType.Chat and group chat (ConversationType.Group ) are allowed. |
groupId | The group ID, which is valid only when the chat type is group chat. |
callback | The result callback, which contains the Reaction list under the specified message ID(The user list of EMMessageReaction is the summary data, which only contains the information of the first three users). |
void AgoraChat.ChatManager.GetReactionDetail | ( | string | messageId, |
string | reaction, | ||
string | cursor = null , |
||
int | pageSize = 20 , |
||
ValueCallBack< CursorResult< MessageReaction > > | callback = null |
||
) |
Gets the Reaction details.
This is an asynchronous method.
messageId | The message ID. |
reaction | The Reaction content. |
cursor | The query cursor. |
pageSize | The number of Reactions you expect to get on each page. |
callback | The result callback, which contains the reaction list obtained from the server and the cursor for the next query. Returns null if all the data is fetched. |
void AgoraChat.ChatManager.GetConversationsFromServerWithPage | ( | int | pageNum, |
int | pageSize, | ||
ValueCallBack< List< Conversation > > | callback = null |
||
) |
Gets the conversations from the server.
An empty list will be returned if no conversation is found.
pageNum | The current page number. |
pageSize | The number of conversations to get on each page. |
callback | The list of obtained conversations. See ValueCallBack . |
void AgoraChat.ChatManager.RemoveMessagesFromServer | ( | string | conversationId, |
ConversationType | conversationType, | ||
List< string > | messageIdList, | ||
CallBack | callback = null |
||
) |
Removes messages in a conversation (from both local storage and the server).
This is an asynchronous method.
conversationId | The conversation ID. |
conversationType | The conversation type. See ConversationType . |
messageIdList | The list of IDs of messages to be removed. |
callback | Callback for the operation. See CallBack . |
void AgoraChat.ChatManager.RemoveMessagesFromServer | ( | string | conversationId, |
ConversationType | conversationType, | ||
long | timeStamp, | ||
CallBack | callback = null |
||
) |
Removes messages in a conversation (from both local storage and the server).
This is an asynchronous method.
conversationId | The conversation ID. |
conversationType | The conversation type. See ConversationType . |
timeStamp | The specified Unix timestamp in milliseconds. Messages with a timestamp before the specified one will be removed from the conversation. |
callback | Callback for the operation. See CallBack . |
void AgoraChat.ChatManager.PinConversation | ( | string | conversationId, |
bool | isPinned, | ||
CallBack | callback = null |
||
) |
Sets whether to pin a conversation.
This is an asynchronous method.
conversationId | The conversation ID. |
isPinned | Whether to pin the conversation:
|
callback | Callback for the operation. See CallBack . |
void AgoraChat.ChatManager.FetchCombineMessageDetail | ( | Message | msg, |
ValueCallBack< List< Message > > | callback = null |
||
) |
Gets and parses the combined message.
msg | The combined message to get and parse. |
callback | If success, a list of original messages included in the combined message are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.ChatManager.MarkConversations | ( | List< string > | conversationIds, |
bool | isMarked, | ||
MarkType | mark, | ||
CallBack | callback = null |
||
) |
Marks or unmarks conversations.
This is an asynchronous method.
This method marks conversations both locally and on the server.
conversationIds | The list of conversation IDs. |
isMarked | Whether to add or remove the mark for the conversations.
|
mark | The conversation mark to add or remove. |
callback | Callback for the operation. See CallBack . |
void AgoraChat.ChatManager.DeleteAllMessagesAndConversations | ( | bool | clearServerData, |
CallBack | callback = null |
||
) |
Clears all conversations and all messages in them.
This is an asynchronous method.
clearServerData | Whether to clear all conversations and all messages in them on the server.
|
false
:No. All local conversations and all messages in them will be cleared, while those on the server remain. callback | Callback for the operation. See CallBack . |
void AgoraChat.ChatManager.PinMessage | ( | string | messageId, |
bool | isPinned, | ||
CallBack | callback = null |
||
) |
Pins or unpins a message.
This method is used only for group messages.
This is an asynchronous method.
messageId | The message ID to be pinned or unpinned. |
isPinned | Whether to pin the message:
|
callback | Callback for the operation. See CallBack . |
void AgoraChat.ChatManager.GetPinnedMessagesFromServer | ( | string | conversationId, |
ValueCallBack< List< Message > > | callback = null |
||
) |
Gets the list of pinned messages in the conversation from the server.
msg | The conversation ID. |
callback | If success, the list of pined messages in the conversation are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.ChatManager.AddChatManagerDelegate | ( | IChatManagerDelegate | chatManagerDelegate | ) |
Adds a chat manager listener.
chatManagerDelegate | The chat manager listener to add. It is inherited from IChatManagerDelegate . |
void AgoraChat.ChatManager.RemoveChatManagerDelegate | ( | IChatManagerDelegate | chatManagerDelegate | ) |
移除聊天管理器的监听器。
chatManagerDelegate | 要移除的聊天管理器的监听器,继承自 IChatManagerDelegate 。 |
Removes a chat manager listener.
chatManagerDelegate | The chat manager listener to remove. It is inherited from IChatManagerDelegate . |