Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
/**
|
|
* Service for managing events and alarms
|
|
*/
|
|
|
|
import { UnifiClient } from '../client/UnifiClient.js';
|
|
|
|
export interface Event {
|
|
_id: string;
|
|
key?: string;
|
|
msg?: string;
|
|
time?: number;
|
|
[key: string]: any;
|
|
}
|
|
|
|
export interface Alarm {
|
|
_id: string;
|
|
key?: string;
|
|
msg?: string;
|
|
time?: number;
|
|
archived?: boolean;
|
|
[key: string]: any;
|
|
}
|
|
|
|
export class EventsService {
|
|
constructor(private client: UnifiClient) {}
|
|
|
|
/**
|
|
* List events (Private API)
|
|
*/
|
|
async listEvents(limit?: number): Promise<Event[]> {
|
|
const response = await this.client.request<Event[]>('GET', '/stat/event', {
|
|
params: limit ? { _limit: limit } : undefined,
|
|
});
|
|
return Array.isArray(response) ? response : [];
|
|
}
|
|
|
|
/**
|
|
* List alarms (Private API)
|
|
*/
|
|
async listAlarms(archived: boolean = false): Promise<Alarm[]> {
|
|
const response = await this.client.request<Alarm[]>('GET', '/rest/alarm', {
|
|
params: { archived: archived.toString() },
|
|
});
|
|
return Array.isArray(response) ? response : [];
|
|
}
|
|
}
|