import type { RequestOptions, RequestResponse } from "./esri.js";
/**
 * Options that can be passed into
 * {@link support/ArcGISRequestHelper!ArcGISRequestHelper.request}.
 */
export interface ArcGISRequestOptions {
    /**
     * See {@link support/ArcGISRequestHelper!ArcGISRequestHelper.ttl}.
     */
    ttl?: number;
    /**
     * See
     * {@link support/ArcGISRequestHelper!ArcGISRequestHelper.batchLayerRequests}.
     */
    batchLayerRequests?: boolean;
    /**
     * If the request URL points to a web server that requires parameters,
     * specify them here.
     */
    query?: Record<string, string>;
    /**
     * Response format. When this value is `image` the `headers` and `timeout`
     * options are ignored. **Possible Values:** json | xml | text | blob |
     * array-buffer | document | image.
     */
    responseType?: RequestOptions["responseType"];
    /**
     * Headers to use for the request. This is an object whose property names
     * are header names. This option is ignored when `responseType = "image"`.
     */
    headers?: Record<string, string>;
    /**
     * Indicates if the request should be made using the HTTP POST method. By
     * default, this is determined automatically based on the request size.
     * **Possible Values:** auto | post.
     */
    method?: RequestOptions["method"];
    /**
     * If uploading a file, specify the form data or element used to submit the
     * file here. If a form element is specified, the parameters of the `query`
     * will be added to the URL. If not specified, then query parameters will
     * only be added to the URL when a GET request is used. If POST is used,
     * then query parameters will be added to the body.
     */
    body?: FormData | string;
}
/**
 * A response from calling `request()`.
 */
export interface ArcGISRequestHelperResponse<T = unknown> extends Omit<RequestResponse, "data"> {
    /**
     * The response data.
     */
    data: T;
}
/**
 * The request helper to be used when making requests through ArcGIS objects.
 */
export interface ArcGISRequestHelper {
    /**
     * The amount of time (in milliseconds) to cache the response for. The
     * default is 30 seconds.
     */
    ttl: number;
    /**
     * If true, the first request for a single layer in a MapServer will cause
     * all layers to be fetched at once.
     */
    batchLayerRequests: boolean;
    /**
     * Makes a request to a url and returns a response.
     *
     * @param url The URL at which to send the request.
     * @param options The options for the request.
     */
    request<T = unknown>(url: string, options?: ArcGISRequestOptions): Promise<ArcGISRequestHelperResponse<T>>;
}
/**
 * A {@link utilities/RequestHelper!RequestHelper} for making requests to ArcGIS
 * services.
 *
 * The request helper supports caching of responses. To control how long
 * responses are cached, set the ttl option when making requests.
 */
export declare class DefaultArcGISRequestHelper implements ArcGISRequestHelper {
    /**
     * @inheritDoc
     */
    ttl: number;
    /**
     * @inheritDoc
     */
    batchLayerRequests: boolean;
    constructor(properties?: ArcGISRequestOptions);
    /**
     * Creates and returns a WebSocket object.
     *
     * @param url The web socket URL.
     */
    createSocket(url: string): WebSocket;
    /**
     * Makes a request to a url and returns a response.
     *
     * @param url The URL at which to send the request.
     * @param options The options for the request.
     */
    request<T = unknown>(url: string, options?: ArcGISRequestOptions): Promise<ArcGISRequestHelperResponse<T>>;
    private _doRequest;
}
