Chat SDK for Unity and Windows v1.2.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) |
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) |
List< Message > | SearchMsgFromDB (string keywords, long timestamp=0, int maxCount=20, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP) |
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 | 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 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 threadId 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 . |
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 . |
List< Message > AgoraChat.ChatManager.SearchMsgFromDB | ( | string | keywords, |
long | timestamp = 0 , |
||
int | maxCount = 20 , |
||
string | from = null , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP |
||
) |
Queries local messages.
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 Unix timestamp for query, which is in milliseconds. |
maxCount | The maximum number of messages to retrieve. |
from | The message source, which is usually a conversation ID. |
direction | The query direction. See MessageSearchDirection . |
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 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. SeeCallBack . |
void AgoraChat.ChatManager.SendReadAckForGroupMessage | ( | string | messageId, |
string | ackContent, | ||
CallBack | callback = null |
||
) |
Sends the group message receipt to the server.
You can only call the method after setting the following method: Options#RequireAck(boolean)
and Message#IsNeedGroupAck(boolean)
.
Reference: To send the one-to-one chat message receipt to server, call SendMessageReadAck(String)
; To send the conversation receipt to the server, call SendConversationReadAck(String)
.
messageId | The message ID. |
ackContent | The ack content information. Developer self-defined command string that can be used for specifying custom action/command. |
callback | The result callback. SeeCallBack . |
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() 。 |
Fetches all languages what the translate service supports.
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 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 |
||
) |
Fetches the ack details for group messages from server.
Fetches by page.
Reference: If you want to send group message receipt, see SendReadAckForGroupMessage
.
This is an asynchronous method.
msgId | The message ID. |
groupId | The group ID。 |
pageSize | The number of records per page. |
startAckId | The start ID for fetch receipts, can be null. If you set it as null, the SDK will start from the server's latest receipt. |
callBack | The result callback, if successful, the SDK will execute the method ValueCallBack#onSuccess(Object) , if the call failed, the SDK will execute the method ValueCallBack#onError(int, String) . |
void AgoraChat.ChatManager.ReportMessage | ( | string | messageId, |
string | tag, | ||
string | reason, | ||
CallBack | callback = null |
||
) |
Reports a violation 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 miliseconds. 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 |
||
) |
Set the conversation pin or not.
This is an asynchronous method.
conversationId | The conversation ID. |
isPinned | Pin the conversation or not. |
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.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 . |