> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DirectMessagesClient

> X API TypeScript SDK의 DirectMessagesClient 클래스에 대한 레퍼런스. X API v2 direct messages 엔드포인트에 대한 메서드, 매개변수 및 반환 타입.

direct messages 작업을 위한 클라이언트

이 클라이언트는 X API의 direct messages 엔드포인트와 상호작용하기 위한 메서드를
제공합니다. 모든 direct messages 관련 작업에 대한 인증, 요청 형식화 및 응답
파싱을 처리합니다.

## 생성자

### constructor

• **new DirectMessagesClient**(`client`): [`DirectMessagesClient`](/xdks/typescript/reference/classes/DirectMessagesClient)

새 direct messages 클라이언트 인스턴스를 생성합니다

#### 매개변수

| 이름       | 타입                                                    | 설명                  |
| :------- | :---------------------------------------------------- | :------------------ |
| `client` | [`Client`](/xdks/typescript/reference/classes/Client) | 메인 X API 클라이언트 인스턴스 |

#### 반환값

[`DirectMessagesClient`](/xdks/typescript/reference/classes/DirectMessagesClient)

#### 정의 위치

[direct\_messages/client.ts:340](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L340)

## 메서드

### createByConversationId

▸ **createByConversationId**(`dmConversationId`, `options`): `Promise`\<`Response`>

Create DM message by conversation ID
ID로 특정 대화에 새 direct message를 보냅니다.

#### 매개변수

| 이름                 | 타입                                                                            | 설명                     |
| :----------------- | :---------------------------------------------------------------------------- | :--------------------- |
| `dmConversationId` | `string`                                                                      | DM Conversation ID입니다. |
| `options`          | `CreateByConversationIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                      |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:385](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L385)

▸ **createByConversationId**(`dmConversationId`, `options?`): `Promise`\<[`CreateDmEventResponse`](/xdks/typescript/reference/interfaces/Schemas.CreateDmEventResponse)>

#### 매개변수

| 이름                 | 타입                              |
| :----------------- | :------------------------------ |
| `dmConversationId` | `string`                        |
| `options?`         | `CreateByConversationIdOptions` |

#### 반환값

`Promise`\<[`CreateDmEventResponse`](/xdks/typescript/reference/interfaces/Schemas.CreateDmEventResponse)>

#### 정의 위치

[direct\_messages/client.ts:398](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L398)

***

### getEventsByConversationId

▸ **getEventsByConversationId**(`id`, `options`): `Promise`\<`Response`>

Get DM events for a DM conversation
특정 대화에 대한 direct message 이벤트를 검색합니다.

#### 매개변수

| 이름        | 타입                                                                               | 설명                     |
| :-------- | :------------------------------------------------------------------------------- | :--------------------- |
| `id`      | `string`                                                                         | DM conversation ID입니다. |
| `options` | `GetEventsByConversationIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                      |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:506](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L506)

▸ **getEventsByConversationId**(`id`, `options?`): `Promise`\<[`Get2DmConversationsIdDmEventsResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmConversationsIdDmEventsResponse)>

#### 매개변수

| 이름         | 타입                                 |
| :--------- | :--------------------------------- |
| `id`       | `string`                           |
| `options?` | `GetEventsByConversationIdOptions` |

#### 반환값

`Promise`\<[`Get2DmConversationsIdDmEventsResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmConversationsIdDmEventsResponse)>

#### 정의 위치

[direct\_messages/client.ts:519](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L519)

***

### createConversation

▸ **createConversation**(`options`): `Promise`\<`Response`>

Create DM conversation
지정된 참여자와 새 direct message 대화를 시작합니다.

#### 매개변수

| 이름        | 타입                                                                        |
| :-------- | :------------------------------------------------------------------------ |
| `options` | `CreateConversationOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:784](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L784)

▸ **createConversation**(`options?`): `Promise`\<[`CreateDmEventResponse`](/xdks/typescript/reference/interfaces/Schemas.CreateDmEventResponse)>

#### 매개변수

| 이름         | 타입                          |
| :--------- | :-------------------------- |
| `options?` | `CreateConversationOptions` |

#### 반환값

`Promise`\<[`CreateDmEventResponse`](/xdks/typescript/reference/interfaces/Schemas.CreateDmEventResponse)>

#### 정의 위치

[direct\_messages/client.ts:793](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L793)

***

### getEventsByParticipantId

▸ **getEventsByParticipantId**(`participantId`, `options`): `Promise`\<`Response`>

Get DM events for a DM conversation
특정 대화에 대한 direct message 이벤트를 검색합니다.

#### 매개변수

| 이름              | 타입                                                                              | 설명                        |
| :-------------- | :------------------------------------------------------------------------------ | :------------------------ |
| `participantId` | `string`                                                                        | 1대1 DM 대화의 참여자 사용자 ID입니다. |
| `options`       | `GetEventsByParticipantIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                         |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:889](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L889)

