/** * Event type unions and helpers for Eufy Security WebSocket Client. * * Provides type unions and helpers for all event types and payloads across device, driver, server, and station. */ import { EventSource } from "../common/constants"; import { DeviceEventPayload, DeviceEventPayloadByType, DeviceEventSource, DeviceEventType } from "../device"; import { DriverEventPayload, DriverEventPayloadByType, DriverEventType } from "../driver/"; import { ServerEventPayload, ServerEventPayloadByType, ServerEventType } from "../server/"; import { StationEventPayload, StationEventPayloadByType, StationEventSource, StationEventType } from "../station/"; export type EventType = DeviceEventType | DriverEventType | ServerEventType | StationEventType; export type AllEventPayloads = DeviceEventPayload | DriverEventPayload | ServerEventPayload | StationEventPayload; export type EventPayloadForType = T extends DeviceEventType ? S extends DeviceEventSource ? DeviceEventPayloadByType : never : T extends DriverEventType ? DriverEventPayloadByType : T extends StationEventType ? S extends StationEventSource ? StationEventPayloadByType : never : T extends ServerEventType ? ServerEventPayloadByType : Extract; export type EventCallbackForType = (payload: EventPayloadForType) => void; export interface EventListener { id: string; eventType: T; eventCallback: EventCallbackForType; source?: S; serialNumber?: string; } //# sourceMappingURL=events.d.ts.map