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

# DirectMessagesClient

ダイレクトメッセージ関連の操作用 Client

この Client は、X API のダイレクトメッセージ用エンドポイントとやり取りするためのメソッドを提供します。認証、リクエストフォーマットの構築、レスポンスの解析など、ダイレクトメッセージに関連するすべての操作を処理します。

<div id="constructors">
  ## コンストラクタ
</div>

<div id="constructor">
  ### constructor
</div>

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

新しい DirectMessagesClient インスタンスを作成します

<div id="parameters">
  #### パラメーター
</div>

| Name     | Type                                                     | Description                 |
| :------- | :------------------------------------------------------- | :-------------------------- |
| `client` | [`Client`](/ja/xdks/typescript/reference/classes/Client) | X API のメインとなる Client インスタンス |

#### 戻り値

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

#### 定義元

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

<div id="methods">
  ## メソッド
</div>

<div id="createbyconversationid">
  ### createByConversationId
</div>

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

会話 ID を指定して DM メッセージを作成します\
指定した会話 ID に新しいダイレクトメッセージを送信します。

<div id="parameters">
  #### パラメーター
</div>

| Name               | Type                                                                          | Description |
| :----------------- | :---------------------------------------------------------------------------- | :---------- |
| `dmConversationId` | `string`                                                                      | DM会話のID。    |
| `options`          | `CreateByConversationIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -           |

#### 戻り値

`Promise`\<`Response`>

API レスポンスを返す `Promise`。`requestOptions.raw` が true の場合は未加工の `Response`

<div id="defined-in">
  #### 定義場所
</div>

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

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

#### パラメータ

| 名前                 | 型                               |
| :----------------- | :------------------------------ |
| `dmConversationId` | `string`                        |
| `options?`         | `CreateByConversationIdOptions` |

#### 戻り値

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

<div id="defined-in">
  #### 定義場所
</div>

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

***

<div id="geteventsbyconversationid">
  ### getEventsByConversationId
</div>

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

DM 会話に紐づく DM イベントを取得します\
特定の会話に含まれるダイレクトメッセージイベントを取得します。

<div id="parameters">
  #### パラメーター
</div>

| Name      | Type                                                                             | Description |
| :-------- | :------------------------------------------------------------------------------- | :---------- |
| `id`      | `string`                                                                         | DM会話のID。    |
| `options` | `GetEventsByConversationIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -           |

<div id="returns">
  #### Returns
</div>

`Promise`\<`Response`>

API レスポンス (または requestOptions.raw が true の場合は生の Response) で解決される Promise

<div id="defined-in">
  #### 定義場所
</div>

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

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

<div id="parameters">
  #### パラメーター
</div>

| 名前         | 型                                  |
| :--------- | :--------------------------------- |
| `id`       | `string`                           |
| `options?` | `GetEventsByConversationIdOptions` |

#### 戻り値

`Promise`\<[`Get2DmConversationsIdDmEventsResponse`](/ja/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)

***

<div id="createconversation">
  ### createConversation
</div>

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

ダイレクトメッセージ (DM) の会話を作成します\
指定した参加者との新しいダイレクトメッセージ会話を開始します。

<div id="parameters">
  #### パラメーター
</div>

| 名前        | type                                                                      |
| :-------- | :------------------------------------------------------------------------ |
| `options` | `CreateConversationOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

<div id="returns">
  #### Returns
</div>

`Promise`\<`Response`>

API レスポンスを返す Promise。`requestOptions.raw` が true の場合は生の `Response`

<div id="defined-in">
  #### 定義場所
</div>

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

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

#### パラメータ

| 名前         | type                        |
| :--------- | :-------------------------- |
| `options?` | `CreateConversationOptions` |

#### 戻り値

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

<div id="defined-in">
  #### 定義場所
</div>

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

***

<div id="geteventsbyparticipantid">
  ### getEventsByParticipantId
</div>

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

DM会話のイベントを取得します\
特定のDM会話におけるダイレクトメッセージイベントを取得します。

<div id="parameters">
  #### パラメーター
</div>

| Name            | Type                                                                            | Description                |
| :-------------- | :------------------------------------------------------------------------------ | :------------------------- |
| `participantId` | `string`                                                                        | 1対1の DM 会話に参加しているユーザーの ID。 |
| `options`       | `GetEventsByParticipantIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                          |

