import Bluebird from "../../deps/bluebird_fork";
import { Lookup } from "../../Collections";
import { Activator } from "../../Activator";
export interface Request {
    /** The URL of the request. */
    url?: string;
    /** The request method. For example, GET, POST, PUT, DELETE, etc. */
    method?: string;
    /** The headers of the request. */
    headers: Lookup<string | string[]>;
    /** The content of the request. */
    content?: ArrayBuffer | string;
    /** The content of the request as JSON. */
    json?: any;
}
export interface Response {
    /** The error for the current request/response. */
    error?: Error;
    /** The status for the current request/response. */
    status?: number;
    /** The message for the current request/response. */
    message?: string;
    /** The headers for the current request/response. */
    headers: Lookup<string | string[]>;
    /** The content for the current request/response. */
    content?: ArrayBuffer | string;
    /** The payload for the current request/response. */
    payload?: {};
}
export interface ChannelInfo {
    /** The request. */
    request: Request;
    /** The response for the current request/response. */
    response: Response;
}
export declare class ChannelProvider implements ChannelInfo {
    static type: string;
    static register(activator: Activator): void;
    /**
     * Creates a new channel.
     * @param channel The previous channel.
     * @param name The channel by name.
     */
    static create(channel?: ChannelProvider, name?: string): ChannelProvider;
    constructor(type: typeof ChannelProvider, name?: string);
    /** Indicates the channel name. */
    protected name: string;
    /** Indicates the channel type. */
    protected type: typeof ChannelProvider;
    /** Indicates the current XHR. */
    protected xhr: XMLHttpRequest;
    /** Indicates the resolver. */
    protected resolver: Bluebird.Resolver<boolean>;
    /** Indicates the promise. */
    protected promise: Bluebird<boolean>;
    /**
     * Attempts to conclude the request.
     * @param error
     */
    protected tryConclude(error?: Error): void;
    /** Indicates the request. */
    request: Request;
    /** Indicates the response for the current request/response. */
    response: Response;
    /** Indicates if the request is binary. */
    binary: boolean;
    /** Indicates the timeout. */
    timeout: number;
    /** Indicate whether to send credentials with CORS */
    corsWithCredentials: boolean;
    /** Cancels the request. */
    cancel(): void;
    /** Sends the request. */
    send(): any;
    /**
     * This method appears redundant, but it's needed because esri 4
     * puts the interesting stuff in the payload within a "data" element,
     * which we need to use instead in the appropriate sub class.
     * @param payload The payload returned by an esri request.
     */
    getResponseData(payload: {}): {};
    /** Constructs a new request from this channel. */
    new(): ChannelProvider;
}
