import Bluebird from "bluebird"; import type { Activator } from "../../Activator"; interface Request { /** The content of the request. */ content?: ArrayBuffer | FormData | string; /** The headers of the request. */ headers: Record; /** The content of the request as JSON. */ json?: any; /** The request method. For example, GET, POST, PUT, DELETE, etc. */ method?: string; /** The URL of the request. */ url?: string; } interface Response { /** The content for the current request/response. */ content?: ArrayBuffer | string; /** The error for the current request/response. */ error?: Error; /** The headers for the current request/response. */ headers: Record; /** The message for the current request/response. */ message?: string; /** The payload for the current request/response. */ payload?: object; /** The status for the current request/response. */ status?: number; } export interface ChannelInfo { /** The request. */ request: Request; /** The response for the current request/response. */ response: Response; } /** @public */ export declare class ChannelProvider implements ChannelInfo { static type: string; /** Indicates if the request is binary. */ binary: boolean; /** Indicate whether to send credentials with CORS */ corsWithCredentials: boolean; /** Indicates the request. */ request: Request; /** Indicates the response for the current request/response. */ response: Response; /** Indicates the timeout. */ timeout: number; /** * The base promise is one that we create in advance but don't use until `send()` is called. * We add `timeout()` and `catch()` clauses and assign the result to `promise`, which is * subsequently used externally. */ protected basePromise: Bluebird; /** Indicates the channel name. */ protected name: string | undefined; /** Indicates the promise. */ protected promise: Bluebird | undefined; protected resolve: ((result: boolean) => void) | undefined; /** Indicates the channel type. */ protected type: typeof ChannelProvider; /** Indicates the current XHR. */ protected xhr: XMLHttpRequest | undefined; constructor(ChannelProviderType: typeof ChannelProvider, name?: string); /** * Creates a new channel. * @param channel The previous channel. * @param name The channel by name. */ static create(channel?: ChannelProvider, name?: string): ChannelProvider; static register(activator: Activator): void; /** Cancels the request. */ cancel(): void; /** * 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: object | undefined): object | undefined; /** Constructs a new request from this channel. */ new(): ChannelProvider; /** Sends the request. */ send(): Bluebird; /** * Attempts to conclude the request. * @param error */ protected tryConclude(error?: Error): void; } export {};