ChatModeratedChannelsResult chat.moderated-channels-result@1

Generated at from openvibe-contracts v0.84.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/moderated-channels-result.v1.json

chat.moderated-channels-result@1: the answer of GET /internal/moderation/users/:userId/channels on OpenVibe.Chat (capability chat.moderation.read): { ok: true, channels } — the channels one Live user moderates (channel_moderators rows joined with their channels, database.js getChannelsByModerator), so a stream chat can answer 'may I moderate' without asking per message. Empty when the person moderates none. A failure is { 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: none
{
  "ok": true,
  "channels": []
}
Valid: two-channels
{
  "ok": true,
  "channels": [
    {
      "channel_id": 41,
      "title": "Late Night D&D",
      "owner_user_id": 7,
      "owner_username": "mapmaker"
    },
    {
      "channel_id": 88,
      "title": null,
      "owner_user_id": 7,
      "owner_username": null
    }
  ]
}
Rejected: no-channel-id
{
  "ok": true,
  "channels": [
    {
      "title": "Late Night D&D"
    }
  ]
}

Validate

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