handler

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: BSD-2-Clause Imports: 13 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewListLightsHandler

func NewListLightsHandler(bridgesProvider pkg.BridgesProvider) libhttp.WithError

NewListLightsHandler returns a JSON handler that lists all lights on the first bridge known to the BridgesProvider.

func NewSetLogLevelHandler added in v0.5.0

func NewSetLogLevelHandler(
	levelVar *slog.LevelVar,
	defaultLevel slog.Level,
	autoResetDuration time.Duration,
) http.Handler

NewSetLogLevelHandler returns a handler for the /setloglevel/{level} route. The numeric level segment is validated (0-10) and mapped onto the given slog LevelVar (0 -> Info, >=1 -> Debug); invalid input yields a 400 response and leaves the level unchanged. Unless the level was re-set in the meantime, it auto-resets to defaultLevel after autoResetDuration.

func NewStatusHandler

func NewStatusHandler(bridgesProvider pkg.BridgesProvider) libhttp.WithError

NewStatusHandler returns a JSON handler that splits the lights on the first bridge into on/off name lists, sorted for stable output.

Types

type StatusResponse

type StatusResponse struct {
	On  []string `json:"on"`
	Off []string `json:"off"`
}

StatusResponse is a scannable summary of which lights are currently on and off across the first bridge known to the BridgesProvider.

Jump to

Keyboard shortcuts

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