# Class ConversationIdentifier

会话标识

#### Version

1.0.0

- Defined in conversation/ConversationIdentifier.ts:12

##### Index

### Constructors

constructor

### Properties

conversationType
targetId

### Accessors

channelId

### Methods

createWith2
createWith3
createWithMessage
createWithConversation
createWithConversationStatusInfo
check

## Constructors

### constructor

- new ConversationIdentifier(): ConversationIdentifier

  #### Returns ConversationIdentifier

## Properties

### conversationType

conversationType: ConversationType = ConversationType.Private

会话类型

- Defined in conversation/ConversationIdentifier.ts:16

### targetId

targetId: string = ''

会话 ID

- Defined in conversation/ConversationIdentifier.ts:20

## Accessors

### channelId

- get channelId(): string

  返回有效的 channelId

  #### Returns string

  null 或 undefined 会返回空字符串

  - Defined in conversation/ConversationIdentifier.ts:153
- set channelId(value: string): void

  #### Parameters

  - value: string

  #### Returns void

  - Defined in conversation/ConversationIdentifier.ts:145

## Methods

### `Static` createWith2

- createWith2(
  conversationType: ConversationType,
  targetId: string,
  ): ConversationIdentifier

  使用两个参数构建(conversationType、targetId)

  #### Parameters

  - conversationType: ConversationType

    会话类型

  - targetId: string

    会话 Id

  #### Returns ConversationIdentifier

  会话标识

  #### Version

  1.2.0

  - Defined in conversation/ConversationIdentifier.ts:73

### `Static` createWith3

- createWith3(
  conversationType: ConversationType,
  targetId: string,
  channelId: string,
  ): ConversationIdentifier

  使用三个参数构建(conversationType、targetId、channelId)

  #### Parameters

  - conversationType: ConversationType

    会话类型

  - targetId: string

    会话 Id

  - channelId: string

    业务标识

  #### Returns ConversationIdentifier

  会话标识

  #### Version

  1.2.0

  - Defined in conversation/ConversationIdentifier.ts:85

### `Static` createWithMessage

- createWithMessage(msg: Message): ConversationIdentifier

  通过 Message 创建

  #### Parameters

  - msg: Message

    消息对象，如果 msg 为空，返回的 ConversationIdentifier 的会话类型为单聊，targetId & ChannelId 均为空字符串

  #### Returns ConversationIdentifier

  会话标识

  #### Version

  1.2.0

  - Defined in conversation/ConversationIdentifier.ts:103

### `Static` createWithConversation

- createWithConversation(con: Conversation): ConversationIdentifier

  通过 Conversation 创建

  #### Parameters

  - con: Conversation

    会话对象对象，如果 con 为空，返回的 ConversationIdentifier 的会话类型为单聊，targetId & ChannelId 均为空字符串

  #### Returns ConversationIdentifier

  会话标识

  #### Version

  1.2.0

  - Defined in conversation/ConversationIdentifier.ts:119

### `Static` createWithConversationStatusInfo

- createWithConversationStatusInfo(
  info: ConversationStatusInfo,
  ): ConversationIdentifier

  通过 ConversationStatusInfo 创建

  #### Parameters

  - info: ConversationStatusInfo

    如果 info 为空，返回的 ConversationIdentifier 的会话类型为单聊，targetId & ChannelId 均为空字符串

  #### Returns ConversationIdentifier

  会话标识

  #### Version

  1.2.0

  - Defined in conversation/ConversationIdentifier.ts:135

### check

- check(): EngineError

  检查 ConversationIdentifier 是否合法

  #### Returns EngineError

  ConversationIdentifier 合法则返回 EngineError.Success ，否则返回具体的错误码

  - Defined in conversation/ConversationIdentifier.ts:46