ChatStatsResult chat.stats-result@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/stats-result.v1.json

chat.stats-result@1: the answer of POST /internal/chat/stats (chat.stats.read). site, user and stream answer messages (non-deleted chat_messages rows) and chatters (distinct COALESCE(user_id, anon_id, source_platform || username)); stream also answers sounds (soundboard plays); channel-top answers top_chatters, most messages first. A failure is chat.ingress-ack@1's error ({ ok: false, error }).

Fields

This schema has no named fields.

Examples

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

Valid: error
{
  "ok": false,
  "error": "kind user needs user_id"
}
Valid: stream
{
  "ok": true,
  "messages": 1834,
  "chatters": 96,
  "sounds": 41
}
Valid: top-chatters
{
  "ok": true,
  "top_chatters": [
    {
      "user_id": 512,
      "username": "pixelfox",
      "display_name": "PixelFox",
      "count": 214
    },
    {
      "user_id": null,
      "username": "kick_viewer",
      "display_name": null,
      "count": 37
    }
  ]
}
Rejected: chatter-without-count
{
  "top_chatters": [
    {
      "user_id": 512,
      "username": "pixelfox",
      "display_name": "PixelFox"
    }
  ]
}
Rejected: negative-count
{
  "messages": -1
}

Validate

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