NetworkLevelAward network.level-award@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
network
Visibility
internal
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/network/level-award.v1.json

NetworkLevelAward: one earned platform level owned by Network; experience is never bought or spent.

Fields

FieldTypeRequiredDescriptionConstraints
subjectstringyes
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
reasonenumyes
  • one of "quest.completed", "coins.earned", "video.published", "stream.watched"
amountintegeryes
  • minimum 1
  • maximum 10000
idempotency_keystringyes
  • minLength 1
  • maxLength 160

Examples

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

Valid: example
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNP1",
  "reason": "quest.completed",
  "amount": 25,
  "idempotency_key": "completion:1"
}
Rejected: example
{}

Validate

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