TipsExternalRequest tips.external-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/external-request.v1.json

tips.external-request@1: the body of tips.interaction.record on OpenVibe.Tips (services only). POST /api/v1/interactions/external: { creator, provider, provider_ref, amount_cents, supporter?, supporter_name?, message?, goal_id?, privacy?, announce?, test? } records a tip that never touched OpenVibe money (ADR-012 EXTERNAL: a tip on the creator's own PowerChat), once per (provider, provider_ref); no Billing liability, excluded from Billing reconciliation. It settles at once (overlay alert, goal); announce true also has Tips post the chat line. 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 provider or provider_ref), tips.invalid_amount, tips.text_too_long or tips.invalid_subject; 404 tips.creator_not_found; 403 capability.denied. Unknown fields are ignored.

Fields

FieldTypeRequiredDescriptionConstraints
creatorone ofyesThe creator tipped.
providerstringyesLowercased: powerchat, …
  • pattern ^[A-Za-z][A-Za-z0-9_-]{1,39}$
provider_refstringyesThe provider's event id.
  • minLength 1
  • maxLength 200
amount_centsinteger | stringyesThe money that arrived, in cents (at most 100000000); recorded as the amount too.
  • pattern ^[1-9][0-9]*$
  • minimum 1
  • maximum 100000000
supporterone ofThe supporter, when known.
supporter_namestring | null
messagestring | null
  • maxLength 500
goal_idstring
privacyobjectThe supporter's choices; any other field is refused (422 tips.invalid_input). true, 1, "1", "true" and "on" count as yes.
  • no other fields
privacy.anonymousboolean | integer | stringThe name reads "Anonymous" to everyone but the supporter.
privacy.hide_amountboolean | integer | stringThe amount is left out of overlays, chat lines and public pages.
privacy.private_messageboolean | integer | stringA tip's message is for the creator only (tips only; 422 for the other kinds).
announcebooleantrue: Tips delivers the chat line itself (the provider did not announce it).
testboolean | integer | stringTest money: never counted.

Examples

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

Valid: powerchat
{
  "creator": {
    "type": "user",
    "id": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ"
  },
  "provider": "powerchat",
  "provider_ref": "pcevt_7730021",
  "amount_cents": 500,
  "supporter_name": "moosefan",
  "message": "Love the stream",
  "announce": false
}
Rejected: no-ref
{
  "creator": "usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "provider": "powerchat",
  "amount_cents": 500
}

Validate

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