Something went wrong. Try again.
Zig bindings for the Singlewire InformaCast API, generated at build time from its OpenAPI specification.
Something went wrong. Try again.
Files
- Zig 88%
- Nix 12%
README.md
<!--
SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>
SPDX-License-Identifier: MIT
-->
# zig-informacast
Zig bindings for the [Singlewire InformaCast](https://www.singlewire.com/)
API, generated from the OpenAPI specification Singlewire publishes.
Nothing here is written by hand. `api/api.json` is Singlewire's own schema, and
the Zig is produced from it at build time, so the bindings track whatever
version of the schema is checked in rather than drifting from it.
## What is generated
The checked-in schema is the **InformaCast Mobile API Explorer, v1**
(OpenAPI 3.1): 426 paths and 615 component schemas, which come out as about
1400 structs, 147 enums and 1974 functions.
For each operation the generator emits three functions. Taking `getSupervisor`
as the example:
| Function | Returns | Use it when |
| --- | --- | --- |
| `getSupervisor` | `Owned(@"supervisors.response")` | You want the parsed body and are happy for a non-2xx status to be `error.ResponseError`. |
| `getSupervisorResult` | `ApiResult(@"supervisors.response")` | You need to tell an API error from a parse error, and to read the error body. |
| `getSupervisorRaw` | `RawResponse` | You want the status and bytes and will do your own parsing. |
Query and path parameters arrive as one options struct — required ones are
plain fields, optional ones default to null.
`Owned(T)` holds the response body, the `std.json.Parsed(T)` that borrows from
it, and the allocator; call `deinit()` and the pair goes away together.
`ApiResult(T)` is a tagged union of `ok`, `api_error` and `parse_error` with a
`deinit()` that frees whichever arm is live.
Many of Singlewire's type names are not Zig identifiers — they are written
`supervisors.response`, `_incident-plans.base` and so on — so they appear
escaped, as `@"supervisors.response"`. That is a spelling, not a different
kind of type.
## Using it
```zig
const std = @import("std");
const informacast = @import("informacast");
pub fn main(init: std.process.Init) !void {
const token = init.envir…