VipPlanCreateRequest vip.plan-create-request@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- vip
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/vip/plan-create-request.v1.json
vip.plan-create-request@1: the body of vip.plan.create on OpenVibe.VIP. POST /api/v1/plans: { creator?, name, slug?, description?, benefits?, perks?, billing_kind?, publish?, change_note? } creates a plan and its version 1 (published at once with publish). A service must name the creator (a user SubjectRef or network); a person creates for themselves (staff may name another creator or network). billing_kind defaults to channel_subscription for a creator and null for the network (Billing has no network product yet). Refusals are problem+json: 422 vip.invalid_input (no name, a bad slug or billing_kind), vip.text_too_long, vip.perk_not_found or vip.invalid_subject; 409 vip.plan_exists (the slug is taken) or vip.plan.billing_product_taken (the creator already has a published plan sold as a channel subscription); 403 capability.denied or vip.not_yours. Unknown fields are ignored.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
creator | one of | The creator the plan belongs to (a user SubjectRef, or network for staff). | ||
name | string | yes |
| |
slug | string | Default: made from the name. |
| |
description | string | null |
| ||
benefits | one of | At most 20, each at most 200 characters: a list, or one string with one benefit per line. | ||
perks | array of string | Perk ids (vpk_…) or keys: the creator's own active perks or the network's (422 vip.perk_not_found otherwise). |
| |
billing_kind | enum |
| ||
publish | boolean | integer | string | true (or 1, yes, on) publishes version 1 at once. | ||
change_note | string | null | Default: created. |
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: person-draft
{
"name": "Superfan",
"benefits": "Badge\nEmotes"
}Valid: service
{
"creator": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"name": "Supporter",
"slug": "supporter",
"description": "Back the stream every month.",
"benefits": [
"Supporter badge in chat"
],
"perks": [
"chat-badge"
],
"publish": true
}Rejected: bad-billing-kind
{
"name": "Supporter",
"billing_kind": "one_time"
}Rejected: no-name
{
"slug": "supporter",
"publish": true
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('vip.plan-create-request@1', value); // { valid, errors: [{ path, message }] }