import { AxiosRequestConfig, AxiosResponse } from 'axios'; import { AuthError } from './errors'; /** HTTP client configuration */ export interface HttpClientConfig { baseURL: string; apiKey?: string | undefined; headers?: { [key: string]: string; } | undefined; timeout?: number | undefined; debug?: boolean | undefined; autoRefreshToken?: boolean | undefined; refreshTokenFn?: (() => Promise) | undefined; /** Callback when 401 unauthorized error occurs or refresh fails */ onUnauthorized?: (() => void) | undefined; /** Callback when session is refreshed successfully */ onSessionRefreshed?: ((session: any) => void) | undefined; /** Callback for general auth errors */ onAuthError?: ((error: AuthError) => void) | undefined; } export interface DerivedHttpClientOptions { baseURL: string; } /** Request options - extends AxiosRequestConfig for maximum flexibility */ export interface RequestOptions extends Omit { noResolveJson?: boolean; redirectTo?: string; body?: any; } /** HTTP client for slauth API */ export declare class HttpClient { private client; private debug; protected config: HttpClientConfig; private refreshInFlight; constructor(config: HttpClientConfig); private refreshTokenSingleflight; /** Setup interceptors */ private setupInterceptors; /** Set authorization header */ setAuth(token: string | null): void; /** Create another HttpClient that shares auth/refresh semantics but targets a different baseURL */ createDerivedClient(options: DerivedHttpClientOptions): HttpClient; /** Make a GET request */ get(url: string, options?: RequestOptions): Promise>; /** Make a POST request */ post(url: string, body?: any, options?: RequestOptions): Promise>; /** Make a PUT request */ put(url: string, body?: any, options?: RequestOptions): Promise>; /** Make a PATCH request */ patch(url: string, body?: any, options?: RequestOptions): Promise>; /** Make a DELETE request */ delete(url: string, options?: RequestOptions): Promise>; /** Fetch-style request that always resolves HTTP responses, preserving refresh semantics */ fetch(url: string, options?: AxiosRequestConfig): Promise>; private requestWithFetchSemantics; /** Handle axios errors and convert to AuthError */ private handleError; } /** Create HTTP client instance */ export declare function createHttpClient(config: HttpClientConfig): HttpClient; //# sourceMappingURL=fetch.d.ts.map