ChatStatsRequest chat.stats-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/stats-request.v1.json

chat.stats-request@1: the body of POST /internal/chat/stats on OpenVibe.Chat (capability chat.stats.read): one count over chat_messages, for the stats OpenVibe.Live shows without reading its own copy of Chat's tables (home and SEO stats, admin dashboard, star of the day, VOD and recap cards, stream analytics, top chatters, AI slogans). kind site counts all of chat; user one person's messages (user_id); stream one stream's messages, chatters and soundboard plays (stream_id); channel-top the top chatters, of one stream (stream_id) or one channel (channel_user_id), or of all chat when neither is given. since and until bound chat_messages.timestamp, epoch ms, until exclusive. Deleted messages are never counted. Loopback only, service token.

Fields

FieldTypeRequiredDescriptionConstraints
kindenumyes
  • one of "site", "user", "stream", "channel-top"
user_idintegerLive user id; required for kind user.
  • minimum 1
stream_idintegerLive stream id; required for kind stream.
  • minimum 1
channel_user_idintegerThe broadcaster whose channel room it is (chat_messages.channel_user_id).
  • minimum 1
sinceintegerCount messages at or after this instant (epoch ms).
  • minimum 0
untilintegerCount messages before this instant (epoch ms).
  • minimum 0
limitintegerHow many top chatters (channel-top); Chat's default is 10.
  • minimum 1
  • maximum 50

Examples

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

Valid: channel-top
{
  "kind": "channel-top",
  "channel_user_id": 77,
  "since": 1758326400000,
  "limit": 20
}
Valid: site-since
{
  "kind": "site",
  "since": 1759536000000
}
Valid: stream
{
  "kind": "stream",
  "stream_id": 4211
}
Rejected: limit-too-high
{
  "kind": "channel-top",
  "stream_id": 4211,
  "limit": 51
}
Rejected: unknown-kind
{
  "kind": "global"
}
Rejected: user-without-id
{
  "kind": "user",
  "since": 1759536000000
}

Validate

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