76 lines
1.9 KiB
TypeScript
76 lines
1.9 KiB
TypeScript
/**
|
|
* Common interfaces shared across all UniFi APIs
|
|
*/
|
|
|
|
/**
|
|
* Standard UniFi API response wrapper
|
|
*/
|
|
export interface IUnifiApiResponse<T> {
|
|
meta: {
|
|
rc: 'ok' | 'error';
|
|
msg?: string;
|
|
};
|
|
data: T[];
|
|
}
|
|
|
|
/**
|
|
* Options for UniFi Account (Site Manager cloud API)
|
|
*/
|
|
export interface IUnifiAccountOptions {
|
|
/** API key from ui.com */
|
|
apiKey: string;
|
|
}
|
|
|
|
/**
|
|
* Options for UniFi Controller (Network Controller local API)
|
|
* Supports either API key auth OR username/password session auth
|
|
*/
|
|
export interface IUnifiControllerOptions {
|
|
/** Controller host (IP or hostname) */
|
|
host: string;
|
|
/** API key for authentication (preferred) */
|
|
apiKey?: string;
|
|
/** Username for session authentication */
|
|
username?: string;
|
|
/** Password for session authentication */
|
|
password?: string;
|
|
/** Controller type - affects API paths */
|
|
controllerType?: 'unifi-os' | 'udm-pro' | 'standalone';
|
|
/** Whether to verify SSL certificates (default: false for self-signed) */
|
|
verifySsl?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Options for UniFi Protect (NVR local API)
|
|
* Supports either API key auth OR username/password session auth
|
|
*/
|
|
export interface IUnifiProtectOptions {
|
|
/** Protect host (IP or hostname) */
|
|
host: string;
|
|
/** API key for authentication (preferred) */
|
|
apiKey?: string;
|
|
/** Username for session authentication */
|
|
username?: string;
|
|
/** Password for session authentication */
|
|
password?: string;
|
|
/** Whether to verify SSL certificates (default: false for self-signed) */
|
|
verifySsl?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Options for UniFi Access (Access Controller local API)
|
|
*/
|
|
export interface IUnifiAccessOptions {
|
|
/** Access host (IP or hostname) */
|
|
host: string;
|
|
/** Bearer token for authentication */
|
|
token: string;
|
|
/** Whether to verify SSL certificates (default: false for self-signed) */
|
|
verifySsl?: boolean;
|
|
}
|
|
|
|
/**
|
|
* HTTP request method types
|
|
*/
|
|
export type THttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|