#### 戻り値

`Promise`\<`Response`>

API レスポンスで解決される `Promise`。requestOptions.raw が true の場合は生の `Response` オブジェクト

<div id="defined-in">
  #### 定義場所
</div>

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

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

#### パラメータ

| 名前              | 型                                 |
| :-------------- | :-------------------------------- |
| `participantId` | `string`                          |
| `options?`      | `GetEventsByParticipantIdOptions` |

#### 戻り値

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

<div id="defined-in">
  #### 定義場所
</div>

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

***

<div id="getevents">
  ### getEvents
</div>

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

ダイレクトメッセージイベントを取得します\
すべての会話にわたる直近のダイレクトメッセージイベントのリストを取得します。

#### パラメータ

| 名前        | 型                                                                |
| :-------- | :--------------------------------------------------------------- |
| `options` | `GetEventsOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } |

#### 戻り値

`Promise`\<`Response`>

API レスポンスを返す Promise。requestOptions.raw が true の場合は生の Response。

<div id="defined-in">
  #### 定義場所
</div>

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

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

#### パラメータ

| Name       | Type               |
| :--------- | :----------------- |
| `options?` | `GetEventsOptions` |

#### 戻り値

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

<div id="defined-in">
  #### 定義場所
</div>

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

***

<div id="geteventsbyid">
  ### getEventsById
</div>

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

ID で DM イベントを取得します\
指定した ID を持つダイレクトメッセージイベントの詳細を取得します。

#### パラメータ

| Name      | Type                                                                 | Description  |
| :-------- | :------------------------------------------------------------------- | :----------- |
| `eventId` | `string`                                                             | DM イベントの id。 |
| `options` | `GetEventsByIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -            |

#### 戻り値

`Promise`\<`Response`>

API レスポンスで解決される Promise。requestOptions.raw が true の場合は生の Response となります

<div id="defined-in">
  #### 定義場所
</div>

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

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

#### パラメータ

| パラメータ名     | 型                      |
| :--------- | :--------------------- |
| `eventId`  | `string`               |
| `options?` | `GetEventsByIdOptions` |

#### 戻り値

`Promise`\<[`Get2DmEventsEventIdResponse`](/ja/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)

***

<div id="deleteevents">
  ### deleteEvents
</div>

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

DM イベントを削除します\
認証済みユーザーが所有している場合は、指定した id のダイレクトメッセージイベントを削除します。

#### パラメータ

| Name                         | Type     | Description            |
| :--------------------------- | :------- | :--------------------- |
| `eventId`                    | `string` | 削除するダイレクトメッセージイベントの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`](/ja/xdks/typescript/reference/interfaces/Schemas.DeleteDmResponse)>

#### パラメータ

| 名前        | 型        |
| :-------- | :------- |
| `eventId` | `string` |

#### 戻り値

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

<div id="defined-in">
  #### 定義場所
</div>

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

***

<div id="createbyparticipantid">
  ### createByParticipantId
</div>

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

参加者IDでDMメッセージを作成します\
特定の参加者のIDを指定して、新しいダイレクトメッセージを送信します。

<div id="parameters">
  #### パラメーター
</div>

| Name            | Type                                                                         | Description       |
| :-------------- | :--------------------------------------------------------------------------- | :---------------- |
| `participantId` | `string`                                                                     | DM を受信するユーザーの ID。 |
| `options`       | `CreateByParticipantIdOptions` & \{ `requestOptions`: \{ `raw`: `true`  }  } | -                 |

#### 戻り値

`Promise`\<`Response`>

API レスポンスを返す Promise。requestOptions.raw が true の場合は Response オブジェクトそのもの。

#### 定義元

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

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

<div id="parameters">
  #### パラメーター
</div>

| 名前              | 型                              |
| :-------------- | :----------------------------- |
| `participantId` | `string`                       |
| `options?`      | `CreateByParticipantIdOptions` |

#### 戻り値

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

<div id="defined-in">
  #### 定義場所
</div>

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