ChatInvalidateRequest chat.invalidate-request@1

Generated at from openvibe-contracts v0.97.0 and openvibe-sdk v0.26.0.

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

chat.invalidate-request@1: what a first-party service hands OpenVibe.Chat's POST /internal/chat/invalidate (chat.cache.invalidate) after it changed something Chat caches (a person, a channel, IP approvals, bans). A cache hint only: Chat drops and reloads the entry (with user_data, it also pushes the person's new name and look to their sockets). At least one hint is required. Applied once per (caller, key).

Fields

FieldTypeRequiredDescriptionConstraints
keystringyesIdempotency key, scoped to the caller and to this route.
  • pattern ^[A-Za-z0-9:._-]+$
  • minLength 1
  • maxLength 160
userinteger | nullA person whose cached row is stale.
  • minimum 1
user_dataobjectThe person's new public fields, pushed to their sockets; id must equal user.
  • no other fields
user_data.idintegeryes
  • minimum 1
user_data.usernamestringyes
  • minLength 1
  • maxLength 120
user_data.display_namestring | null
  • minLength 1
  • maxLength 120
user_data.rolestring
user_data.avatar_urlstring | null
user_data.profile_colorstring | null
approvalsinteger | nullA channel whose IP approvals changed.
  • minimum 1
bansboolean | nulltrue: bans changed.
channelinteger | nullA channel whose cached settings changed.
  • minimum 1

Examples

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

Valid: bans
{
  "key": "live:bans:1759600001",
  "bans": true
}
Valid: user-update
{
  "key": "live:user:12:1759600000",
  "user": 12,
  "user_data": {
    "id": 12,
    "username": "viewer1",
    "display_name": "Viewer One",
    "role": "user",
    "avatar_url": null,
    "profile_color": "#33aaff"
  }
}
Rejected: bans-false-only
{
  "key": "k2",
  "bans": false
}
Rejected: no-hint
{
  "key": "k1"
}
Rejected: user-data-without-user
{
  "key": "k3",
  "user_data": {
    "id": 12,
    "username": "viewer1"
  }
}

Validate

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