Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
conversationID |
String |
Conversation ID. Composition of conversation ID:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type |
String |
Conversation type, as follows:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
subType |
String |
Group conversation type, as follows:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unreadCount |
Number |
Unread message count. TUIChatEngine.TYPES.GRP_MEETING / TUIChatEngine.TYPES.GRP_AVCHATROOM group conversations do not track unread counts, this field will be 0. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lastMessage |
Object |
The latest message in the conversation Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
groupProfile |
Group |
Group profile for group conversations |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
userProfile |
Profile |
User profile for C2C conversations |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
groupAtInfoList |
Array.<GroupAtInfo> |
Group @ information list. Developers can use this to display effects like "@me" or "@all" in conversation list. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
remark |
String |
Friend remark. Only available for C2C conversations where the peer is my friend and I've set a remark for this friend. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isPinned |
Boolean |
Whether the conversation is pinned |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
messageRemindType |
String |
Message reminder type, as follows:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
markList |
Array |
Conversation mark list, as follows:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
customData |
String |
Conversation custom data |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
conversationGroupList |
Array |
Conversation group list |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
draftText |
String |
Conversation draft |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
isMuted |
Boolean |
Whether the conversation is muted, default is false |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
operationType |
Number |
Group operation type, default 0. 4-Removed from group 5-Group disbanded 8-Left group actively |
ConversationModel is mainly responsible for conversation operations and data processing. Developers don't need to implement ConversationModel themselves, as it is provided by TUIChatEngine through ConversationStore's conversationList for direct use.
Methods
deleteConversation() → {Promise.<any>}
Delete conversation
Example
let promise = conversationModel.deleteConversation();
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling when calls fail
});
Returns:
- Type
- Promise.<any>
pinConversation() → {Promise.<any>}
Pin conversation
Examples
// Pin conversation
// When isPinned is false, calling this API pins the conversation
if (isPinned === false) {
let promise = conversationModel.pinConversation();
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling when calls fail
});
}
// Unpin conversation
// When isPinned is true, calling this API unpins the conversation.
if (isPinned === true) {
let promise = conversationModel.pinConversation();
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling when calls fail
});
}
Returns:
- Type
- Promise.<any>
muteConversation() → {Promise.<any>}
Set message Do Not Disturb
Examples
// Set message Do Not Disturb
// When isMuted is false, calling this API sets message Do Not Disturb.
let promise = conversationModel.muteConversation();
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling when calls fail
});
// Cancel message Do Not Disturb
// When isMuted is true, calling this API cancels message Do Not Disturb.
let promise = conversationModel.muteConversation();
promise.catch((error) => {
// Business side can catch exceptions through promise.catch for error handling when calls fail
});
Returns:
- Type
- Promise.<any>
getAvatar() → {string}
Get conversation avatar
Example
let avatar = conversationModel.getAvatar();
Returns:
- Type
- string
getShowName() → {string}
Get conversation display name
Example
let name = conversationModel.getShowName();
Returns:
- Type
- string
getGroupAtInfo() → {string}
Get group @ information
Example
let atInfo = conversationModel.getGroupAtInfo();
Returns:
- Type
- string
getLastMessage(key) → {string|null}
Get display information of the latest message in conversation
Examples
// Get display time of lastMessage
let time = conversationModel.getLastMessage('time');
// Get display text content of lastMessage
let time = conversationModel.getLastMessage('text');
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
The key of lastMessage to be displayed
|
Returns:
- Type
- string | null