ChatDmPeersResult chat.dm-peers-result@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
chat
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/chat/dm-peers-result.v1.json

chat.dm-peers-result@1: which of the candidate people share a conversation with one person on OpenVibe.Chat (POST /internal/chat/dm/peers, chat.dm.peers.read). It answers with subjects only; a candidate with no shared conversation is simply absent. Used by OpenVibe.Network's presence privacy rule.

Fields

FieldTypeRequiredDescriptionConstraints
subjectstringyesThe person whose conversations were read.
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
peersarray of stringyesThe candidates that share at least one conversation with them, as subjects.
  • maxItems 100
  • items: pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$

Examples

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

Valid: none
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "peers": []
}
Valid: peers
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "peers": [
    "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
  ]
}
Rejected: bad-peer
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "peers": [
    "bob"
  ]
}

Validate

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