@panoptic-it-solutions/unifi-api-client
Version:
A Node.js client library for the UniFi Controller API
30 lines (29 loc) • 959 B
TypeScript
import { Logger } from './utils/logger';
export declare class HttpClient {
private client;
private cookies;
private baseUrl;
private logger;
constructor(baseUrl: string, options?: {
strictSSL?: boolean;
timeout?: number;
headers?: Record<string, string>;
logger?: Logger;
});
private handleResponse;
private handleRequest;
get(path: string, params?: any): Promise<any>;
post(path: string, data?: any): Promise<any>;
put(path: string, data?: any): Promise<any>;
delete(path: string): Promise<any>;
/**
* Perform a POST request with custom Axios options (e.g., for binary downloads)
* @param path The API path
* @param data The POST body
* @param options Additional Axios request options
* @returns The full Axios response
*/
postRaw(path: string, data?: any, options?: any): Promise<any>;
private handleError;
clearCookies(): void;
}