NetworkBlocksResult network.blocks-result@1

Generated at from openvibe-contracts v0.53.0 and openvibe-sdk v0.11.0.

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

network.blocks-result@1: the answer of network.blocks.read on OpenVibe.Network. GET /internal/blocks?subject=usr_… (a service token holding network.blocks.read; the shared internal key is refused) → { subject, blocks, blocked_by }: the people the subject has blocked and the people who have blocked the subject, as usr_ subjects in subject order, active blocks only (a person may hold at most 5000). Answered with Cache-Control: no-store. A subject that is not a usr_ id is refused with 400 blocks.bad_subject (problem+json).

Fields

FieldTypeRequiredDescriptionConstraints
subjectstringyesThe person asked about.
  • pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
blocksarray of stringyesWhom the subject blocked.
  • items: pattern ^usr_[0-9A-HJKMNP-TV-Z]{26}$
blocked_byarray of stringyesWho blocked the subject.
  • 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: both-ways
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "blocks": [
    "usr_01JAB2C3D4E5F6G7H8J9K0MNPR"
  ],
  "blocked_by": [
    "usr_01JAB2C3D4E5F6G7H8J9K0MNPR",
    "usr_01JAB2C3D4E5F6G7H8J9K0MNPS"
  ]
}
Valid: none
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "blocks": [],
  "blocked_by": []
}
Rejected: integer-ids
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "blocks": [
    42
  ],
  "blocked_by": []
}
Rejected: missing-blocked-by
{
  "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "blocks": []
}

Validate

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