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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
name | string |
| ||
labels | object | |||
source | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/source | |||
cadence | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/cadence | |||
extraction | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/extraction | |||
comparison | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/comparison | |||
condition | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/condition | |||
action | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/action |
| ||
budget | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/budget | |||
retention | https://openvibe.network/contracts/watch/watch.v1.json#/$defs/retention | |||
status | enum |
|
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 }] }