import Notifier from './notifier'; export interface RequestListener { requestSent?(r: RequestInfo): void; requestSucceeded?(r: RequestInfo): void; requestRedirected?(r: RequestInfo): void; requestUnauthenticated?(r: RequestInfo): void; requestFailed?(r: RequestInfo): void; requestCancellation?(r: RequestInfo): void; requestError?(r: RequestInfo, err: Error): void; responseError?(r: RequestInfo, err: Error): void; } export interface RequestOptions { url?: string; protocol?: string; hostname?: string; port?: number; method?: string; pathname?: string; search?: string; hash?: string; headers?: any; timeout?: number; } export declare function urlOptions(urlObject: T): RequestOptions; export declare type RequestArg = string | RequestOptions | RequestInfo; export declare abstract class RequestManager extends Notifier { protected defaultOptionsVar: RequestOptions; readonly defaultOptions: RequestOptions; redirector: (r: RequestInfo, resolve, reject) => void; authorizer: (r: RequestInfo, resolve, reject) => void; request(arg?: RequestArg): Promise; requestForUrl(url: string): Promise; requestForOptions(options: RequestOptions): Promise; abstract requestForInfo(r: RequestInfo): Promise; abstract cancellation(r: RequestInfo): RequestInfo; get(arg?: RequestArg): Promise; put(arg: RequestArg, body: any, type?: string): Promise; post(arg: RequestArg, body: any, type?: string): Promise; patch(arg: RequestArg, body: any, type?: string): Promise; postUrl(arg: RequestArg, body: T): Promise; del(arg?: RequestArg, body?: any, type?: string): Promise; private info(m, arg?, body?, type?); infoForArg(arg?: RequestArg): RequestInfo; infoForUrl(url: string): RequestInfo; infoForOptions(options?: RequestOptions): RequestInfo; private initialInfo(options); abstract optionsForUrl(url: string): RequestOptions; protected abstract newInfo(): RequestInfo; protected handleSent(r: RequestInfo): void; protected handleRequestError(r: RequestInfo, err: Error, reject: any): void; protected handleRequestCancellation(r: RequestInfo, resolve: any): void; protected handleResponseError(r: RequestInfo, err: Error, reject: any): void; protected handleResponse(r: RequestInfo, s: number, resolve: any, reject: any): void; } export declare abstract class RequestInfo { manager: RequestManager; options: RequestOptions; locationSet: Set; locationList: string[]; readonly protocol: string; readonly hostname: string; readonly port: number; readonly host: string; readonly method: string; readonly pathname: string; readonly search: string; readonly hash: string; readonly path: string; readonly timeout: number; header(name: string): string; headerMod(name: string, value?: string): void; requestBody: any; response: any; abstract responseHeader(name: string): string; readonly abstract responseType: string; readonly abstract statusCode: number; readonly abstract statusText: string; readonly responseXml: any; private responseBodyVar; responseBody: string; private resultVar; readonly result: any; private computeResult(); readonly requestLabel: string; readonly responseLabel: string; readonly resultLabel: string; } export declare class CookieMap { private mapVar; static initial(): CookieMap; cookie(name: string): string; cookieHeader(): string; cookieAdd(name: string, value: string): void; cookieAddFromHeader(cookieHeader: string): void; cookieAddFromHeaders(cookies: Iterable): void; } export declare function manager(optImpl?: string): RequestManager; export declare function defaultImpl(): string; export declare function defaultManager(): RequestManager; export default defaultManager; export declare function defaultRedirector(r: RequestInfo, resolve: any, reject: any): void; export declare class HttpException extends Error { protected infoVar: RequestInfo; readonly info: RequestInfo; constructor(r: RequestInfo, message: string); } export declare class HttpRequestError extends HttpException { protected errVar: Error; readonly err: Error; constructor(r: RequestInfo, err: Error); } export declare class HttpResponseError extends HttpException { protected errVar: Error; readonly err: Error; constructor(r: RequestInfo, err: Error); } export declare class HttpStatusException extends HttpException { readonly code: number; constructor(r: RequestInfo); } export declare class HttpRedirectLoop extends HttpException { protected locationVar: string; readonly location: string; constructor(r: RequestInfo, loc: string); }