import type { ProgressEvent, Request, Response } from "superagent"; import type { Backoff } from "discord-client-types/discord_common/packages/backoff/Backoff"; interface HTTPAttachment { file: string | Blob | Buffer; filename: string; name: string; } interface HTTPField { name: string; value: string; } interface HTTPRequest { url: string; attachments?: HTTPAttachment[]; backoff?: Backoff; binary?: boolean; body?: Record; context?: Record; fields?: HTTPField[]; headers?: Record; oldFormErrors?: boolean; query?: string | Record; reason?: string; retried?: number; retries?: number; signal?: AbortSignal; timeout?: number; interceptResponse?: (response: Response, retry: (headers?: Record, interceptResponse?: HTTPRequest["interceptResponse"]) => void, reject: (reason: Error) => void) => boolean; onRequestCreated?: (request: Request) => void; onRequestProgress?: (progress: ProgressEvent) => void; } export interface HTTPResponse> { body: T; headers: Record; ok: boolean; status: number; text: string; } export declare class V6OrEarlierAPIError { constructor(error: Record | null, code: number, message?: string); code: number; error: Error; fields: Record; message: string; retryAfter: number | undefined; status: number; getFieldMessage: (field: string) => unknown; } export declare class APIError { constructor(error: Record | null, code: number, message?: string); captchaFields: Record; code: number; errors: Record; }> | undefined; message: string; retryAfter: number | undefined; status: number; getAnyErrorMessage: () => string | { fieldName: string | null; error: string; }; getAnyErrorMessageAndField: () => { fieldName: string | null; error: string; } | null; getFieldErrors: (field: string | string[]) => Array<{ code: string; message: string; }> | undefined; getFirstFieldErrorMessage: (field: string | string[]) => string | null; hasFieldErrors: () => boolean; } type HTTP = Record<"get" | "post" | "put" | "patch" | "del", >(req: string | HTTPRequest, callback?: (response: HTTPResponse) => void) => Promise>>; interface RequestPatch { prepareRequest: (request: Request) => void; interceptResponse: Required; } export interface API { INVALID_FORM_BODY_ERROR_CODE: number; convertSkemaError: (response: Record) => Record; V6OrEarlierAPIError: typeof V6OrEarlierAPIError; V8APIError: typeof APIError; HTTP: HTTP; getAPIBaseURL: (version?: boolean) => string; setAwaitOnline: (callback: (url: string) => Promise) => void; setRequestPatch: (patch: RequestPatch) => void; } declare const _default: API; export default _default;