function command
command<P extends readonly AnyXmlParam[]>(
id: number,
name: string,
params: P,
firmware?: readonly Firmware[]
): Command<P>

Declares a command.

Examples

Declare a command without parameters

import { assertEquals } from "@std/assert";
import { command } from "@hertzg/reolink-api/protocol/command";

const reboot = command(23, "REBOOT_V20", [], ["RLC-823A"]);

assertEquals(reboot.id, 23);
assertEquals(reboot.firmware, ["RLC-823A"]);

Type Parameters

P extends readonly AnyXmlParam[]

Parameters

id: number

The command id.

name: string

The firmware's name for it.

params: P

The parameter codecs its bodies carry.

optional
firmware: readonly Firmware[]

The firmware builds known to register it; empty by default.

Return Type

The command.

Usage

import { command } from "protocol/command.ts";