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
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
title | string | yes |
| |
why | string |
| ||
steps | array of object | yes |
| |
steps[].event_type | string | yes | One of the app's own event types (app.<project_key>.<name>), as it publishes them at OpenVibe.Events. |
|
steps[].count | integer | yes |
| |
steps[].label | string | yes |
| |
badge | object | yes |
| |
badge.name | string | yes |
| |
url | string | Where a person does the steps: the app's own page. |
| |
status | enum | retired: kept with its completions and badges, no longer counted or listed. Default active. |
|
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 }] }