ChatModerationRequest chat.moderation-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/moderation-request.v1.json

chat.moderation-request@1: what a first-party service hands OpenVibe.Chat's POST /internal/chat/moderation (chat.moderation.write) to change chat rows Chat owns and act on its sockets: delete messages (Chat deletes the rows and broadcasts the delete notices to the room and its mirrors), review messages held for IP approval, hide, unhide or record relay identities, set or clear a TTS voice override, disconnect a person or an address, and log a moderation action. One action per request, applied once per (caller, key): a retry with the same key and body answers the first result, the same key with another body gets 409. The fields an action does not list are refused.

Fields

This schema has no named fields.

Examples

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

Valid: clear-tts-override
{
  "key": "live:mod:tts:clear:9",
  "action": "tts-voice-override",
  "identity_key": "user:12",
  "params": null,
  "set_by": 3
}
Valid: delete-user-messages
{
  "key": "live:mod:del-user:12:991",
  "action": "delete-user-messages",
  "user_id": 12,
  "stream_id": 42,
  "deleted_by": 3
}
Valid: disconnect-by-ip
{
  "key": "live:mod:dc:203.0.113.9",
  "action": "disconnect",
  "user_id": null,
  "ip": "203.0.113.9",
  "stream_id": null
}
Valid: log
{
  "key": "live:mod:log:5512",
  "action": "log",
  "scope_type": "channel",
  "scope_id": 77,
  "actor_user_id": 3,
  "target_user_id": 12,
  "action_type": "ban",
  "details": {
    "reason": "spam"
  }
}
Valid: relay-unhide-by-identity
{
  "key": "live:mod:unhide:1",
  "action": "relay-unhide",
  "channel_id": 77,
  "platform": "twitch",
  "external_username": "someone"
}
Rejected: bad-ip
{
  "key": "k4",
  "action": "approve-ip-messages",
  "channel_id": 77,
  "ip": "not-an-ip"
}
Rejected: disconnect-without-target
{
  "key": "k3",
  "action": "disconnect",
  "stream_id": 42
}
Rejected: field-of-another-action
{
  "key": "k2",
  "action": "delete-message",
  "id": 5,
  "user_id": 12
}
Rejected: tts-pitch-out-of-range
{
  "key": "k5",
  "action": "tts-voice-override",
  "identity_key": "user:12",
  "params": {
    "voice": "en-1",
    "pitch": 11
  }
}
Rejected: unknown-action
{
  "key": "k1",
  "action": "drop-table"
}

Validate

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