feat(unifi): implement comprehensive UniFi API client with controllers, protect, access, account, managers, resources, HTTP client, interfaces, logging, plugins, and tests
This commit is contained in:
75
ts/interfaces/common.ts
Normal file
75
ts/interfaces/common.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 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';
|
||||
Reference in New Issue
Block a user