构造函数
构造函数
client): DirectMessagesClient
创建一个新的私信客户端实例
参数
| 名称 | 类型 | 描述 |
|---|---|---|
client | Client | X API 的主客户端实例 |
返回值
DirectMessagesClient
定义于
direct_messages/client.ts:211方法
getEvents
options?): Promise<Get2DmEventsResponse>
获取 DM 事件
返回跨所有会话的近期私信事件列表。
参数
| 名称 | 类型 |
|---|---|
options | GetEventsOptions |
返回
Promise<Get2DmEventsResponse>
解析为 API 响应的 Promise
定义位置
getEventsByParticipantId
participantId, options?): Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>
获取某个 DM 会话的事件
检索指定会话的私信事件。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
participantId | string | 一对一私信会话中参与方用户的 id。 |
options | GetEventsByParticipantIdOptions | - |
返回
Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>
解析为 API 响应的 Promise
定义于
direct_messages/client.ts:311createByConversationId
dmConversationId, options?): Promise<CreateDmEventResponse>
按会话 ID 创建私信
根据会话 ID 向指定会话发送一条新的私信。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
dmConversationId | string | DM 会话的 ID。 |
options | CreateByConversationIdOptions | - |
返回
Promise<CreateDmEventResponse>
会解析为 API 响应的 Promise
定义于
direct_messages/client.ts:406createByParticipantId
participantId, options?): Promise<CreateDmEventResponse>
按参与者 ID 创建私信
根据该参与者的 ID 向其发送一条新的私信。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
participantId | string | 将接收私信的目标用户的 id。 |
options | CreateByParticipantIdOptions | - |
返回值
Promise<CreateDmEventResponse>
解析为 API 响应的 Promise
定义于
direct_messages/client.ts:457getEventsByConversationId
id, options?): Promise<Get2DmConversationsIdDmEventsResponse>
获取指定私信会话的私信事件
检索某一特定会话的私信事件。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
id | string | 私信会话的 ID。 |
options | GetEventsByConversationIdOptions | - |
返回
Promise<Get2DmConversationsIdDmEventsResponse>
解析为 API 响应的 Promise
定义位置
getEventsById
eventId, options?): Promise<Get2DmEventsEventIdResponse>
按 ID 获取 DM 事件
根据其 ID 获取特定私信事件的详细信息。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
eventId | string | 私信事件的 id。 |
options | GetEventsByIdOptions | - |
返回
Promise<Get2DmEventsEventIdResponse>
解析为 API 响应的 Promise
定义于
direct_messages/client.ts:600deleteEvents
eventId): Promise<DeleteDmResponse>
删除私信事件
如果该私信事件归已认证用户所有,则可按其 id 删除指定的私信事件。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
eventId | string | 要删除的私信事件的 id。 |
返回
Promise<DeleteDmResponse>
解析为 API 响应的 Promise
定义位置
createConversation
options?): Promise<CreateDmEventResponse>
创建私信会话
与指定参与方启动一段新的私信会话。
参数
| 参数名 | 类型 |
|---|---|
options | CreateConversationOptions |
返回
Promise<CreateDmEventResponse>
解析为 API 响应的 Promise