import { ActionContext } from ".."; import { ApiVersion, DeviceRefresh, DeviceStatus, RetVal } from "./common"; type ActionType = "api" | "adapter"; export interface ActionBase { id: string; /** * This can either be the name of a font awesome icon (e.g. "fa-signal") or the URL to an icon. */ icon: string; description?: ioBroker.StringOrTranslated; disabled?: T extends "api" ? boolean : never; } export interface InstanceAction extends ActionBase { handler?: T extends "api" ? never : (context: ActionContext) => RetVal<{ refresh: boolean }>; title: ioBroker.StringOrTranslated; } export interface DeviceAction extends ActionBase { handler?: T extends "api" ? never : (deviceId: string, context: ActionContext) => RetVal<{ refresh: DeviceRefresh }>; } export interface InstanceDetails { apiVersion: ApiVersion; actions?: InstanceAction[]; } export interface DeviceInfo { id: string; name: ioBroker.StringOrTranslated; status?: DeviceStatus | DeviceStatus[]; actions?: DeviceAction[]; hasDetails?: boolean; }