UNPKG

@foxxie/centra

Version:

A fork of Centra to support shortcut methods in Foxxie, and with typescript support.

32 lines (31 loc) 1.16 kB
/// <reference types="node" /> import { RequestOptions } from 'node:http'; import { HttpMethod, ResOptions } from '../index'; import { CentraResponse } from './CentraResponse'; export declare class CentraRequest { url: URL; method: HttpMethod; data: string | Buffer | null; sendDataAs: 'form' | 'json' | 'buffer' | null; reqHeaders: Record<string, any>; streamEnabled: boolean; compressionEnabled: boolean; timeoutTime: number | null; ua: string; coreOptions: RequestOptions; resOptions: ResOptions; constructor(url: string | URL, method?: HttpMethod); query(a1: string | Record<string, any>, a2?: any): this; path(relativePath: string): this; body(data: any, sendAs?: 'json' | 'buffer' | 'form'): this; header(a1: string | Record<string, string>, a2?: string): this; timeout(timeout: number): this; option<T extends keyof RequestOptions>(name: T, value: RequestOptions[T]): this; agent(agent: string): this; stream(): this; compress(): this; json<T = any>(): Promise<T>; raw(): Promise<Buffer>; text(): Promise<string>; send(): Promise<CentraResponse>; }