QuestAppQuestRequest quest.app-quest-request@1

Generated at from openvibe-contracts v0.193.1 and openvibe-sdk v0.48.0.

Version
1.0.0
Owner
quest
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/quest/app-quest-request.v1.json

quest.app-quest-request@1: PUT /api/v1/app-quests/:slug on OpenVibe.Quest with an app token (capability quest.app_quest.manage). A developer app defines a quest on its own project's events: each step counts events of type app.<project_key>.<name> whose envelope actor is a person (the app publishing on_behalf_of them). The badge is the only reward: app quests never pay OpenCoins. Only production apps' events are counted (Events never hands sandbox events to first-party consumers).

Fields

FieldTypeRequiredDescriptionConstraints
titlestringyes
  • minLength 1
  • maxLength 80
whystring
  • maxLength 300
stepsarray of objectyes
  • minItems 1
  • maxItems 5
  • items: no other fields
steps[].event_typestringyesOne of the app's own event types (app.<project_key>.<name>), as it publishes them at OpenVibe.Events.
  • pattern ^app\.p[0-9a-z]{26}\.[a-z0-9_]+(\.[a-z0-9_]+){0,3}$
steps[].countintegeryes
  • minimum 1
  • maximum 1000
steps[].labelstringyes
  • minLength 1
  • maxLength 120
badgeobjectyes
  • no other fields
badge.namestringyes
  • minLength 1
  • maxLength 40
urlstringWhere a person does the steps: the app's own page.
  • pattern ^https://
  • format uri
  • maxLength 500
statusenumretired: kept with its completions and badges, no longer counted or listed. Default active.
  • one of "active", "retired"

Examples

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

Valid: full
{
  "title": "Collector",
  "why": "Find all five gems.",
  "steps": [
    {
      "event_type": "app.p01jab2c3d4e5f6g7h8j9k0mnpq.gem.found",
      "count": 5,
      "label": "Find a gem"
    },
    {
      "event_type": "app.p01jab2c3d4e5f6g7h8j9k0mnpq.level_completed",
      "count": 2,
      "label": "Finish two levels"
    }
  ],
  "badge": {
    "name": "Gem Collector"
  },
  "url": "https://example.com/play",
  "status": "active"
}
Valid: minimal
{
  "title": "Beat the first level",
  "steps": [
    {
      "event_type": "app.p01jab2c3d4e5f6g7h8j9k0mnpq.level_completed",
      "count": 1,
      "label": "Finish level one"
    }
  ],
  "badge": {
    "name": "Level One"
  }
}
Rejected: coins
{
  "title": "Paid",
  "steps": [
    {
      "event_type": "app.p01jab2c3d4e5f6g7h8j9k0mnpq.x",
      "count": 1,
      "label": "x"
    }
  ],
  "badge": {
    "name": "x"
  },
  "coins": 50
}
Rejected: first-party-event
{
  "title": "Go live",
  "steps": [
    {
      "event_type": "live.stream.started",
      "count": 1,
      "label": "Go live"
    }
  ],
  "badge": {
    "name": "Live"
  }
}
Rejected: no-steps
{
  "title": "Nothing",
  "steps": [],
  "badge": {
    "name": "x"
  }
}

Validate

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