Chat SDK for Unity and Windows v1.2.0
|
Public Member Functions | |
void | MarkMessageAsRead (string messageId) |
void | MarkAllMessageAsRead () |
bool | InsertMessage (Message message) |
bool | AppendMessage (Message message) |
bool | UpdateMessage (Message message) |
bool | DeleteMessage (string messageId) |
bool | DeleteMessages (long startTime, long endTime) |
bool | DeleteAllMessages () |
Message | LoadMessage (string messageId) |
void | LoadMessagesWithMsgType (MessageBodyType type, string sender=null, long timestamp=-1, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
void | LoadMessages (string startMessageId=null, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
void | LoadMessagesWithKeyword (string keywords, string sender=null, long timestamp=-1, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null) |
void | LoadMessagesWithTime (long startTime, long endTime, int count=20, ValueCallBack< List< Message > > callback=null) |
int | MessagesCount () |
Public Attributes | |
string | Id |
ConversationType | Type |
bool | IsThread |
bool | IsPinned |
long | PinnedTime |
Properties | |
Message | LastMessage [get] |
Message | LastReceivedMessage [get] |
Dictionary< string, string > | Ext [get, set] |
int | UnReadCount [get] |
void AgoraChat.Conversation.MarkMessageAsRead | ( | string | messageId | ) |
Marks a message as read.
messageId | The message ID. |
void AgoraChat.Conversation.MarkAllMessageAsRead | ( | ) |
Marks all unread messages in the conversation as read.
bool AgoraChat.Conversation.InsertMessage | ( | Message | message | ) |
Inserts a message into a conversation in the local database.
To insert the message correctly, ensure that the conversation ID of the message is the same as that of the conversation.
The message will be inserted based on the Unix timestamp included in it. Upon message insertion, the SDK will automatically update attributes of the conversation, including latestMessage
.
message | The message instance. |
true
: Yes.false
: No. bool AgoraChat.Conversation.AppendMessage | ( | Message | message | ) |
Inserts a message to the end of a conversation in the local database.
The conversation ID of the message should be the same as that of the conversation to make sure that the message is correctly inserted.
After a message is inserted, the SDK will automatically update attributes of the conversation, including latestMessage
.
message | The message instance. |
true
: Yes.false
: No. bool AgoraChat.Conversation.UpdateMessage | ( | Message | message | ) |
Updates a message in the local database.
The ID of the message remains unchanged during message updates.
After a message is updated, the SDK will automatically update attributes of the conversation, including latestMessage
.
message | The message to be updated. |
true
: Yes.false
: No. bool AgoraChat.Conversation.DeleteMessage | ( | string | messageId | ) |
Deletes a message from the local database.
messageId | The ID of the message to be deleted. |
true
: Yes.false
: No. bool AgoraChat.Conversation.DeleteMessages | ( | long | startTime, |
long | endTime | ||
) |
Deletes messages sent or received in a certain period from the local database.
startTime | The starting Unix timestamp for message deletion. The unit is millisecond. |
endTime | The ending Unix timestamp for message deletion. The unit is millisecond. |
true
: Yes.false
: No. bool AgoraChat.Conversation.DeleteAllMessages | ( | ) |
Deletes all the messages in the conversation.
This method deletes all messages in the conversation from both the memory and the local database.
true
: Yes.false
: No. Message AgoraChat.Conversation.LoadMessage | ( | string | messageId | ) |
Loads a message. The SDK first retrieves the message from the memory. If no message is found, the SDK retrieves it from the local database and loads it.
messageId | The ID of the message to load. |
null
. void AgoraChat.Conversation.LoadMessagesWithMsgType | ( | MessageBodyType | type, |
string | sender = null , |
||
long | timestamp = -1 , |
||
int | count = 20 , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP , |
||
ValueCallBack< List< Message > > | callback = null |
||
) |
Loads the messages of a specific type.
The SDK first retrieves the messages from the memory. If no message is found, the SDK will retrieve them from the local database and load them.
type | The type of messages to load. Ensure that you set this parameter. |
sender | The user ID of the message sender. Ensure that you set this parameter. |
timestamp | The starting Unix timestamp for query. The default value is -1 , indicating the current Unix timestamp. |
count | The maximum number of messages to load. The default value is 20 . |
direction | The message loading direction. By default, the SDK loads messages in the reverse chronological order of the Unix timestamp (SortMessageByServerTime ) in the message. See MessageSearchDirection . |
callback | The loading result callback. If success, a list of loaded messages are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.Conversation.LoadMessages | ( | string | startMessageId = null , |
int | count = 20 , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP , |
||
ValueCallBack< List< Message > > | callback = null |
||
) |
Loads the messages, starting from a specific message ID.
The SDK first retrieves the messages from the memory. If no message is found, the SDK will retrieve them from the local database and load them.
startMessageId | The starting message ID for loading. If this parameter is set as "" or null , the SDK will load from the latest message. |
count | The maximum number of messages to load. The default value is 20 . |
direction | The message loading direction. By default, the SDK loads messages in the reverse chronological order of the Unix timestamp (SortMessageByServerTime ) in the messages. See MessageSearchDirection . |
callback | The loading result callback. If success, a list of loaded messages are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.Conversation.LoadMessagesWithKeyword | ( | string | keywords, |
string | sender = null , |
||
long | timestamp = -1 , |
||
int | count = 20 , |
||
MessageSearchDirection | direction = MessageSearchDirection.UP , |
||
ValueCallBack< List< Message > > | callback = null |
||
) |
Loads the messages by keywords.
The SDK first retrieves the messages from the memory. If no message is found, the SDK will retrieve them from the local database and load them.
keywords | The keywords for query. |
sender | The user ID of the message sender. |
timestamp | The starting Unix timestamp for query. The default value is -1 , indicating the current Unix timestamp. |
count | The maximum number of messages to load. The default value is 20 . |
direction | The message loading direction. By default, the SDK loads messages in the reverse chronological order of the Unix timestamp (SortMessageByServerTime ) in the messages. See MessageSearchDirection . |
callback | The loading result callback. If success, a list of loaded messages are returned; otherwise, an error is returned. See ValueCallBack . |
void AgoraChat.Conversation.LoadMessagesWithTime | ( | long | startTime, |
long | endTime, | ||
int | count = 20 , |
||
ValueCallBack< List< Message > > | callback = null |
||
) |
Loads the messages within a period.
Note
The SDK first retrieves the messages from the memory. If no message is found, the SDK will retrieve them from the local database and load them.
Pay attention to the memory usage when you load a great number of messages.
startTimeStamp | The starting Unix timestamp for query. |
endTimeStamp | The ending Unix timestamp for query. |
count | The maximum number of messages to load. The default value is 20 . |
callback | The loading result callback. If success, a list of loaded messages are returned; otherwise, an error is returned. See ValueCallBack . |
int AgoraChat.Conversation.MessagesCount | ( | ) |
Gets the count of all messages in this conversation in the local database.
string AgoraChat.Conversation.Id |
The conversation ID.
ConversationType AgoraChat.Conversation.Type |
The conversation type.
bool AgoraChat.Conversation.IsThread |
Whether a conversation is a thread conversation:
true
: Yes.false
: No. bool AgoraChat.Conversation.IsPinned |
Whether a conversation is pinned:
true
: Yes.false
: No. long AgoraChat.Conversation.PinnedTime |
The timestamp when the conversation is pinned. The unit is millisecond.
If isPinned
is false
, 0
is returned.
|
get |
Gets the latest message in the conversation.
A call of this method has no impact on the unread message count of the conversation.
The SDK first retrieves the latest message from the memory. If no message is found, the SDK retrieves it from the local database and loads it.
|
get |
Gets the latest message received in the conversation.
|
getset |
Gets the extension information of the conversation.
|
get |
Gets the count of unread messages in the conversation.