NetworkUserCard network.user-card@1

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

Version
1.0.0
Owner
network
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/network/user-card.v1.json

network.user-card@1 (ask 287): the one public user card read, GET /api/v1/people/:username/card on OpenVibe.Network. It is public and credential-free; a signed-in viewer may send their Network token (Authorization: Bearer …) and then also receives `actions` computed for that viewer, never cached. Without a viewer, or on the viewer's own card, `actions` carries Profile and Channel only. A missing, expired or revoked token reads as anonymous, never a 401. Hidden fields are absent, never zero, offline or a placeholder; no presence, page titles or visited URLs leave the read.

Fields

FieldTypeRequiredDescriptionConstraints
usernamestringyes
  • pattern ^[A-Za-z0-9_]{3,24}$
display_namestring
  • minLength 1
  • maxLength 200
avatar_urlstring
  • pattern ^https://
  • format uri
profile_urlstringyes
  • pattern ^https://
  • format uri
levelinteger
  • minimum 0
streakinteger
  • minimum 0
badges_countinteger
  • minimum 0
followersinteger
  • minimum 0
liveobject
  • no other fields
live.nowbooleanyes
live.siteconst
  • = "live"
live.urlstring
  • pattern ^https://
  • format uri
channel_urlstring
  • pattern ^https://
  • format uri
active_sitesarray of object
  • items: no other fields
active_sites[].idstringyes
  • pattern ^[a-z][a-z0-9-]{1,39}$
active_sites[].namestringyes
  • minLength 1
  • maxLength 80
active_sites[].urlstringyes
  • pattern ^https://
  • format uri
actionshttps://openvibe.network/contracts/network/user-card.v1.json#/$defs/actionyesWhat the viewer can do, by what is possible for the pair. Order is the card's order. Each action either opens somewhere (`href`) or calls a Network route with the viewer's token (`method` + `path`, and `body` where the route needs one).

Examples

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

Valid: anonymous
{
  "username": "Example",
  "display_name": "Example",
  "avatar_url": "https://openvibe.network/avatar/Example?s=160",
  "profile_url": "https://openvibe.network/@Example",
  "level": 4,
  "streak": 3,
  "badges_count": 2,
  "followers": 10,
  "live": {
    "now": true,
    "site": "live",
    "url": "https://openvibe.live/@Example"
  },
  "channel_url": "https://openvibe.live/@Example",
  "active_sites": [
    {
      "id": "live",
      "name": "Live",
      "url": "https://openvibe.live"
    }
  ],
  "actions": [
    {
      "id": "profile",
      "label": "Profile",
      "href": "https://openvibe.network/@Example"
    },
    {
      "id": "channel",
      "label": "Channel",
      "href": "https://openvibe.live/@Example"
    }
  ]
}
Valid: viewer-actions
{
  "username": "Example",
  "profile_url": "https://openvibe.network/@Example",
  "actions": [
    {
      "id": "profile",
      "label": "Profile",
      "href": "https://openvibe.network/@Example"
    },
    {
      "id": "message",
      "label": "Message",
      "href": "https://openvibe.chat/messages"
    },
    {
      "id": "follow",
      "label": "Follow",
      "method": "PUT",
      "path": "/api/v1/me/follows/channel/Example",
      "state": {
        "following": false
      }
    },
    {
      "id": "add-friend",
      "label": "Add friend",
      "method": "PUT",
      "path": "/api/v1/me/friends/Example",
      "state": {
        "friendship": "none"
      }
    },
    {
      "id": "tip",
      "label": "Tip",
      "href": "https://openvibe.tips/Example"
    },
    {
      "id": "mute",
      "label": "Mute",
      "method": "PUT",
      "path": "/api/v1/me/mutes/Example",
      "state": {
        "muted": false
      }
    },
    {
      "id": "block",
      "label": "Block",
      "method": "PUT",
      "path": "/api/v1/me/blocks/Example",
      "state": {
        "blocked": false
      }
    },
    {
      "id": "report",
      "label": "Report",
      "method": "POST",
      "path": "/api/v1/me/reports",
      "body": {
        "target": "Example",
        "reason": "other",
        "detail": ""
      },
      "state": {
        "reported": false
      }
    }
  ]
}
Rejected: action-without-destination
{
  "username": "Example",
  "profile_url": "https://openvibe.network/@Example",
  "actions": [
    {
      "id": "message",
      "label": "Message",
      "state": {}
    }
  ]
}
Rejected: bad-friendship
{
  "username": "Example",
  "profile_url": "https://openvibe.network/@Example",
  "actions": [
    {
      "id": "add-friend",
      "label": "Add friend",
      "method": "PUT",
      "path": "/api/v1/me/friends/Example",
      "state": {
        "friendship": "maybe"
      }
    }
  ]
}
Rejected: http-href
{
  "username": "Example",
  "profile_url": "https://openvibe.network/@Example",
  "actions": [
    {
      "id": "profile",
      "label": "Profile",
      "href": "http://openvibe.network/@Example"
    }
  ]
}

Validate

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