Skip to content

Generate a client

There are no hand-maintained client libraries. The API is described by an OpenAPI 3.1 document, and you generate a client for whatever language you are working in directly from it.

That document is the same one the API reference renders, and it lives beside the server that implements it, so a generated client tracks the real API rather than a separately maintained copy of it.

https://crsdk.github.io/alpha-sdk-api/api-reference/openapi.yaml

Point any OpenAPI generator at the specification. A few common ones:

Terminal window
npx @hey-api/openapi-ts \
-i https://crsdk.github.io/alpha-sdk-api/api-reference/openapi.yaml \
-o src/camera-client

Pin the specification file into your repository rather than fetching it at build time if you want reproducible builds — it is a single YAML file.

The operations are grouped by tag, and a generated client will mirror that grouping:

server health, status, logs
cameras list, connect, disconnect, getConnectionStatus
properties get, set, getAll, getPriorityKey, setPriorityKey
actions shutter, halfPress, afShutter, zoom, focusNearFar, movieRec
liveView enable, disable, getStatus, start, stop, getFrame
sdCard list, download, downloadThumbnail, downloadScreennail
settings download, upload, list, importLut

Two things sit outside what a generator will give you, because they are not plain request/response operations:

  • Server-Sent Events — the two event streams are long-lived and most generators will not produce anything usable for them. Consume them with native EventSource (browser), URLSession.bytes(for:) (Swift), or httpx.stream (Python). See the SSE recipe.
  • Discovery, reconnect and lifecycle handling — application concerns rather than API surface. The recipes below cover the usual patterns.

Every client, generated or not, talks to the REST server running on the machine the camera is attached to.

Patterns that sit outside generated code. Each works against the REST API directly, so they apply whatever language you generate for.