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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
content | string | The text (trimmed). |
| |
screenshot | string | Multipart only: the image part. | ||
title | string | null | Trimmed to 200 characters; Untitled (Screenshot for an image) when blank. | ||
language | string | A language hint; auto or absent sniffs it from the content. | ||
visibility | string | public (default), unlisted or private. | ||
burn_after_read | boolean | integer | string | Truthy (true, 1, '1', 'true', 'on'): gone after the first read by someone else. | ||
is_nsfw | boolean | integer | string | |||
stream_id | integer | string | The Live stream it was made during (digits). | ||
description | string | Multipart screenshot: the text shown under the image. | ||
page_url | string | Multipart screenshot: the page it shows. | ||
user_agent | string | Multipart screenshot: the capturing browser. | ||
slug | string | Service callers, public pastes only: the slug to use (409 if taken). |
| |
metadata | object | string | Service callers only: a JSON object (at most 16 KB). | ||
ai_summary | string | Service callers only (cut to 2000 characters). | ||
ai_tags | any | Service 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 }] }