# Class Conversation

会话类，包含会话的所有属性。

#### Version

1.0.0

- Defined in conversation/Conversation.ts:11

##### Index

### Constructors

constructor

### Properties

conversationType
targetId
channelId
unreadMessageCount
isTop
lastMessageId
lastReceivedTime
lastSentTime
lastOperateTime
objectName
content
senderId
draft
notificationLevel
unreadMentionedCount
includeRobot?
editedMessageDraft
lastMessage?
dataMgmtInfo

## Constructors

### constructor

- new Conversation(): Conversation

  #### Returns Conversation

## Properties

### conversationType

conversationType: ConversationType = ConversationType.Private

会话类型

- Defined in conversation/Conversation.ts:15

### targetId

targetId: string = ''

会话 ID

- Defined in conversation/Conversation.ts:19

### channelId

channelId: string = ''

所属会话的业务标识，长度限制 20 字符

仅支持单群聊和超级群，其他类型的会话请传入空字符串

#### See

ConversationIdentifier.channelId

#### Version

1.2.0

- Defined in conversation/Conversation.ts:27

### unreadMessageCount

unreadMessageCount: number = 0

会话中的未读消息数量

- Defined in conversation/Conversation.ts:31

### isTop

isTop: boolean = false

是否置顶

- Defined in conversation/Conversation.ts:35

### lastMessageId

lastMessageId: number = 0

会话中最后一条消息的消息 ID

- Defined in conversation/Conversation.ts:39

### lastReceivedTime

lastReceivedTime: number = 0

会话中最后一条消息的接收时间（Unix时间戳、毫秒）

- Defined in conversation/Conversation.ts:43

### lastSentTime

lastSentTime: number = 0

会话中最后一条消息的发送时间（Unix时间戳、毫秒）

- Defined in conversation/Conversation.ts:47

### lastOperateTime

lastOperateTime: number = 0

会话的操作时间（Unix时间戳、毫秒），用于分页获取会话列表时传入的时间戳

初始值与 sentTime 相同，置顶等操作会更新此时间戳

- Defined in conversation/Conversation.ts:53

### objectName

objectName: string = ''

会话中最后一条消息的类型名

- Defined in conversation/Conversation.ts:57

### content

content: MessageContent

会话中最后一条消息的内容，所有消息体的基类，需要根据 objectName 将 content 转为具体的消息类型

        // Conversation 必须为有效的对象，此处进行简写
        let conversation : Conversation;
        if (TextMessageObjectName === conversation.objectName) {
           // 转成文本消息
           let txtMsg = conversation.content as TextMessage;
        } else if (ImageMessageObjectName === conversation.objectName) {
           // 转成图片消息
           let imgMsg= conversation.content as ImageMessage;
        }

#### See

MessageContent

- Defined in conversation/Conversation.ts:74

### senderId

senderId: string = ''

会话中最后一条消息的发送者用户 ID

- Defined in conversation/Conversation.ts:78

### draft

draft: string = ''

会话中存在的草稿

- Defined in conversation/Conversation.ts:82

### notificationLevel

notificationLevel: PushNotificationLevel = PushNotificationLevel.Default

免打扰级别

- Defined in conversation/Conversation.ts:86

### unreadMentionedCount

unreadMentionedCount: number = 0

会话中 @ 消息的总个数（包含 @ 我的个数和 @ 所有人的个数）

- Defined in conversation/Conversation.ts:90

### `Optional` includeRobot

includeRobot?: boolean = false

是否包含机器人，目前仅单聊、系统会话有效

#### Version

25.11.0

- Defined in conversation/Conversation.ts:95

### editedMessageDraft

editedMessageDraft: EditedMessageDraft = null

- Defined in conversation/Conversation.ts:97

### `Optional` lastMessage

lastMessage?: Message = null

会话中最后一条消息

#### Version

25.12.0

- Defined in conversation/Conversation.ts:103

### dataMgmtInfo

dataMgmtInfo: DataManagementInfo = null

托管信息，包含会话名称和头像

该属性仅支持单聊、群聊和系统会话。

#### Version

26.1.0

- Defined in conversation/Conversation.ts:112