import type { RequestConfig } from '@ace-fetch/core'; export interface Interceptor { fulfilled?: (value: V) => T | Promise; rejected?: (error: any) => any; synchronous: boolean; runWhen: ((config: RequestConfig) => boolean) | null; } export interface InterceptorOptions { synchronous?: boolean; runWhen?: (config: RequestConfig) => boolean; } export declare class InterceptorManager { handlers: Array; /** * Add a new interceptor to the stack * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * @return {Number} An ID used to remove interceptor later */ use(fulfilled?: Interceptor['fulfilled'], rejected?: Interceptor['rejected'], options?: InterceptorOptions): number; /** * Remove an interceptor from the stack * @param {Number} id The ID that was returned by `use` * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise */ eject(id: number): void; /** * Clear all interceptors from the stack * @returns {void} */ clear(): void; /** * Iterate over all the registered interceptors * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * @param {Function} fn The function to call for each interceptor * @returns {void} */ forEach(fn: Function): void; }