Skip to content
← Public packages

@kentcdodds/x

X API v2 helpers for tweets, search, legacy DMs, and encrypted X Chat via a Fly XDK sidecar.

src/get-post-thread.ts

18 lines · 739 B · TypeScript
import { getPostThread } from './client.ts'
import type { XGetPostThreadParams } from './client.ts'

/**
 * Fetch a post plus recent conversation replies via search-recent
 * `conversation_id:<id>` (default maxResults ~20, hard cap 50).
 *
 * Rate-limit caution: at least get-post + search-recent (and possibly a root
 * fetch). Prefer this over DIY thread assembly with raw `request` loops.
 *
 * @returns `{ root, replies, metrics?, conversationId, note }`
 * @example
 * import getPostThread from 'kody:@kentcdodds/x/get-post-thread'
 * const thread = await getPostThread({ id: '123', maxResults: 20 })
 */
export default async function getPostThreadEntrypoint(params: XGetPostThreadParams = {}) {
	return await getPostThread(params)
}