import type { ICache } from '../cache/deckCacheFactory';
declare type IPrimitive = string | boolean | number;
declare type IParams = Record<string, IPrimitive | IPrimitive[]>;
interface Headers {
    [headerName: string]: string;
}
/**
 * A Builder API for making requests to Gate backend service
 */
export interface IRequestBuilder {
    /**
     * Appends one or more path segments to the URL, separated by slashes.
     * Each path segment is uri encoded.
     */
    path(...pathSegments: IPrimitive[]): this;
    headers(headers: Headers): this;
    /** Adds query parameters to the URL */
    query(queryParams: IParams): this;
    /** Enables or disables caching of the response */
    useCache(useCache?: boolean): this;
    /** issues a GET request */
    get<T = any>(): PromiseLike<T>;
    /** issues a POST request */
    post<T = any, P = any>(data?: P): PromiseLike<T>;
    /** issues a PUT request */
    put<T = any, P = any>(data?: P): PromiseLike<T>;
    /** issues a PATCH request */
    patch<T = any, P = any>(data?: P): PromiseLike<T>;
    /** issues a DELETE request */
    delete<T = any, P = any>(data?: P): PromiseLike<T>;
}
/**
 * Internal interface to encapsulate a request
 * Passed to the IHttpClientImplementation
 */
interface IRequestBuilderConfig {
    url: string;
    timeout?: number;
    headers?: Headers;
    /** @deprecated used for AngularJS backwards compat */
    data?: any;
    params?: object;
    cache?: boolean;
}
/**
 * The old API interface
 */
export interface IDeprecatedRequestBuilder extends IRequestBuilder {
    useCache(): this;
    useCache(useCache: boolean): this;
    useCache(useCache: ICache): this;
    withParams(queryParams: IParams): this;
    /** @deprecated do not use this config object */
    config: IRequestBuilderConfig;
    /** @deprecated use SETTINGS.gateUrl */
    baseUrl: string;
    /** @deprecated use path() instead (this is a passthrough to path) */
    one(...urls: string[]): this;
    /** @deprecated use one() instead (this is a passthrough to one) */
    all(...urls: string[]): this;
    /** @deprecated use put(data) or post(data) instead */
    data(data: any): this;
    get<T = any>(params?: IParams): PromiseLike<T>;
    /** @deprecated use delete() instead (this is a passthrough to delete) */
    remove(params?: IParams): PromiseLike<any>;
    /** @deprecated use get() instead (this is a passthrough to get) */
    getList<T = any>(params?: IParams): PromiseLike<T>;
}
/**
 * An interface to support pluggable http clients
 * In the future, we should have a TestingHttpClient and a FetchHttpClient (or whatever http client we go with)
 */
export interface IHttpClientImplementation {
    get<T = any>(config: IRequestBuilderConfig): PromiseLike<T>;
    post<T = any>(config: IRequestBuilderConfig): PromiseLike<T>;
    put<T = any>(config: IRequestBuilderConfig): PromiseLike<T>;
    patch<T = any>(config: IRequestBuilderConfig): PromiseLike<T>;
    delete<T = any>(config: IRequestBuilderConfig): PromiseLike<T>;
}
export declare class InvalidAPIResponse extends Error {
    originalResult: any;
    data: {
        message: string;
    };
    constructor(message: string, originalResult: any);
}
/** The base request builder implementation */
export declare class RequestBuilder implements IRequestBuilder {
    protected config: IRequestBuilderConfig;
    protected _httpClient?: IHttpClientImplementation;
    protected _baseUrl?: string;
    static defaultHttpClient: IHttpClientImplementation;
    constructor(config?: IRequestBuilderConfig, _httpClient?: IHttpClientImplementation, _baseUrl?: string);
    protected builder(newRequest: IRequestBuilderConfig): this;
    protected get httpClient(): IHttpClientImplementation;
    protected get baseUrl(): string;
    path(...paths: IPrimitive[]): this;
    headers(headers: Headers): this;
    get<T>(queryParams?: object): PromiseLike<T>;
    post<T>(postData?: any): PromiseLike<T>;
    put<T>(putData?: any): PromiseLike<T>;
    patch<T>(putData?: any): PromiseLike<T>;
    delete<T>(deleteData?: any): PromiseLike<T>;
    useCache(cache?: boolean): this;
    query(queryParams: IParams): this;
}
/**
 * This class extends RequestBuilder and re-implements the deprecated API for backwards compat
 * @deprecated
 */
export declare class DeprecatedRequestBuilder extends RequestBuilder implements IDeprecatedRequestBuilder {
    protected builder: (newRequest: IRequestBuilderConfig) => this;
    config: IRequestBuilderConfig;
    get baseUrl(): string;
    getList: any;
    one: any;
    all: any;
    remove: any;
    data: (data: any) => this;
    withParams: any;
    useCache: (cache?: boolean | ICache) => this;
}
export declare const invalidContentMessage = "API response was neither JSON nor zero-length html or text";
export declare function makeRequestBuilderConfig(pathPrefix?: string): IRequestBuilderConfig;
/** @deprecated use REST('/path/to/gate/endpoint') */
export declare const API: IDeprecatedRequestBuilder;
/**
 * A REST client used to access Gate endpoints
 * @param staticPathPrefix a static string, i.e., '/proxies/foo/endpoint' --
 *        avoid dynamic strings like `/entity/${id}`, use .path('entity', id) instead
 */
export declare const REST: (staticPathPrefix?: string) => IRequestBuilder;
export {};
