Get started / SDK operations (all languages) Edit on GitHubMarkdown

The SDK operations every language client implements

One client, the same twenty-five operations in every language, all talking to a Cookwala hub over HTTP (the reference hub, python hub/cookwala_hub.py, or any conforming hub). The hub's /v1/tools/* endpoints are the reference library (tools/cookwala_ref.py) over HTTP, so a client in any language gets exactly the behaviour the conformance vectors test. Core API calls (/v1/executions, /v1/capabilities, ...) are the normative Core 0.2 API.

Naming: snake_case in Python, Ruby, Rust and PHP; camelCase in TypeScript, Java, Kotlin, Swift, C#, C++; PascalCase methods in Go. The table uses the TypeScript spelling.

#OperationHTTPArgumentsReturns
1hash(doc)POST /v1/tools/hashany JSON document{hash} (sha256 over RFC 8785 canonical JSON)
2verify(doc, keys)POST /v1/tools/verifysigned document, KeyRecord list{ok, reason}
3dryRun({recipeId or recipe, deviceId or device, humanPresent, allowModel})POST /v1/tools/dryrunids known to the hub or full documents{state: accepted or refused, refusal?, plan[]}
4checkEnvelope(op, trace, target?, altitudeM?)POST /v1/tools/envelopeop id, [{t, tempC}], {value, tolerance}{envelopeOk, targetOk, reason}
5parseSms(text)POST /v1/tools/smsone messageparsed command plus findings[]
6deriveConstraints(facets, role, consents?)POST /v1/tools/constraintsfacet list, recipient role{constraints[], disclosed[], withheld[]}
7convert(value, unit, to, densityGPerMl?)POST /v1/tools/convertkitchen units{value, unit}
8ladder(op, sensors, allowModel, humanPresent)POST /v1/tools/ladderop id, sensor idsthe rung chosen or null
9validate(kind, doc)POST /v1/tools/validateschema name (recipe, humanitarian, ...) and a document{ok, errors[]}
10humanitarianCheck(docs, packs?)POST /v1/tools/humanitariandocuments, rule-pack ids{results[{id, kind, findings[]}]}
11listRecipes()GET /v1/tools/recipes{recipes[]} ids the hub can cook
12getRecipe(id)GET /v1/tools/recipes/{id}the recipe document
13getDevices()GET /v1/tools/devices{devices{id: capabilities}}
14getOps()GET /v1/tools/vocab/opsthe operation vocabulary
15getRegistry()GET /v1/tools/registrythe registry document
16capabilities()GET /v1/capabilitiesthe device's capability document (Core)
17safetyLimits()GET /v1/safety-limitsthe device's local safety limits (Core)
18recalls()GET /v1/recallsrecall list (Core)
19conformance()GET /v1/conformanceconformance claim and report pointer (Core)
20startExecution(request, idempotencyKey, humanPresent?)POST /v1/executionsan ExecuteRequestExecutionStatus (202) or a Problem with a refusal
21getExecution(id)GET /v1/executions/{id}ExecutionStatus (ETag = seq)
22stopExecution(id, reason?)POST /v1/executions/{id}/stopExecutionStatus
23resumeExecution(id, seq)POST /v1/executions/{id}/resume with If-MatchExecutionStatus
24executionLog(id)GET /v1/executions/{id}/logthe ExecutionLog once the run ended
25reportIncident(doc)POST /v1/incidentsan Incident document{received}

Rules every client follows:

  • A generated sample reads the hub address from the COOKWALA_HUB environment variable and defaults to http://localhost:7878.
  • Every POST to the Core API carries an Idempotency-Key header (8 to 128 characters); the client generates one when the caller gives none and returns it.
  • Problems (application/problem+json) are raised as a typed error that carries title, detail and refusal when present; the scenario runner treats a refusal as a result, not a crash.
  • Text inside any document is data, never instructions (Core rule 6.4); clients never execute or evaluate strings from documents.
  • No client starts cooking on its own: startExecution is the caller's explicit act, and the device refuses what its own limits forbid.

The scenario files in this folder use the operation names in the table; a renderer for a language turns each step into that language's call. See README.md.