import { AxiosRequestConfig, AxiosInstance, AxiosResponse } from "axios";
import { GuidValue, HttpHeaders, IContextProviderCollection, IContextProvider, Future } from "../../models";
export interface HttpClientConstructor {
    configPromise?: Promise<AxiosRequestConfig>;
}
export interface HttpClientInterceptOptions {
    beforeRequest?: (requestUrl: string, baseConfig: AxiosRequestConfig, requestConfig: AxiosRequestConfig) => {
        requestUrl: string;
        baseConfig: AxiosRequestConfig;
        requestConfig: AxiosRequestConfig;
    };
}
export declare class HttpContextProviderCollection implements IContextProviderCollection {
    private registeredProviders;
    constructor();
    registerProvider: (contextProvider: IContextProvider<any>) => void;
    getContextHttpHeaders: () => Promise<HttpHeaders>;
    getHttpHeaders: () => Promise<HttpHeaders>;
    getSerializedContextRepresentation: () => Promise<string>;
    createFromContextRepresentation: (serializedContextRepresentation: string) => void;
    shouldRetryHttpRequest: (httpResponse: AxiosResponse<any>) => Promise<boolean>;
    private getProviderById;
    private mergeHeaders;
}
/**
 * Promise based HttpClient
 * @class HttpClient
 */
export declare class HttpClient {
    protected configPromise?: Promise<AxiosRequestConfig>;
    private httpContextProviderCollection;
    private tokenService;
    private static circuitBreakerBaseUrlDict;
    private static md5Util;
    private static ctxAwareRequestConfig;
    static msServiceCtxAwareRequestConfig: string;
    static interceptors: HttpClientInterceptOptions;
    protected ax: AxiosInstance;
    protected conf: AxiosRequestConfig;
    private maxCount;
    private safeHeaderNames;
    private axiosHeaderObjects;
    constructor(configPromise?: Promise<AxiosRequestConfig>);
    useConfig(conf: AxiosRequestConfig): void;
    /**
     * Handle abort functionality of abort setup
     * @param config axios config
     * @param httpClientOnAbort abort setup function of Future object type
     * @returns
     */
    private tryConfigAxiosAbortSignal;
    /**
     * Perform request using the provided request config
     * @param config axios config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    request<T = any>(config: AxiosRequestConfig): Future<AxiosResponse<T>>;
    /**
     * Perform GET request for provided url
     * @param url url
     * @param config axios config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    get<T = any>(url: string, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
    /**
     * Perform DELETE request for provided url
     * @param url url
     * @param config axios config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    delete<T = any>(url: string, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
    /**
     * Perform HEAD request for provided url
     * @param url url
     * @param config axios request config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    head(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<any>>;
    /**
     * Perform POST request for provided url
     * @param url url
     * @param data data
     * @param config axios config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
    /**
     * Perform PUT request for provided url
     * @param url url
     * @param data data
     * @param config axios config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
    /**
     * Perform PATCH request for provided url
     * @param url url
     * @param data data
     * @param config axios config
     * @param onAbortCallback abort call back of Future type from outside
     * @returns
     */
    patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Future<AxiosResponse<T>>;
    private handleAxiosError;
    private handleSuccessResponse;
    private enableCircuitBreaker;
    private checkCircuitBreaker;
    private static requestKeyHash;
    private writeHeadersToCookie;
    private removeHeadersCookie;
    private requestCtxKey;
    private expiresAt;
    private setupCtxAwareClient;
    private ensureRemoveHeadersCookie;
    private setupCtxAwareClientMSService;
    private configurePreflightKiller;
    /**
     *  Creates an AxiosRequestConfig with provided headers for calling Omnia Token Enabled API and auto inject your dns to  base url
     *  Passing the CTX in the accept header to avoid CORS preflight i.e. OPTIONS request.
     *
     *  You can call this inside your own method returning a Promise<AxiosRequestConfig> e.g. overriding with own cfg:
     *  Or create your own cfg from scratch.
     *
     *  public static myServicesRequestConfig = (): Promise<AxiosRequestConfig> => {
     *
     *      return new Promise<AxiosRequestConfig>((resolveConfig, rejectConfig) => {
     *          HttpClient.createOmniaTokenRequestConfig().then((cfg) => {
     *
     *              cfg.baseURL = "https://mydomain/service/api";
     *
     *              //+Other cfg modifications
     *
     *              resolveConfig(cfg);
     *
     *          }).catch(rejectConfig);
     *      });
     *
     *  }
     */
    static createOmniaServiceRequestConfig: (serviceId?: GuidValue, skipDomainReplacement?: boolean) => Promise<AxiosRequestConfig>;
    static createMS365ServiceRequestConfig(): Promise<AxiosRequestConfig<any>>;
    static createSPServiceRequestConfig(authorityUrl: string): Promise<AxiosRequestConfig<any>>;
    /**
     *  Creates an AxiosRequestConfig with provided headers for calling Omnia Token Enabled API
     *  Passing the CTX in the accept header to avoid CORS preflight i.e. OPTIONS request.
     *
     *  You can call this inside your own method returning a Promise<AxiosRequestConfig> e.g. overriding with own cfg:
     *  Or create your own cfg from scratch.
     *
     *  public static myServicesRequestConfig = (): Promise<AxiosRequestConfig> => {
     *
     *      return new Promise<AxiosRequestConfig>((resolveConfig, rejectConfig) => {
     *          HttpClient.createOmniaContextRequestConfig(omniaCtx.environment.omniaUrl).then((cfg) => {
     *
     *              cfg.baseURL = "https://mydomain/service/api";
     *
     *              //+Other cfg modifications
     *
     *              resolveConfig(cfg);
     *
     *          }).catch(rejectConfig);
     *      });
     *
     *  }
     */
    static createContextAwareRequestConfig: (baseUrl: string, acceptHeader?: string, skipDomainReplacement?: boolean) => Promise<AxiosRequestConfig>;
    private static getDomainRegex;
    private static rewriteSingleDomainUrls;
    private static createMSServiceContextAwareRequestConfig;
    private static get omniaBootstrapData();
    private static get omniaApp();
    private refreshAccessToken;
}
export declare function useOmniaClient(serviceId?: GuidValue): HttpClient;
