handlers

package
v0.0.0-...-ea5a937 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StrInSlice

func StrInSlice(str string, list []string) bool

StrInSlice returns true if string is in slice

Types

type ColorChangeResponse

type ColorChangeResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

ColorChangeResponse responds with a boolean to indicate successful or not and message

type ColorsListResponse

type ColorsListResponse struct {
	SupportedColors []string `json:"supportedColors"`
}

ColorsListResponse responds supported colors to set

type GetColorsHandler

type GetColorsHandler struct {
	echo.Context
	SupportedColors []string
}

GetColorsHandler holds all the data needed for the GET colors handler

func (GetColorsHandler) Handler

func (h GetColorsHandler) Handler(c echo.Context) error

colors godoc @Summary Get available colors to change to @Description Get list of supported colors @Produce json @Success 200 {object} ColorsListResponse @Router /colors [get]

type GetSoundsHandler

type GetSoundsHandler struct {
	echo.Context
	SupportedSounds []string
}

GetSoundsHandler holds all the data needed for the GET sounds handler

func (*GetSoundsHandler) Handler

func (h *GetSoundsHandler) Handler(c echo.Context) error

sounds godoc @Summary Get available sounds to play @Description Get list of supported sounds @Produce json @Success 200 {object} SoundsListResponse @Router /sounds [get]

type LightStateChangeResponse

type LightStateChangeResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

LightStateChangeResponse responds with a boolean to indicate successful or not and message

type PostColorsHandler

type PostColorsHandler struct {
	echo.Context
	HueBridge *huego.Bridge
	HueLights []huego.Light
}

PostColorsHandler holds all the data needed for the POST colors handler

func (*PostColorsHandler) Handler

func (h *PostColorsHandler) Handler(c echo.Context) error

:color godoc @Summary Change hue lights color @Description Change hue lights to supported color defined in color map @Produce json @Success 200 {object} ColorChangeResponse @Failure 400 {object} ColorChangeResponse @Failure 403 {object} ColorChangeResponse @Failure 500 {object} ColorChangeResponse @Router /color/{color} [post] @Param color path string true "Color to change lights to"

type PostLightsHandler

type PostLightsHandler struct {
	echo.Context
	HueLights []huego.Light
}

PostLightsHandler holds all the data needed for the POST lights handler

func (*PostLightsHandler) Handler

func (h *PostLightsHandler) Handler(c echo.Context) error

:state godoc @Summary Change state of configured lights @Description Only supports states of on/off @Produce json @Success 200 {object} LightStateChangeResponse @Failure 400 {object} LightStateChangeResponse @Failure 403 {object} LightStateChangeResponse @Failure 500 {object} LightStateChangeResponse @Router /lights/{state} [post] @Param state path string true "State to set lights to (on/off)"

type PostSoundsHandler

type PostSoundsHandler struct {
	echo.Context
	Queue                 chan string
	HomeAssistantEntityID string
	QuietTimeStart        int
	QuietTimeEnd          int
	QuietTimeEnabled      bool
}

PostSoundsHandler holds all the data needed for the POST sounds handler

func (*PostSoundsHandler) Handler

func (h *PostSoundsHandler) Handler(c echo.Context) error

:sound godoc @Summary Play sound via home assistant @Description Play halloween sound supported in sound list @Produce json @Success 202 {object} SoundPlayResponse @Failure 400 {object} SoundPlayResponse @Failure 403 {object} SoundPlayResponse @Failure 429 {object} SoundPlayResponse @Router /sound/{sound} [post] @Param sound path string true "Sound to play"

type SoundPlayResponse

type SoundPlayResponse struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

SoundPlayResponse responds with a boolean to indicate successful or not and message

type SoundsListResponse

type SoundsListResponse struct {
	SupportedSounds []string `json:"supportedSounds"`
}

SoundsListResponse responds supported sounds to play

Jump to

Keyboard shortcuts

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