Help us shape the future of Go! Take the 2026 Go Developer Survey

benefits

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

README

Benefits node

A remote node in under 200 lines of Go with no dependencies. It grants a benefit right away up to 500, and for larger amounts it answers 202 and calls back after a review, the way an approval or a provisioning queue would. It checks the signature Operion sends, and Operion's tests run it against the real remote node client, so the example cannot drift from the contract.

Copy this folder to start a node in Go, or read main.go as the reference for another language: ServeHTTP is the whole contract, verified is the signature check and answerLater is the callback.

Run it with Operion

cd examples/benefits
docker compose up --build

compose.yaml builds Operion and this node, and serve registers the node type from node-types.json at start. Use your own secret in both files.

token='Authorization: Bearer dev-token'

id=$(curl -s -X POST localhost:9091/workflows -H "$token" -H 'X-Tenant-Id: acme' -H 'Content-Type: application/json' -d @workflow.json | jq -r .id)
curl -s -X POST localhost:9091/workflows/$id/publish -H "$token" -H 'X-Tenant-Id: acme'

curl -s -X POST localhost:9091/webhooks/acme/employees -H 'Content-Type: application/json' -d '{"amount": 100}'
curl -s -X POST localhost:9091/webhooks/acme/employees -H 'Content-Type: application/json' -d '{"amount": 1000}'

Read each execution with curl -s localhost:9091/executions/<id> -H "$token" -H 'X-Tenant-Id: acme'. The first completes at once. The second stays running, with benefit waiting, until the node calls back about five seconds later.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL