UNPKG

@blue-impact-engine/blue-impact-engine-client

Version:
83 lines 2.33 kB
/** * Core HTTP client for Blue Impact Engine API * Handles authentication, request/response processing, and error handling */ import { ClientConfig, RequestOptions, QueryParams, ApiResponse } from './types'; /** * HTTP client for Blue Impact Engine API * Provides a robust interface for making API calls with built-in error handling, * retry logic, and response validation. */ export declare class HttpClient { private client; private config; private retryCount; constructor(config: ClientConfig); /** * Setup request and response interceptors */ private setupInterceptors; /** * Handle response errors with proper error mapping */ private handleResponseError; private appendQueryFilterParam; private appendQueryParam; /** * Build query string from parameters */ private buildQueryString; /** * Execute request with retry logic */ private executeRequest; /** * Determine if a request should be retried */ private shouldRetry; /** * Delay execution for retry logic */ private delay; /** * Make a GET request */ get<T>(endpoint: string, params?: QueryParams, options?: RequestOptions): Promise<ApiResponse<T>>; /** * Make a POST request */ post<T>(endpoint: string, data?: any, options?: RequestOptions): Promise<ApiResponse<T>>; /** * Make a PUT request */ put<T>(endpoint: string, data?: any, options?: RequestOptions): Promise<ApiResponse<T>>; /** * Make a PATCH request */ patch<T>(endpoint: string, data?: any, options?: RequestOptions): Promise<ApiResponse<T>>; /** * Make a DELETE request */ delete<T>(endpoint: string, options?: RequestOptions): Promise<ApiResponse<T>>; /** * Download a file */ download(endpoint: string, params?: QueryParams, options?: RequestOptions): Promise<Blob>; /** * Update client configuration */ updateConfig(newConfig: Partial<ClientConfig>): void; /** * Get current configuration */ getConfig(): ClientConfig; /** * Set API key for authentication */ setApiKey(apiKey: string): void; /** * Clear API key */ clearApiKey(): void; } //# sourceMappingURL=http-client.d.ts.map