Interface: MenuApi
Provides methods to interact with the Menu API, including menu structure retrieval, item lookup, and setting updates.
Methods
getCurrentSetting()
getCurrentSetting(
nodeId):Promise<MenuSettingValue[]>
Retrieves the current setting values for a given node ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
nodeId | number | The ID of the node to query. |
Returns
Promise<MenuSettingValue[]>
The list of current setting values for the node.
Throws
If the request fails.
getMenuStructure()
getMenuStructure(
opts?):Promise<any>
Retrieves the full menu structure from the device.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | { flat: boolean; } | Options object. If flat is true, returns a flattened array of nodes instead of the raw tree. |
opts.flat | boolean | - |
Returns
Promise<any>
Throws
If the request fails.
getMenuStructureItem()
getMenuStructureItem(
context?,nodeId?):Promise<MenuItemNode>
Finds a single menu item node by context string or node ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
context? | string | The context string to match against. Takes priority over nodeId if provided. |
nodeId? | number | The node ID to match against, used when context is not provided. |
Returns
Promise<MenuItemNode>
The matching MenuItemNode.
Throws
If no matching item is found or the structure request fails.
setMenuItemSetting()
setMenuItemSetting(
item,value):Promise<void>
Updates the setting value of a given menu item node.
Parameters
| Parameter | Type | Description |
|---|---|---|
item | MenuItemNode | undefined | The menu item node to update. Throws if undefined. |
value | unknown | The new value to apply. Automatically formatted based on the node type (SLIDER_NODE, TOGGLE_NODE, LIST_NODE). |
Returns
Promise<void>
Throws
If the item is undefined or the request fails.