WatchRequest watch.watch-request@1

Generated at from openvibe-contracts v0.107.0 and openvibe-sdk v0.26.0.

Version
1.0.0
Owner
watch
Visibility
first-party
Status
planned
Compatibility
backward
Schema
https://openvibe.network/contracts/watch/watch-request.v1.json

watch.watch-request@1: the body of POST /api/v1/watches and PATCH /api/v1/watches/:id on OpenVibe.Watch (watch.watch.manage; the acting person). Every field is optional on a patch; a create requires source, extraction, condition and action, which the service enforces in code (422 watch.invalid).

Fields

FieldTypeRequiredDescriptionConstraints
namestring
  • minLength 1
  • maxLength 120
labelsobject
sourcehttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/source
cadencehttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/cadence
extractionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/extraction
comparisonhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/comparison
conditionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/condition
actionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/action
  • minItems 1
  • maxItems 8
budgethttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/budget
retentionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/retention
statusenum
  • one of "active", "paused", "disabled", "failed"

Examples

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

Valid: create-event-watch
{
  "name": "Release 0.102.0 published",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "notification",
      "category": "service",
      "priority": "normal"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active"
}
Rejected: unknown-status
{
  "name": "Release 0.102.0 published",
  "source": {
    "kind": "event",
    "pattern": "host.release.published"
  },
  "condition": {
    "op": "changed"
  },
  "action": [
    {
      "kind": "notification"
    }
  ],
  "status": "archived"
}

Validate

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