InventoryItemGrantedPayload inventory.item.granted@1

Generated at from openvibe-contracts v0.127.0 and openvibe-sdk v0.37.0.

Version
1.0.0
Owner
inventory
Visibility
first-party
Status
active
Compatibility
backward
Decision
ADR-054
Schema
https://openvibe.network/contracts/events/payloads/inventory.item.granted.v1.json

inventory.item.granted v1 (OpenVibe.Inventory, ADR-054). An instance was granted or earned (ADR-054 §4). Envelope: subject { type: user, id: owner }, visibility subject, actor the issuer.

Fields

FieldTypeRequiredDescriptionConstraints
instance_idstringyes
  • pattern ^inv_[0-9A-HJKMNP-TV-Z]{26}$
definition_idstringyes
  • pattern ^itd_[0-9A-HJKMNP-TV-Z]{26}$
kindstringyes
  • pattern ^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$
ownerstringyes
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
originenumyes
  • one of "granted", "earned", "migrated"
issuerstringyes
  • pattern ^(service:[a-z][a-z0-9-]*|app:app_[0-9A-HJKMNP-TV-Z]{26}|user:usr_[0-9A-HJKMNP-TV-Z]{26})$

Examples

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

Valid: example
{
  "instance_id": "inv_01JZ00000000000000000001NV",
  "definition_id": "itd_01JZ00000000000000000001TD",
  "kind": "live.name_effect",
  "owner": "usr_01JZ0000000000000000000AAA",
  "origin": "earned",
  "issuer": "service:quest"
}
Rejected: missing-field
{
  "definition_id": "itd_01JZ00000000000000000001TD",
  "kind": "live.name_effect",
  "owner": "usr_01JZ0000000000000000000AAA",
  "origin": "earned",
  "issuer": "service:quest"
}

Validate

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