/**
 *
 * API
 *
 * Generic API class and factory, plus some utilities.  Use with product-specific endpoints to
 * create product-specific functional APIs.
 *
 */
/**
 * Enum for available API methods.
 * @readonly
 * @enum string}
 */
export declare enum Method {
    GET = "GET",
    POST = "POST",
    PUT = "PUT",
    DELETE = "DELETE"
}
export declare type Endpoint = string;
export interface APIOptions {
    id?: string | number;
    params?: Record<string, string | number | boolean>;
    headers?: Record<string, string | number | boolean>;
    fetchInit?: {};
}
declare class API<E extends Endpoint> {
    host: string;
    constructor(host: string);
    /**
     * Base api call function.
     *
     * @param {Endpoint} endpoint - target for request
     * @param {Method} method - HTTP method to use
     * @param {Object} [options] - optional parameters
     * @param {string | number} [options.id] - id of resource at endpoint to be retrieved
     * @param {Object} [options.params] - url parameters
     * @param {Object} [options.body] - body data to supply to fetch request
     * @param {Object} [options.headers] - HTTP headers to supply to fetch
     * @param {Object} [options.fetchInit] - catchall for other fetch init options
     * @returns {Promise<Response>}
     */
    callEndpoint(endpoint: E, method: Method, options?: APIOptions): Promise<Response>;
    /**
     * Async version of base api call function.
     *
     * @param {Endpoint} endpoint - target for request
     * @param {Method} method - HTTP method to use
     * @param {Object} [options] - optional parameters
     * @param {string | number} [options.id] - id of resource at endpoint to be retrieved
     * @param {Object} [options.params] - url parameters
     * @param {Object} [options.body] - body data to supply to fetch request
     * @param {Object} [options.headers] - HTTP headers to supply to fetch
     * @param {Object} [options.fetchInit] - catchall for other fetch init options
     * @returns {Object | null}
     */
    callAndProcessEndpoint<T = any>(endpoint: E, method: Method, options?: APIOptions): Promise<ResponsePackage<T>>;
}
export interface ResponsePackage<T> {
    data?: T;
    error?: string;
}
export declare function createAPI<E extends Endpoint>(host: string): API<E>;
export {};
