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

コンストラクタ

constructor

new DirectMessagesClient(client): DirectMessagesClient 新しい DirectMessagesClient インスタンスを作成します

パラメーター

NameTypeDescription
clientClientX API のメインとなる Client インスタンス

戻り値

DirectMessagesClient

定義元

direct_messages/client.ts:340

メソッド

createByConversationId

createByConversationId(dmConversationId, options): Promise<Response> 会話 ID を指定して DM メッセージを作成します
指定した会話 ID に新しいダイレクトメッセージを送信します。

パラメーター

NameTypeDescription
dmConversationIdstringDM会話のID。
optionsCreateByConversationIdOptions & { requestOptions: { raw: true } }-

戻り値

Promise<Response> API レスポンスを返す PromiserequestOptions.raw が true の場合は未加工の Response

定義場所

direct_messages/client.ts:385 createByConversationId(dmConversationId, options?): Promise<CreateDmEventResponse>

パラメータ

名前
dmConversationIdstring
options?CreateByConversationIdOptions

戻り値

Promise<CreateDmEventResponse>

定義場所

direct_messages/client.ts:398

getEventsByConversationId

getEventsByConversationId(id, options): Promise<Response> DM 会話に紐づく DM イベントを取得します
特定の会話に含まれるダイレクトメッセージイベントを取得します。

パラメーター

NameTypeDescription
idstringDM会話のID。
optionsGetEventsByConversationIdOptions & { requestOptions: { raw: true } }-

Returns

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

定義場所

direct_messages/client.ts:506 getEventsByConversationId(id, options?): Promise<Get2DmConversationsIdDmEventsResponse>

パラメーター

名前
idstring
options?GetEventsByConversationIdOptions

戻り値

Promise<Get2DmConversationsIdDmEventsResponse>

定義元

direct_messages/client.ts:519

createConversation

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

パラメーター

名前type
optionsCreateConversationOptions & { requestOptions: { raw: true } }

Returns

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

定義場所

direct_messages/client.ts:784 createConversation(options?): Promise<CreateDmEventResponse>

パラメータ

名前type
options?CreateConversationOptions

戻り値

Promise<CreateDmEventResponse>

定義場所

direct_messages/client.ts:793

getEventsByParticipantId

getEventsByParticipantId(participantId, options): Promise<Response> DM会話のイベントを取得します
特定のDM会話におけるダイレクトメッセージイベントを取得します。

パラメーター

NameTypeDescription
participantIdstring1対1の DM 会話に参加しているユーザーの ID。
optionsGetEventsByParticipantIdOptions & { requestOptions: { raw: true } }-

戻り値

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

定義場所

direct_messages/client.ts:889 getEventsByParticipantId(participantId, options?): Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>

パラメータ

名前
participantIdstring
options?GetEventsByParticipantIdOptions

戻り値

Promise<Get2DmConversationsWithParticipantIdDmEventsResponse>

定義場所

direct_messages/client.ts:902

getEvents

getEvents(options): Promise<Response> ダイレクトメッセージイベントを取得します
すべての会話にわたる直近のダイレクトメッセージイベントのリストを取得します。

パラメータ

名前
optionsGetEventsOptions & { requestOptions: { raw: true } }

戻り値

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

定義場所

direct_messages/client.ts:1167 getEvents(options?): Promise<Get2DmEventsResponse>

パラメータ

NameType
options?GetEventsOptions

戻り値

Promise<Get2DmEventsResponse>

定義場所

direct_messages/client.ts:1176

getEventsById

getEventsById(eventId, options): Promise<Response> ID で DM イベントを取得します
指定した ID を持つダイレクトメッセージイベントの詳細を取得します。

パラメータ

NameTypeDescription
eventIdstringDM イベントの id。
optionsGetEventsByIdOptions & { requestOptions: { raw: true } }-

戻り値

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

定義場所

direct_messages/client.ts:1433 getEventsById(eventId, options?): Promise<Get2DmEventsEventIdResponse>

パラメータ

パラメータ名
eventIdstring
options?GetEventsByIdOptions

戻り値

Promise<Get2DmEventsEventIdResponse>

定義元

direct_messages/client.ts:1446

deleteEvents

deleteEvents(eventId, options): Promise<Response> DM イベントを削除します
認証済みユーザーが所有している場合は、指定した id のダイレクトメッセージイベントを削除します。

パラメータ

NameTypeDescription
eventIdstring削除するダイレクトメッセージイベントのID。
optionsObject-
options.requestOptionsObject-
options.requestOptions.rawtrue-

戻り値

Promise<Response> API レスポンス、または requestOptions.raw が true の場合は生の Response オブジェクトを返す Promise

定義元

direct_messages/client.ts:1656 deleteEvents(eventId): Promise<DeleteDmResponse>

パラメータ

名前
eventIdstring

戻り値

Promise<DeleteDmResponse>

定義場所

direct_messages/client.ts:1669

createByParticipantId

createByParticipantId(participantId, options): Promise<Response> 参加者IDでDMメッセージを作成します
特定の参加者のIDを指定して、新しいダイレクトメッセージを送信します。

パラメーター

NameTypeDescription
participantIdstringDM を受信するユーザーの ID。
optionsCreateByParticipantIdOptions & { requestOptions: { raw: true } }-

戻り値

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

定義元

direct_messages/client.ts:1760 createByParticipantId(participantId, options?): Promise<CreateDmEventResponse>

パラメーター

名前
participantIdstring
options?CreateByParticipantIdOptions

戻り値

Promise<CreateDmEventResponse>

定義場所

direct_messages/client.ts:1773