api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 32 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api is the REST endpoint of the hub: it mounts the handlers of every resource under /api. It builds nothing itself; the composition root hands it the services in Deps.

Index

Constants

View Source
const DeviceListChannel = "device_list"

DeviceListChannel is the SSE channel on which the UI learns that it has to reload the device list (a device was added or its details changed).

Variables

This section is empty.

Functions

func RegisterSSEBridges added in v1.2.0

func RegisterSSEBridges(publisher sse.Publisher)

RegisterSSEBridges publishes every event the UI listens to on its channel.

Types

type Deps added in v1.2.0

type Deps struct {
	Logger httpx.Logger
	// NodeURL is the address of the node the control video connects to.
	NodeURL string
	// Cors lists the origins that may open the video websocket.
	Cors []string
	// DataDir is the folder of the test data served below /api/data.
	DataDir string

	Projects  *project.Service
	Access    *access.Service
	Apps      *appsvc.Service
	Tests     *testsvc.Service
	Runs      *runsvc.Service
	Protocols *protocolsvc.Service
	Overview  *overviewsvc.Service
	Devices   *devicesvc.Service

	Control *hubcontrol.Service
	Broker  *sse.Broker
	MCP     *hubmcp.Handler
}

Deps are the services the API serves; the composition root builds each of them once.

type Endpoint added in v1.2.0

type Endpoint struct {
	// contains filtered or unexported fields
}

Endpoint serves the REST API. It implements endpoints.ServiceEndpoint.

func New

func New(deps Deps) *Endpoint

New returns the endpoint on the services of deps.

func (*Endpoint) RegisterRoutes added in v1.2.0

func (e *Endpoint) RegisterRoutes(_ *gin.Engine, auth *gin.RouterGroup) error

RegisterRoutes mounts the API below the authenticated group.

type NodeStatusPayload added in v1.1.0

type NodeStatusPayload struct {
	NodeIdentifier manager.NodeIdentifier `json:"nodeIdentifier"`
	Connected      bool                   `json:"connected"`
}

NodeStatusPayload is published on the "nodes" SSE channel.

Directories

Path Synopsis
Package apps is the HTTP adapter of the apps and their parameters: it reads the request, calls the app service and writes the result.
Package apps is the HTTP adapter of the apps and their parameters: it reads the request, calls the app service and writes the result.
Package bundles is the HTTP adapter of the bundles of an app: it reads the request, calls the app service and writes the result.
Package bundles is the HTTP adapter of the bundles of an app: it reads the request, calls the app service and writes the result.
Package devices is the HTTP adapter of the device use cases: it reads the request, calls one service method and writes the result.
Package devices is the HTTP adapter of the device use cases: it reads the request, calls one service method and writes the result.
internal
appfixture
Package appfixture is the test setup of the app and bundle routes: the api with two projects that have an app each, a temporary bundle folder, and helpers to store bundles and send raw and multipart requests.
Package appfixture is the test setup of the app and bundle routes: the api with two projects that have an app each, a temporary bundle folder, and helpers to store bundles and send raw and multipart requests.
runfixture
Package runfixture is the test setup of the run, protocol, overview and stats routes: the api with two projects that have one app, test and run each.
Package runfixture is the test setup of the run, protocol, overview and stats routes: the api with two projects that have one app, test and run each.
Package overview holds the HTTP handlers of the project overview and statistics.
Package overview holds the HTTP handlers of the project overview and statistics.
Package profile is the HTTP adapter of the signed in user: the profile and the personal access tokens.
Package profile is the HTTP adapter of the signed in user: the profile and the personal access tokens.
Package projects is the HTTP adapter of the project use cases.
Package projects is the HTTP adapter of the project use cases.
Package protocols holds the HTTP handlers of the protocols of a test run: the protocol page and the baselines its performance is compared with.
Package protocols holds the HTTP handlers of the protocols of a test run: the protocol page and the baselines its performance is compared with.
Package runs holds the HTTP handlers of the test runs of an app: paging through them, the run page, starting and cancelling a run.
Package runs holds the HTTP handlers of the test runs of an app: paging through them, the run page, starting and cancelling a run.
Package settings is the HTTP adapter of the project settings: the users, the access tokens of the project and the nodes.
Package settings is the HTTP adapter of the project settings: the users, the access tokens of the project and the nodes.
Package tests holds the HTTP handlers of the test definitions of an app: they parse the request, call the test service and write the answer.
Package tests holds the HTTP handlers of the test definitions of an app: they parse the request, call the test service and write the answer.

Jump to

Keyboard shortcuts

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