CommunityPasteCreateRequest community.paste-create-request@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/paste-create-request.v1.json

community.paste-create-request@1: the body of POST /api/pastes on OpenVibe.Community (community.paste.create). A JSON text paste needs content (non-blank, at most the configured size, 512 KB by default); a multipart body with a `screenshot` image part (PNG, JPEG, WebP or GIF, 8 MB by default; also POST /api/pastes/screenshot) makes an image paste. Visibility other than unlisted or private is public, and an ownerless private paste becomes unlisted. slug (public pastes only), metadata and ai_summary/ai_tags are honoured from a service token only; a browser's are ignored. Unknown fields are ignored. The answer is { id, slug, url, paste } with 201.

Fields

FieldTypeRequiredDescriptionConstraints
contentstringThe text (trimmed).
  • minLength 1
screenshotstringMultipart only: the image part.
titlestring | nullTrimmed to 200 characters; Untitled (Screenshot for an image) when blank.
languagestringA language hint; auto or absent sniffs it from the content.
visibilitystringpublic (default), unlisted or private.
burn_after_readboolean | integer | stringTruthy (true, 1, '1', 'true', 'on'): gone after the first read by someone else.
is_nsfwboolean | integer | string
stream_idinteger | stringThe Live stream it was made during (digits).
descriptionstringMultipart screenshot: the text shown under the image.
page_urlstringMultipart screenshot: the page it shows.
user_agentstringMultipart screenshot: the capturing browser.
slugstringService callers, public pastes only: the slug to use (409 if taken).
  • pattern ^[A-Za-z0-9_-]{3,80}$
metadataobject | stringService callers only: a JSON object (at most 16 KB).
ai_summarystringService callers only (cut to 2000 characters).
ai_tagsanyService callers only, with ai_summary: JSON text or a value to serialise.

Examples

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

Valid: screenshot-multipart
{
  "screenshot": "<bytes>",
  "title": "Bug on the dashboard",
  "description": "the chart overflows",
  "page_url": "https://openvibe.live/dashboard"
}
Valid: text
{
  "title": "ffmpeg restream flags",
  "content": "ffmpeg -re -i in.flv -c copy -f flv rtmp://example/live",
  "language": "auto",
  "visibility": "unlisted",
  "stream_id": "812"
}
Rejected: blank-content
{
  "content": "",
  "title": "blank"
}
Rejected: no-content
{
  "title": "no content",
  "visibility": "public"
}

Validate

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