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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
key | string | yes | Idempotency key, scoped to the caller and to this route. |
|
user | integer | null | A person whose cached row is stale. |
| |
user_data | object | The person's new public fields, pushed to their sockets; id must equal user. |
| |
user_data.id | integer | yes |
| |
user_data.username | string | yes |
| |
user_data.display_name | string | null |
| ||
user_data.role | string | |||
user_data.avatar_url | string | null | |||
user_data.profile_color | string | null | |||
approvals | integer | null | A channel whose IP approvals changed. |
| |
bans | boolean | null | true: bans changed. | ||
channel | integer | null | A channel whose cached settings changed. |
|
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 }] }