import { Future } from '@quenk/noni/lib/control/monad/future'; import { Request } from '../request'; import { Container } from '../cookie/container'; import { Host } from '../request/host'; import { Path } from '../request/path'; import { Parameters } from '../request/parameters'; import { Options as RequestOptions } from '../request/options'; import { Response } from '../response'; import { Transport } from './transport'; import { Plugin } from './plugin'; /** * defaultOptions */ export declare const defaultOptions: { ttl: number; tags: {}; context: {}; }; /** * Options for configuring the agent. */ export interface Options extends RequestOptions { /** * port requests will be made one. */ port: number; } /** * HTTPAgent is the API Agents provide. */ export interface HTTPAgent { /** * head request shorthand. */ head(path: Path, params: Parameters, options?: Partial): Future>; /** * get request shorthand. */ get(path: Path, params: Parameters, options?: Partial): Future>; /** * post request shorthand. */ post(path: Path, body?: ReqRaw, options?: Partial): Future>; /** * put request shorthand. */ put(path: Path, body?: ReqRaw, options?: Partial): Future>; /** * patch request shorthand. */ patch(path: Path, body?: ReqRaw, options?: Partial): Future>; /** * delete request shorthand. */ delete(path: Path, body?: ReqRaw, options?: Partial): Future>; /** * send a network request. */ send(req: Request): Future>; } /** * Agent acts as an HTTP client. * * An Agent instance uses its transport to send HTTP requests * and receive responses. */ export declare class Agent implements HTTPAgent { host: Host; cookies: Container; options: Partial; transport: Transport; plugins: Plugin[]; constructor(host: Host, cookies: Container, options: Partial, transport: Transport, plugins: Plugin[]); /** * setTransport allows the transport to be changed (possibly to process * a different type of response). * * A new Agent instance is created with NO plugins installed. */ setTransport(transport: Transport, plugins?: Plugin[]): Agent; head(path: Path, params?: Parameters, options?: Partial): Future>; get(path: Path, params?: Parameters, options?: Partial): Future>; post(path: Path, body?: ReqRaw, options?: Partial): Future>; put(path: Path, body?: ReqRaw, options?: Partial): Future>; patch(path: Path, body?: ReqRaw, options?: Partial): Future>; delete(path: Path, body?: ReqRaw, options?: Partial): Future>; send(req: Request): Future>; }