DealsWatchRequest deals.watch-request@1

Generated at from openvibe-contracts v0.53.0 and openvibe-sdk v0.11.0.

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

deals.watch-request@1: the body of POST /api/v1/watches on OpenVibe.Deals (deals.watch.create; the acting person): kind keyword or search (query with at least one word; a search is saved without notifications), product (product, a slug or id), or price_below (max_price and currency, with a product or keywords). label is optional (120 characters). There is a per-person limit (429 watch.limit).

Fields

FieldTypeRequiredDescriptionConstraints
kindenumyes
  • one of "keyword", "product", "price_below", "search"
querystring | null
  • maxLength 200
productstring | null
max_pricestring | number | nullA decimal amount; always with its currency.
currencystring | nullISO 4217; Deals never assumes one.
  • pattern ^[A-Za-z]{3}$
labelstring | null
  • maxLength 120

Examples

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

Valid: price
{
  "kind": "price_below",
  "query": "capture card",
  "max_price": "60",
  "currency": "USD",
  "label": "cheap capture card"
}
Rejected: no-price
{
  "kind": "price_below",
  "query": "capture card"
}

Validate

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