import { AxiosRequestConfig, AxiosResponse } from "axios"; import type { AxiosError } from "axios"; import { RateLimiter } from "./RateLimiter.js"; /** * Controls automatic retry behavior applied to outgoing requests. */ export interface RetryOptions { /** * Maximum retry attempts. Defaults to 3. */ retries?: number; /** * Allow retries for POST requests. Disabled by default. */ allowPostRetry?: boolean; /** * Hook invoked prior to an automatic retry attempt. */ onRetry?: (retryCount: number, error: AxiosError, requestConfig: AxiosRequestConfig) => void; } /** * Configuration accepted by {@link HttpClient}. These options align with the runtime guarantees * described in the SDK README (base URL, bearer token, timeout, retries, and rate limiting). */ export interface HttpClientConfig { baseURL?: string; timeoutMs?: number; authToken?: string; defaultHeaders?: Record; axiosOptions?: AxiosRequestConfig; retry?: RetryOptions; rateLimiter?: RateLimiter | null; } /** * Per-request overrides that extend the underlying axios request configuration. */ export interface HttpRequestOptions extends AxiosRequestConfig { /** * Override the bearer token for this request. */ authToken?: string; /** * Include an Idempotency-Key header to support safe retries for non-idempotent verbs. */ idempotencyKey?: string; /** * Skip acquiring a rate-limiter token for this request. */ useRateLimiter?: boolean; } /** * HTTP abstraction that layers CompanyCam specific defaults - timeouts, retries, rate limiting, * and bearer authentication - on top of axios. */ export declare class HttpClient { private readonly axiosInstance; private readonly rateLimiter; private readonly ownsRateLimiter; private readonly defaultHeaders; private readonly allowPostRetry; private readonly authToken?; /** * Create a new HTTP client instance. * * @param config Optional overrides for base URL, timeout, bearer token, retry policy, and rate limiter. */ constructor(config?: HttpClientConfig); /** * Perform an HTTP request with the configured defaults and return the raw axios response. * * @param options Axios request configuration along with SDK-specific overrides such as * bearer token overrides, idempotency keys, and rate-limiter hints. * @returns The axios response object containing the typed payload. * @throws {APIError} When the underlying request fails with a non-success status code. */ request(options: HttpRequestOptions): Promise>; /** * Dispose of owned resources such as the internal rate limiter. */ dispose(): void; private prepareRequestConfig; private shouldRetry; private computeRetryDelay; private getRetryAfterDelay; } //# sourceMappingURL=HttpClient.d.ts.map