aluvia-ts-sdk
Version:
Official Aluvia proxy management SDK for Node.js and modern JavaScript environments
38 lines • 1.37 kB
TypeScript
/** The default Aluvia API endpoint */
export declare const API_ORIGIN: string;
/**
* Configuration options for API requests
* @internal
*/
interface ApiRequestOptions {
method?: string;
headers?: Record<string, string>;
body?: string;
}
/**
* Universal HTTP client that works in both Node.js and browser environments.
*
* Uses native fetch where available, with automatic fallback to node-fetch
* for older Node.js versions. Provides a consistent interface for all HTTP operations.
*
* @internal
*/
export declare class ApiClient {
private baseURL;
private fetchInstance;
constructor(baseURL?: string);
private getFetch;
request<T>(endpoint: string, options?: ApiRequestOptions): Promise<T>;
/**
* Handles HTTP error responses and throws appropriate error types
*/
private handleErrorResponse;
get<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
post<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
put<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
delete<T>(endpoint: string, headers?: Record<string, string>): Promise<T>;
patch<T>(endpoint: string, data?: any, headers?: Record<string, string>): Promise<T>;
}
export declare const api: ApiClient;
export {};
//# sourceMappingURL=api-client.d.ts.map