import { cursorRequestRaw } from './lib/client.ts' export type CursorRequestParams = { path: string method?: string query?: Record body?: unknown headers?: Record } /** * Send a raw request to any api.cursor.com path (escape hatch for unwrapped APIs). * * @param params.path - API path (e.g. `/v1/models` or `/v0/private-workers`). * @param params.method - HTTP method; defaults to GET. * @returns Parsed JSON or text body plus HTTP status. * @example * import { cursorRequest } from 'kody:@kentcdodds/cursor/request' * const result = await cursorRequest({ path: '/v1/models' }) * // => { status: 200, body: { items: [...] } } * * @see https://cursor.com/docs/api */ export async function cursorRequest(params: CursorRequestParams) { const result = await cursorRequestRaw({ path: params.path, method: params.method, query: params.query, body: params.body, headers: params.headers, }) return { status: result.status, body: result.body } } /** Default export: raw request escape hatch. */ export default cursorRequest