dood-stream-client
Version:
๐ A feature-rich client for the DoodStream API with caching, logging, and error handling
65 lines (64 loc) โข 1.91 kB
TypeScript
import { AxiosRequestConfig } from "axios";
import { Logger } from "winston";
import { CacheManager } from "../cache/cache-manager";
import { ClientOptions } from "../interfaces/client-options";
/**
* ๐ Base HTTP client for making API requests
*/
export declare class HttpClient {
/**
* ๐ Axios instance
*/
private client;
/**
* ๐ API key
*/
private apiKey;
/**
* ๐ Logger instance
*/
private logger;
/**
* ๐ง Cache manager
*/
private cacheManager;
/**
* Create a new HTTP client
*
* @param options - Client options
* @param logger - Logger instance
* @param cacheManager - Cache manager
*/
constructor(options: ClientOptions, logger: Logger, cacheManager: CacheManager);
/**
* ๐ Send a GET request
*
* @param endpoint - API endpoint
* @param params - Query parameters
* @param config - Axios request config
* @param enableCache - Whether to use caching for this request
* @returns Promise with response data
*/
get<T>(endpoint: string, params?: Record<string, any>, config?: AxiosRequestConfig, enableCache?: boolean): Promise<T>;
/**
* ๐ค Send a POST request
*
* @param endpoint - API endpoint
* @param data - Request body data
* @param params - Query parameters
* @param config - Axios request config
* @returns Promise with response data
*/
post<T>(endpoint: string, data?: any, params?: Record<string, any>, config?: AxiosRequestConfig): Promise<T>;
/**
* ๐งน Clear the cache for a specific endpoint
*
* @param endpoint - API endpoint
* @param params - Query parameters (excluding API key)
*/
clearCache(endpoint: string, params?: Record<string, any>): void;
/**
* ๐งน Clear the entire cache
*/
clearAllCache(): void;
}