UiTrigger ui.trigger@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
contracts
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/ui/trigger.v1.json

ui.trigger@1: one trigger an Element's recipe listens for, from the fixed catalog. kind says what happened: a viewer pressing, holding or double-pressing the element, a key or gamepad binding, a chat command or text, a follow, a tip, an AI Moment, a Rundown topic, a timer or schedule, robot telemetry or an event, the stream starting or ending, a viewer-count crossing or another element's event. The fields a kind needs are the only fields it accepts. A trigger is data: it never names code or a URL, and a product may refuse a kind it does not offer yet. Stage 1 of Elements uses press and chat_command; the rest are declared here so a stage-2 element and the editor speak one language.

Fields

This schema has no named fields.

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: chat-command
{
  "kind": "chat_command",
  "command": "!dance"
}
Valid: press
{
  "kind": "press"
}
Valid: robot-battery
{
  "kind": "robot_telemetry",
  "metric": "battery_percent",
  "op": "lt",
  "value": 20,
  "for_seconds": 30
}
Rejected: command-without-bang
{
  "kind": "chat_command",
  "command": "dance"
}
Rejected: hold-too-short
{
  "kind": "hold",
  "ms": 10
}
Rejected: unknown-kind
{
  "kind": "cheer"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('ui.trigger@1', value);   // { valid, errors: [{ path, message }] }