DealsOfferSubmitRequest deals.offer-submit-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/offer-submit-request.v1.json

deals.offer-submit-request@1: the body of POST /api/v1/offers on OpenVibe.Deals (deals.offer.submit; a signed-in person, or a service acting for one; X-OV-Origin: ai holds the text for review). url (an http(s) link to the offer; a link already posted is 409 offer.duplicate) and title (3-200 characters) are required; a price or shipping cost needs its currency; expires_at may not be in the past. The first price observation is recorded with it.

Fields

FieldTypeRequiredDescriptionConstraints
urlstringyes
  • pattern ^https?://
titlestringyes
  • minLength 3
  • maxLength 200
descriptionstring | null
  • maxLength 4000
categorystring | null
  • maxLength 60
expires_atstring | null
store_namestring | null
  • maxLength 120
product_slugstring | null
productobjectProduct aliases to resolve (or create) the product.
product.namestring
product.brandstring | null
product.gtinstring
  • pattern ^[0-9]{8,14}$
product.mpnstring
product.skustring
product.urlstring
product.categorystring | null
product.descriptionstring | null
pricestring | number | nullA decimal amount; always with its currency.
currencystring | nullISO 4217; Deals never assumes one.
  • pattern ^[A-Za-z]{3}$
shippingstring | number | nullA decimal amount; always with its currency.
shipping_notestring | null
  • maxLength 200
conditionenum
  • one of "new", "used", "refurbished", "damaged", null
availabilityenum
  • one of "in_stock", "out_of_stock", "preorder", "discontinued", "limited", "sold_out", "online_only", "in_store_only", null
notestring | null
  • maxLength 300

Examples

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

Valid: with-price
{
  "url": "https://shop.example.com/capture-card",
  "title": "USB-C 4K capture card for $79.99",
  "category": "streaming",
  "price": "79.99",
  "currency": "USD",
  "shipping": "0",
  "availability": "in_stock",
  "condition": "new"
}
Rejected: not-http
{
  "url": "ftp://shop.example.com/x",
  "title": "ok title"
}

Validate

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