decodeCommandBody<C extends Command>(command: C,xml: string): CommandBody<C>
Reads a command body. Elements that are not among the command's parameters are ignored.
Ignore elements the command does not declare
Ignore elements the command does not declare
import { assertEquals } from "@std/assert"; import { command, decodeCommandBody } from "@hertzg/reolink-api/protocol/command"; import { int, xmlParam } from "@hertzg/reolink-api/protocol/xml"; const linkType = command(93, "GET_LINK_TYPE", [ xmlParam("LinkType", { channelId: int() }), ]); assertEquals(decodeCommandBody(linkType, "<body><Other/></body>"), {});
C extends Command
command: C
The command whose parameters to read.
The parameter values found, by element name.