VipPerkUpdateRequest vip.perk-update-request@1

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

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

vip.perk-update-request@1: the body of vip.perk.update on OpenVibe.VIP. PATCH /api/v1/perks/:id: { name?, description?, kind?, status?, bindings? } renames, describes or retires a perk, or replaces its product bindings. Published plan versions keep the perk snapshot they were written with. Refusals are problem+json: 404 vip.perk_not_found; 422 vip.invalid_input or vip.text_too_long; 403 capability.denied. Unknown fields are ignored.

Fields

FieldTypeRequiredDescriptionConstraints
namestring
  • minLength 1
  • maxLength 80
descriptionstring | null
  • maxLength 500
kindenum
  • one of "badge", "emote", "gated_content", "room", "role", "other"
statusenum
  • one of "active", "retired"
bindingsarray of objectReplaces the perk's active bindings (a binding left out is removed). Each (product, binding) at most once.
  • maxItems 20
bindings[].productstringyesA service id: live, chat, community, blog, …
  • pattern ^[a-z][a-z0-9-]{1,39}$
bindings[].bindingstringyeschat_badge, room_access, gated_post, …
  • pattern ^[a-z][a-z0-9_.]{1,63}$
bindings[].configobject | nullUnder 2 KB of JSON; default {}.

Examples

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

Valid: rebind
{
  "bindings": [
    {
      "product": "live",
      "binding": "chat_badge"
    },
    {
      "product": "chat",
      "binding": "chat_badge",
      "config": {
        "icon": "crown"
      }
    }
  ]
}
Valid: retire
{
  "status": "retired"
}
Rejected: deleted
{
  "status": "deleted"
}

Validate

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