import { Config, Json } from "../interfaces";
import { HTTPHeaders, QueryParams, Response, ServerConfig, UploadProgress } from "./interfaces";
/**
 * A low level abstraction for communicating with an API server.
 *
 * In most cases direct use of this class will not be needed. It is recommended
 * to extend the
 *
 */
export declare class APIServer {
    /**
     * The hostname and protocol of the server.
     */
    _baseurl: string;
    /**
     * The request timeout in milliseconds.
     */
    timeout: number;
    /**
     * Number of times to retry timed out requests.
     */
    retries: number;
    /**
     * Headers to be applied to every request.
     */
    headers: HTTPHeaders;
    /**
     * Promise for the JWT token
     */
    readonly tokenPromise: Promise<string | null>;
    constructor({ baseurl, timeout, retries, headers }?: ServerConfig);
    /**
     * The base url for the server.
     *
     * @note The baseurl is normalised to remove any trailing '/'
     */
    get baseurl(): string;
    set baseurl(baseurl: string);
    /**
     * Make a post request to the API server.
     *
     * @param path The path to the endpoint on the API server.
     * @param queryParams Any query parameters that should be added.
     * @param payload The data to send with the request.
     * @param onUploadProgress allows handling of progress events for uploads.
     *
     * @returns The response from the server.
     */
    post(path: string, queryParams?: QueryParams, payload?: Json | File | FormData, onUploadProgress?: UploadProgress): Promise<Response>;
    patch(path: string, resourceId?: string, queryParams?: QueryParams, payload?: Json | File | FormData): Promise<Response>;
    /**
     * Make a put request to the API server.
     *
     * @param path The path to the endpoint on the API server.
     * @param resourceId The resource id of the resource we want to fetch.
     * @param queryParams Any query parameters that should be added.
     * @param payload The data to send with the request.
     *
     * @returns The response from the server.
     */
    put(path: string, resourceId: string, queryParams?: QueryParams, payload?: Json): Promise<Response>;
    /**
     * Make a get request to the API server.
     *
     * @param path The path to the endpoint on the API server.
     * @param resourceId The resource id of the resource we want to fetch.
     * @param queryParams Any query parameters that should be added.
     *
     * @returns The response from the server.
     */
    get(path: string, resourceId?: string, queryParams?: QueryParams, { cancelToken }?: Config): Promise<Response>;
    /**
     * Make a delete request to the API server.
     *
     * @param path The path to the endpoint on the API server.
     * @param resourceId The resource id of the resource we want to fetch.
     * @param payload The data to send with the request.
     *
     * @returns The response from the server.
     */
    delete(path: string, resourceId: string, payload?: Json): Promise<Response>;
    /**
     * Make a delete request to the API server.
     * The difference between this method and the delete method
     * is that this one doesn't need a resourceId, and it also accepts
     * query params
     *
     * @param path The path to the endpoint on the API server.
     * @param payload The data to send with the request.
     * @param queryParams Query Params to send in the url.
     *
     * @returns The response from the server.
     */
    bulk_delete(path: string, payload?: Json, queryParams?: QueryParams): Promise<Response>;
    /**
     * Make a put request to the API server.
     * The difference between this method and the put method
     * is that this one doesn't need a resourceId, and it also accepts
     * query params
     *
     * @param path The path to the endpoint on the API server.
     * @param payload The data to send with the request.
     * @param queryParams Query Params to send in the url.
     *
     * @returns The response from the server.
     */
    bulk_put(path: string, payload?: Json, queryParams?: QueryParams): Promise<Response>;
    /**
     * Send the request to the server.
     *
     * @param method The http method
     * @param path The path to the resource.
     * @param queryParams The query parameters to include with the request.
     * @param payload The data to send with the request.
     * @param headers The headers to attach to the request.
     * @param onUploadProgress allows handling of progress events for uploads.
     *
     * @returns The server response.
     */
    private sendRequest;
    /**
     * Make the configuration object for the `Request`.
     *
     * @param queryParams The query parameters to include with the request.
     * @param payload The data to send with the request.
     * @param headers The headers to attach to the request.
     * @param onUploadProgress allows handling of progress events for uploads.
     *
     * @returns The config to use when making the request.
     */
    private makeRequestConfig;
    /**
     * Make sure path has starting and trailing '/'.
     *
     * @param path The path to the resource.
     *
     * @returns The normalised path.
     */
    private normalisePath;
}
