EventsSubscriptionRequest events.subscription-request@1

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

Version
1.0.0
Owner
events
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/subscription-request.v1.json

events.subscription-request@1: the body of POST /api/v1/subscriptions on OpenVibe.Events (events.subscription.manage for services, events.app.subscribe for developer apps; the consumer is always the caller). topic_pattern (topic is accepted for it) and endpoint are required: a service's endpoint must be http(s) on the allow-list (127.0.0.1, *.openvibe.*), an app's must be https resolving only to public addresses. secret, when given, is 32 to 256 characters (else one is generated); retry_policy accepts max_attempts (1..20) and backoff_ms (1..20 delays of 0..86400000 ms) and nothing else. The same pattern and endpoint twice is 409 events.subscription_exists. GET /api/v1/subscriptions[/:id] and POST /api/v1/subscriptions/:id/disable|enable take no body.

Fields

This schema has no named fields.

Examples

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

Valid: service
{
  "topic_pattern": "media.vod.*",
  "endpoint": "http://127.0.0.1:3000/internal/media-events",
  "retry_policy": {
    "max_attempts": 8,
    "backoff_ms": [
      1000,
      5000,
      30000
    ]
  }
}
Rejected: unknown-retry-field
{
  "topic_pattern": "media.vod.*",
  "endpoint": "https://hooks.example.com/ov",
  "retry_policy": {
    "max_attempts": 8,
    "jitter": true
  }
}

Validate

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