TipsGoalCreateRequest tips.goal-create-request@1

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

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

tips.goal-create-request@1: the body of tips.goal.create on OpenVibe.Tips. POST /api/v1/goals: { creator?, title, target_amount, description?, image_url?, sort_order? } opens a goal (a service names the creator; a person opens one on their own page). Its total is derived from settled interactions only. Needs an Idempotency-Key header (8-200 of A-Z a-z 0-9 . _ : -; 400 idempotency.key_required): a replay with the same key and body returns the first answer, the same key with another body is 422 idempotency.key_reused. Refusals are problem+json: 422 tips.invalid_input (no title, a bad image_url or sort_order), tips.invalid_amount or tips.text_too_long; 409 tips.too_many_goals (20 active at most); 404 tips.creator_not_found; 403 capability.denied or tips.forbidden. Unknown fields are ignored.

Fields

FieldTypeRequiredDescriptionConstraints
creatorone ofThe creator (default: the signed-in person).
titlestringyes
  • minLength 1
  • maxLength 120
target_amountinteger | stringyesVibes bits, at most TIPS_MAX_BITS (10000000 by default).
  • pattern ^[1-9][0-9]*$
  • minimum 1
  • maximum 10000000
descriptionstring | null
  • maxLength 1000
image_urlstring | nullAn https URL; empty or null clears it.
sort_orderinteger | string
  • pattern ^[0-9]{1,4}$
  • minimum 0
  • maximum 1000

Examples

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

Valid: mic
{
  "creator": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "title": "New microphone",
  "target_amount": 20000,
  "description": "Help me sound less like a tin can."
}
Rejected: no-target
{
  "title": "New microphone"
}

Validate

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