NetworkUserUpdatedPayload network.user.updated@1
Generated at from
openvibe-contracts v0.44.0 and
openvibe-sdk v0.9.1.
- Version
- 1.0.0
- Owner
- network
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/events/payloads/network.user.updated.v1.json
network.user.updated v1 (OpenVibe.Network server/identity/profile-events.js; roadmap WS-B task 2). What other services may know about a person changed: their username, display name, picture, colour, role or ban. The payload is the person's whole current profile, not a diff, so a consumer keeps a projection by writing it over the one it has, and ignores one whose revision is not newer (events can arrive out of order). Emitted in the transaction of the change: a profile edit, a rename, a role grant or removal, a ban or unban. Consumers use it instead of their own copies: roles go both ways (a downgrade too), and a ban arrives even for someone who never comes back. Envelope: subject { type: user, id }, visibility internal, actor the person (their own edit) or the staff member.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
subject | object | yes | The person (identity.subject-ref@1, a user). |
|
subject.type | const | yes |
| |
subject.id | string | yes |
| |
network_user_id | integer | yes | Network's numeric user id (the legacy id services linked before subjects). |
|
revision | integer | yes | Grows with every change to this person's profile; a consumer keeps the highest it has seen. |
|
username | string | yes |
| |
display_name | string | null |
| ||
avatar_url | string | null |
| ||
profile_color | string | null |
| ||
role | enum | yes | The staff map's role (policy.staff-map); capabilities follow from it. |
|
banned | boolean | yes | ||
changed | array of enum | yes | What this change touched ('created' for a new account), so a consumer can skip work it does not need. |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: renamed-and-banned
{
"subject": {
"type": "user",
"id": "usr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A3"
},
"network_user_id": 7,
"revision": 9,
"username": "alex_new",
"display_name": "Alex",
"avatar_url": "https://openvibe.media/avatar/alex_new",
"profile_color": null,
"role": "streamer",
"banned": true,
"changed": [
"username",
"banned"
]
}Valid: role-removed
{
"subject": {
"type": "user",
"id": "usr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A3"
},
"network_user_id": 7,
"revision": 4,
"username": "alex",
"display_name": "Alex",
"avatar_url": null,
"profile_color": "#8b5cf6",
"role": "user",
"banned": false,
"changed": [
"role"
]
}Rejected: nothing-changed
{
"subject": {
"type": "user",
"id": "usr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A3"
},
"network_user_id": 7,
"revision": 1,
"username": "alex",
"role": "user",
"banned": false,
"changed": []
}Rejected: unknown-role
{
"subject": {
"type": "user",
"id": "usr_01J8Z3Q4R5S6T7V8W9X0Y1Z2A3"
},
"network_user_id": 7,
"revision": 1,
"username": "alex",
"role": "owner",
"banned": false,
"changed": [
"role"
]
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('network.user.updated@1', value); // { valid, errors: [{ path, message }] }