http

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPresetURLNew

func GetPresetURLNew(store store.Store, url string) echo.HandlerFunc

func Router

func Router(a API, fs fs.FS) *echo.Echo

func Start

func Start(e *echo.Echo, port int) error

Types

type API

type API struct {
	Hub        *hub.Hub
	Discoverer *radio.Discoverer
	Store      store.Store
}

func NewAPI

func NewAPI(hub *hub.Hub, Discoverer *radio.Discoverer, store store.Store) API

func (API) DeleteRadio

func (a API) DeleteRadio(c echo.Context) error

@Summary Delete radio @Tags radios @Param uuid path string true "Radio UUID" @Produce json @Success 200 @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /radios/{uuid} [delete]

func (API) DiscoverRadios

func (a API) DiscoverRadios(c echo.Context) error

@Summary Discover radios @Tags radios @Produce json @Success 200 @Failure 409 {object} HTTPError "Discovery already in progress" @Failure 500 {object} HTTPError @Router /radios [post]

func (API) GetBuild

func (a API) GetBuild(c echo.Context) error

@Summary Get build @Tags build @Produce json @Success 200 {object} model.Build @Router /build [get]

func (API) GetPreset

func (a API) GetPreset(c echo.Context) error

@Summary Get preset @Tags presets @Param url path string true "Preset URL" @Produce json @Success 200 {object} model.Preset @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /presets/{url} [get]

func (API) GetRadio

func (a API) GetRadio(c echo.Context) error

@Summary Get radio @Tags radios @Param uuid path string true "Radio UUID" @Produce json @Success 200 {object} model.Radio @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /radios/{uuid} [get]

func (API) GetState

func (a API) GetState(c echo.Context) error

@Summary Get state @Tags states @Param uuid path string true "Radio UUID" @Produce json @Success 200 {object} state.State @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /states/{uuid} [get]

func (API) ListPresets

func (a API) ListPresets(c echo.Context) error

@Summary List presets @Tags presets @Produce json @Success 200 {array} model.Preset @Failure 500 {object} HTTPError @Router /presets [get]

func (API) ListRadios

func (a API) ListRadios(c echo.Context) error

@Summary List radios @Tags radios @Produce json @Success 200 {array} model.Radio @Router /radios [get]

func (API) ListStates

func (a API) ListStates(c echo.Context) error

@Summary List states @Tags states @Produce json @Success 200 {array} state.State @Router /states [get]

func (API) PostState

func (a API) PostState(c echo.Context) error

@Summary Update state @Tags states @Param uuid path string true "Radio UUID" @Param state body PostState true "Patch state" @Success 200 @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /states/{uuid} [post]

func (API) RadioMiddleware

func (a API) RadioMiddleware(next echo.HandlerFunc) echo.HandlerFunc

func (API) RefreshRadioSubscription

func (a API) RefreshRadioSubscription(c echo.Context) error

@Summary Refresh radio subscription @Tags radios @Param uuid path string true "Radio UUID" @Produce json @Success 200 @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /radios/{uuid}/subscription [post]

func (API) RefreshRadioVolume

func (a API) RefreshRadioVolume(c echo.Context) error

@Summary Refresh radio volume @Tags radios @Param uuid path string true "Radio UUID" @Produce json @Success 200 @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /radios/{uuid}/volume [post]

func (API) UpdatePreset

func (a API) UpdatePreset(c echo.Context) error

@Summary Update preset @Tags presets @Param preset body model.Preset true "Preset" @Produce json @Success 200 @Failure 400 {object} HTTPError @Failure 404 {object} HTTPError @Failure 500 {object} HTTPError @Router /presets [post]

func (API) WS

func (a API) WS(upgrader *websocket.Upgrader) echo.HandlerFunc

@Summary WebSocket @Tags websocket @Param Command body ws.Command false "Command" @Param Event body ws.Event false "Event" @Success 200 {object} pubsub.Stale

type HTTPError

type HTTPError struct {
	Message string `json:"message" validate:"required"`
}

type PostState

type PostState struct {
	Power       *bool   `json:"power,omitempty" validate:"optional"`
	AudioSource *string `json:"audio_source,omitempty" validate:"optional"`
	Preset      *int    `json:"preset,omitempty" validate:"optional"`
	Volume      *int    `json:"volume,omitempty" validate:"optional"`
	VolumeDelta *int    `json:"volume_delta,omitempty" validate:"optional"`
}

type RadioContext

type RadioContext struct {
	echo.Context
	Radio hub.Radio
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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