/**
 * Retrieves data from a remote server or uploads a file.
 *
 * @since 4.0
 * @see [Sample - Request data from a remote server](https://developers.arcgis.com/javascript/latest/sample-code/request/)
 * @see [Sample - Search component with custom source](https://developers.arcgis.com/javascript/latest/sample-code/search-component-customsource/)
 * @example
 * // request GeoJson data from USGS remote server
 * let url = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.geojson";
 *
 * esriRequest(url, {
 *   responseType: "json"
 * }).then((response) => {
 *   // The requested data
 *   let geoJson = response.data;
 * });
 */
import type { RequestOptions, RequestResponse } from "./request/types.js";

/**
 * Retrieves data from a remote server or uploads a file from a user's computer. If the request returns an [Error](https://developers.arcgis.com/javascript/latest/references/core/core/Error/),
 * the error object will include the details specified in [RequestErrorDetails](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestErrorDetails).
 *
 * @param url - The request URL.
 * @param options - The options specified by the user in the data request. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions) for available properties.
 * @returns Returns a promise that resolves to an object with the [RequestResponse](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestResponse) specification. If the request returns an [Error](https://developers.arcgis.com/javascript/latest/references/core/core/Error/), the error object will include the details specified in [RequestErrorDetails](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestErrorDetails).
 */
export default function request<T = any>(url: string | URL, options?: RequestOptions): Promise<RequestResponse<T>>;