import RequestResponse = __esri.RequestResponse;
export declare const BASE_PATH: string;
export declare class BaseAPI {
    protected configuration: Configuration;
    private middleware;
    constructor(configuration?: Configuration);
    withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
    withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
    withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
    protected request(context: RequestOpts, initOverrides?: RequestInit): Promise<RequestResponse>;
    private createEsriRequestParams;
    private esriRequestApi;
    private clone;
}
export declare class RequiredError extends Error {
    field: string;
    name: "RequiredError";
    constructor(field: string, msg?: string);
}
export declare const COLLECTION_FORMATS: {
    csv: string;
    ssv: string;
    tsv: string;
    pipes: string;
};
export interface ConfigurationParameters {
    basePath?: string;
    middleware?: Middleware[];
    queryParamsStringify?: (params: HTTPQuery) => string;
    username?: string;
    password?: string;
    apiKey?: string | ((name: string) => string);
    accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
    headers?: HTTPHeaders;
    credentials?: RequestCredentials;
}
export declare class Configuration {
    private configuration;
    constructor(configuration?: ConfigurationParameters);
    get basePath(): string;
    get middleware(): Middleware[];
    get queryParamsStringify(): (params: HTTPQuery) => string;
    get username(): string | undefined;
    get password(): string | undefined;
    get apiKey(): ((name: string) => string) | undefined;
    get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
    get headers(): HTTPHeaders | undefined;
    get credentials(): RequestCredentials | undefined;
}
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
export type HTTPHeaders = {
    [key: string]: string;
};
export type HTTPQuery = {
    [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | HTTPQuery;
};
export type HTTPBody = Json | FormData | URLSearchParams;
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export interface EsriRequestParams {
    url: string;
    init: RequestInit;
}
export interface RequestOpts {
    path: string;
    method: HTTPMethod;
    headers: HTTPHeaders;
    query?: HTTPQuery;
    body?: HTTPBody;
    responseType?: 'json' | 'text' | 'array-buffer' | 'blob' | 'image' | 'native' | 'document' | 'xml';
}
export declare function exists(json: any, key: string): boolean;
export declare function querystring(params: HTTPQuery, prefix?: string): string;
export declare function mapValues(data: any, fn: (item: any) => any): {};
export declare function canConsumeForm(consumes: Consume[]): boolean;
export interface Consume {
    contentType: string;
}
export interface RequestContext {
    url: string;
    init: RequestInit;
}
export interface ResponseContext {
    url: string;
    init: RequestInit;
    response: RequestResponse;
}
export interface Middleware {
    pre?(context: RequestContext): Promise<EsriRequestParams | void>;
    post?(context: ResponseContext): Promise<RequestResponse | void>;
}
export interface ApiResponse<T> {
    raw: RequestResponse;
    value(): T;
}
export interface ResponseTransformer<T> {
    (json: any): T;
}
export declare class JSONApiResponse<T> {
    raw: RequestResponse;
    private transformer;
    constructor(raw: RequestResponse, transformer?: ResponseTransformer<T>);
    value(): T;
}
export declare class VoidApiResponse {
    raw: RequestResponse;
    constructor(raw: RequestResponse);
    value(): void;
}
export declare class BlobApiResponse {
    raw: RequestResponse;
    constructor(raw: RequestResponse);
    value(): Blob;
}
export declare class TextApiResponse {
    raw: RequestResponse;
    constructor(raw: RequestResponse);
    value(): string;
}
