Skip to main content
Client for news operations This client provides methods for interacting with the news endpoints of the X API. It handles authentication, request formatting, and response parsing for all news related operations.

Constructors

constructor

new NewsClient(client): NewsClient Creates a new news client instance

Parameters

NameTypeDescription
clientClientThe main X API client instance

Returns

NewsClient

Defined in

news/client.ts:77

Methods

get

get(id, options?): Promise<Get2NewsIdResponse> Get news stories by ID Retrieves news story by its ID.

Parameters

NameTypeDescription
idstringThe ID of the news story.
optionsGetOptions-

Returns

Promise<Get2NewsIdResponse> Promise resolving to the API response

Defined in

news/client.ts:123
search(query, options?): Promise<Get2NewsSearchResponse> Search News Retrieves a list of News stories matching the specified search query.

Parameters

NameTypeDescription
querystringThe search query.
optionsSearchOptions-

Returns

Promise<Get2NewsSearchResponse> Promise resolving to the API response

Defined in

news/client.ts:193