Skip to content

Adder OpenAPI Go Client

The generated Go client provides access to the Adder OpenAPI service. Use the github.com/blinklabs-io/adder/openapi module path.

Before importing the client, install the dependencies specified in the generated client instructions:

Terminal window
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Import the client with its canonical path:

import openapi "github.com/blinklabs-io/adder/openapi"

Use this module declaration in Go module references:

module github.com/blinklabs-io/adder/openapi

In Go imports and go.mod module references, replace github.com/blinklabs-io/cardano-node-api/openapi with github.com/blinklabs-io/adder/openapi:

import openapi "github.com/blinklabs-io/cardano-node-api/openapi"
import openapi "github.com/blinklabs-io/adder/openapi"

Rebuild the project after updating the references. Go resolves the client from the Adder module.

The Adder API exposes the following routes:

AreaMethodPathBehavior
RootGET/pingReturns pong as plain text.
RootGET/healthcheckReturns health status as JSON. The server returns 503 Service Unavailable when a registered health check reports an unhealthy component.
RootGET/eventsUses server-sent events (SSE) for requests without WebSocket upgrade headers. For requests with those headers, the server attempts a WebSocket upgrade and returns a WebSocket error when the requested upgrade fails.
FCMPOST/v1/fcmStores an FCM token from a JSON body containing a non-empty fcmToken value.
FCMGET/v1/fcm/{token}Returns the stored FCM token.
FCMDELETE/v1/fcm/{token}Deletes the stored FCM token.
QR setupGET/v1/qrcodeReturns the HTML page that generates a QR code for connecting to the Adder server.
OpenAPIGET/swagger/Opens the Swagger UI. Include the trailing slash in this URL.

The FCM and QR routes accept their documented trailing slash variants, such as /v1/fcm/ and /v1/qrcode/. The root /ping and /healthcheck routes also accept a trailing slash. After a requested WebSocket upgrade fails, the endpoint does not silently fall back to SSE. Requests without WebSocket upgrade headers continue to use SSE. The server applies read, header, and idle timeouts without a write timeout, so active streams continue without interruption.

An FCM request with malformed JSON or without a non-empty fcmToken returns a JSON 400 Bad Request response. The server records each request in structured access logs. If a handler panics before sending a response, panic recovery logs the failure and returns 500 Internal Server Error.


Doc Holiday logo

Docs authored by Doc Holiday