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/request.ts

14 lines · 560 B · TypeScript
import { xRequest } from './client.ts'
import type { XRequestParams } from './client.ts'

/**
 * Call an X API v2 endpoint with bearer or OAuth auth.
 * @returns Parsed JSON response, or a dry-run payload for non-GET without confirm.
 * @example
 * import request from 'kody:@kentcdodds/x/request'
 * const user = await request({ path: '/users/by/username/kentcdodds', authMode: 'bearer' })
 * // => { data: { id: '...', username: 'kentcdodds' } }
 */
export default async function requestEntrypoint(params: XRequestParams) {
  return await xRequest(params)
}