▸ **getEventsByParticipantId**(`participantId`, `options?`): `Promise`\<[`Get2DmConversationsWithParticipantIdDmEventsResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse)>

#### 매개변수

| 이름              | 타입                                |
| :-------------- | :-------------------------------- |
| `participantId` | `string`                          |
| `options?`      | `GetEventsByParticipantIdOptions` |

#### 반환값

`Promise`\<[`Get2DmConversationsWithParticipantIdDmEventsResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmConversationsWithParticipantIdDmEventsResponse)>

#### 정의 위치

[direct\_messages/client.ts:902](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L902)

***

### getEvents

▸ **getEvents**(`options`): `Promise`\<`Response`>

Get DM events
모든 대화에서 최근 direct message 이벤트 목록을 검색합니다.

#### 매개변수

| 이름        | 타입                                                               |
| :-------- | :--------------------------------------------------------------- |
| `options` | `GetEventsOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:1167](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1167)

▸ **getEvents**(`options?`): `Promise`\<[`Get2DmEventsResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmEventsResponse)>

#### 매개변수

| 이름         | 타입                 |
| :--------- | :----------------- |
| `options?` | `GetEventsOptions` |

#### 반환값

`Promise`\<[`Get2DmEventsResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmEventsResponse)>

#### 정의 위치

[direct\_messages/client.ts:1176](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1176)

***

### getEventsById

▸ **getEventsById**(`eventId`, `options`): `Promise`\<`Response`>

Get DM event by ID
ID로 특정 direct message 이벤트의 세부 정보를 검색합니다.

#### 매개변수

| 이름        | 타입                                                                   | 설명           |
| :-------- | :------------------------------------------------------------------- | :----------- |
| `eventId` | `string`                                                             | dm event id. |
| `options` | `GetEventsByIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -            |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:1433](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1433)

▸ **getEventsById**(`eventId`, `options?`): `Promise`\<[`Get2DmEventsEventIdResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmEventsEventIdResponse)>

#### 매개변수

| 이름         | 타입                     |
| :--------- | :--------------------- |
| `eventId`  | `string`               |
| `options?` | `GetEventsByIdOptions` |

#### 반환값

`Promise`\<[`Get2DmEventsEventIdResponse`](/xdks/typescript/reference/interfaces/Schemas.Get2DmEventsEventIdResponse)>

#### 정의 위치

[direct\_messages/client.ts:1446](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1446)

***

### deleteEvents

▸ **deleteEvents**(`eventId`, `options`): `Promise`\<`Response`>

Delete DM event
인증된 사용자가 소유한 경우 ID로 특정 direct message 이벤트를 삭제합니다.

#### 매개변수

| 이름                           | 타입       | 설명                             |
| :--------------------------- | :------- | :----------------------------- |
| `eventId`                    | `string` | 삭제할 direct-message 이벤트의 ID입니다. |
| `options`                    | `Object` | -                              |
| `options.requestOptions`     | `Object` | -                              |
| `options.requestOptions.raw` | `true`   | -                              |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:1656](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1656)

▸ **deleteEvents**(`eventId`): `Promise`\<[`DeleteDmResponse`](/xdks/typescript/reference/interfaces/Schemas.DeleteDmResponse)>

#### 매개변수

| 이름        | 타입       |
| :-------- | :------- |
| `eventId` | `string` |

#### 반환값

`Promise`\<[`DeleteDmResponse`](/xdks/typescript/reference/interfaces/Schemas.DeleteDmResponse)>

#### 정의 위치

[direct\_messages/client.ts:1669](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1669)

***

### createByParticipantId

▸ **createByParticipantId**(`participantId`, `options`): `Promise`\<`Response`>

Create DM message by participant ID
ID로 특정 참여자에게 새 direct message를 보냅니다.

#### 매개변수

| 이름              | 타입                                                                           | 설명                     |
| :-------------- | :--------------------------------------------------------------------------- | :--------------------- |
| `participantId` | `string`                                                                     | DM을 받을 수신자 사용자의 ID입니다. |
| `options`       | `CreateByParticipantIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                      |

#### 반환값

`Promise`\<`Response`>

API 응답 또는 requestOptions.raw가 true인 경우 원본 Response로 해결되는 Promise

#### 정의 위치

[direct\_messages/client.ts:1760](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1760)

▸ **createByParticipantId**(`participantId`, `options?`): `Promise`\<[`CreateDmEventResponse`](/xdks/typescript/reference/interfaces/Schemas.CreateDmEventResponse)>

#### 매개변수

| 이름              | 타입                             |
| :-------------- | :----------------------------- |
| `participantId` | `string`                       |
| `options?`      | `CreateByParticipantIdOptions` |

#### 반환값

`Promise`\<[`CreateDmEventResponse`](/xdks/typescript/reference/interfaces/Schemas.CreateDmEventResponse)>

#### 정의 위치

[direct\_messages/client.ts:1773](https://github.com/xdevplatform/xdk-typescript/blob/81aacb165e0802e188f608bdf462b60fc4e713a2/src/direct_messages/client.ts#L1773)
