CommunityPostWriteResult community.post-write-result@1

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

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

community.post-write-result@1: answers of the forum writes on OpenVibe.Community (community.post.create). POST /api/v1/spaces/:space/threads → 201 { thread, post } (the thread and its opening post); POST …/threads/:slug/posts → 201 { post, page, url } (the reply, the page it lands on and its address with #post-<id>); PUT /api/v1/posts/:id → { post }; POST …/threads/:slug/votes → { thread_id, score, upvotes, downvotes, my_vote }; DELETE /api/v1/posts/:id → { ok, id } (deleting the opening post deletes the thread: { ok, id, deleted: thread }); DELETE /api/v1/spaces/:space/threads/:slug → { ok, id, deleted: thread }. Refusals are problem+json.

Fields

This schema has no named fields.

Examples

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

Valid: new-thread
{
  "thread": {
    "id": 311,
    "space": "streaming",
    "slug": "restreaming-to-three-platforms",
    "title": "Restreaming to three platforms at once",
    "url": "/s/streaming/t/restreaming-to-three-platforms",
    "kind": "discussion",
    "status": null,
    "category": {
      "slug": "help",
      "name": "Help",
      "description": null,
      "position": 1
    },
    "members_only": null,
    "author": {
      "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
      "username": "alice",
      "display_name": "Alice",
      "avatar_url": null,
      "profile_color": "#3b82f6"
    },
    "origin": "user",
    "pinned": false,
    "locked": false,
    "score": 0,
    "reply_count": 0,
    "views": 0,
    "pages": 1,
    "last_post": null,
    "crosspost_of": null,
    "last_activity_at": "2026-09-25T18:00:00.000Z",
    "created_at": "2026-09-25T18:00:00.000Z",
    "my_vote": 0
  },
  "post": {
    "attachments": [],
    "pastes": [
      {
        "slug": "k3JfQ2",
        "title": "ffmpeg restream flags",
        "language": "text",
        "type": "paste",
        "url": "/p/k3JfQ2",
        "screenshot_url": null,
        "lines": 1,
        "excerpt": "ffmpeg -re -i in.flv -c copy -f flv rtmp://example/live"
      }
    ],
    "id": 5120,
    "thread_id": 311,
    "is_opening": true,
    "origin": "user",
    "author": {
      "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
      "username": "alice",
      "display_name": "Alice",
      "avatar_url": null,
      "profile_color": "#3b82f6"
    },
    "body_markdown": "What bitrates do you use?",
    "body_html": "<p>What bitrates do you use?</p>",
    "revision": 1,
    "deleted": false,
    "created_at": "2026-09-25T18:00:00.000Z",
    "updated_at": "2026-09-25T18:00:00.000Z",
    "can_edit": true
  }
}
Valid: reply
{
  "post": {
    "attachments": [],
    "pastes": [
      {
        "slug": "k3JfQ2",
        "title": "ffmpeg restream flags",
        "language": "text",
        "type": "paste",
        "url": "/p/k3JfQ2",
        "screenshot_url": null,
        "lines": 1,
        "excerpt": "ffmpeg -re -i in.flv -c copy -f flv rtmp://example/live"
      }
    ],
    "id": 5120,
    "thread_id": 311,
    "is_opening": false,
    "origin": "user",
    "author": {
      "subject": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
      "username": "alice",
      "display_name": "Alice",
      "avatar_url": null,
      "profile_color": "#3b82f6"
    },
    "body_markdown": "What bitrates do you use?",
    "body_html": "<p>What bitrates do you use?</p>",
    "revision": 1,
    "deleted": false,
    "created_at": "2026-09-25T18:00:00.000Z",
    "updated_at": "2026-09-25T18:00:00.000Z",
    "can_edit": true
  },
  "page": 1,
  "url": "/s/streaming/t/restreaming-to-three-platforms#post-5121"
}
Valid: thread-deleted
{
  "ok": true,
  "id": 311,
  "deleted": "thread"
}
Valid: vote
{
  "thread_id": 311,
  "score": 3,
  "upvotes": 4,
  "downvotes": 1,
  "my_vote": 1
}
Rejected: bad-deleted
{
  "ok": true,
  "id": 311,
  "deleted": "post"
}

Validate

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