VipPolicySetRequest vip.policy-set-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/policy-set-request.v1.json
vip.policy-set-request@1: bodies of vip.resource.policy.set on OpenVibe.VIP. POST /api/v1/policies: { resource, creator?, requirement?, plan_id?, perk_key?, sensitive? } creates the creator's rule for a resource, replacing (disabling) the creator's active rule for the same resource; a service names the creator (a user SubjectRef), a person sets rules for themselves. requirement member (default), plan (members of plan_id, one of the creator's plans) or perk (members whose plan version includes perk_key). DELETE /api/v1/policies/:id takes no body and disables the rule. Refusals are problem+json: 422 vip.invalid_input (no EntityRef resource, a bad requirement, the network as creator), vip.plan_not_found or vip.perk_not_found; 404 vip.rule_not_found; 403 capability.denied or vip.not_yours. Unknown fields are ignored.
Fields
This schema has no named fields.
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: delete
{}Valid: member
{
"resource": {
"service": "community",
"type": "thread",
"id": "thr_01JAB2C3D4E5F6G7H8J9K0MNQ4"
},
"sensitive": true
}Valid: perk
{
"creator": {
"type": "user",
"id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
},
"resource": {
"service": "blog",
"type": "post",
"id": "pst_01JAB2C3D4E5F6G7H8J9K0MNPZ"
},
"requirement": "perk",
"perk_key": "chat-badge"
}Rejected: no-resource
{
"requirement": "member"
}Rejected: plan-without-id
{
"resource": {
"service": "blog",
"type": "post",
"id": "pst_01JAB2C3D4E5F6G7H8J9K0MNPZ"
},
"requirement": "plan"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('vip.policy-set-request@1', value); // { valid, errors: [{ path, message }] }