mirror of
https://github.com/parnic/node-intellicenter.git
synced 2025-06-16 18:20:14 -05:00
Getting a feel for how the development experience is with this setup. With the previous idea of abstracting the request into a getSystemInfo() function on the Unit itself, the documentation for what to expect from GetSystemInfo either had to live in two places or be presented as a link to the canonical location. Neither felt great, so I think the caller can just call send(GetRequest()) themselves. Also added the first "set" message which is capable of toggling a body or circuit.
24 lines
515 B
TypeScript
24 lines
515 B
TypeScript
import { v4 as uuidv4 } from "uuid";
|
|
import { ICParam } from "./param.js";
|
|
|
|
export class ICRequestObj {
|
|
public objnam = "";
|
|
public keys: string[] = [];
|
|
public params?: ICParam;
|
|
}
|
|
|
|
export class ICRequest {
|
|
public condition?: string;
|
|
public objectList?: ICRequestObj[];
|
|
public queryName?: string;
|
|
public arguments?: string[] | string;
|
|
public command = "";
|
|
public messageID = "";
|
|
}
|
|
|
|
export function GetRequest(): ICRequest {
|
|
const req = new ICRequest();
|
|
req.messageID = uuidv4();
|
|
return req;
|
|
}
|