Documentation ¶
Overview ¶
Package api implements a wrapper around the rest api
Index ¶
- type Helper
- func (helper *Helper) AddAlarm(alarm types.Alarm) ([]types.Alarm, error)
- func (helper *Helper) ChangeAlarm(alarm types.Alarm, idx int) (types.Alarm, error)
- func (helper *Helper) CheckHealth() error
- func (helper *Helper) DeleteAlarm(idx int) ([]types.Alarm, error)
- func (helper *Helper) GetAlarm(idx int, withWritePermission bool) (types.Alarm, error)
- func (helper *Helper) GetAlarms(withWritePermission bool) ([]types.Alarm, error)
- func (helper *Helper) GetRadio(withWritePermission bool) (types.Radio, error)
- func (helper *Helper) SaveAlarm(idx int, alarm types.Alarm) (types.Alarm, error)
- func (helper *Helper) SaveRadio(radio types.Radio) (types.Radio, error)
- func (helper *Helper) StartRadio() (types.Radio, error)
- func (helper *Helper) StopRadio() (types.Radio, error)
- func (helper *Helper) SwitchRadio(running bool) (types.Radio, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Helper ¶
Helper struct to define the api settings being used
func GetHelperFromEnv ¶ added in v1.1.0
func GetHelperFromEnv() Helper
GetHelperFromEnv Returns the working helper object with the config loaded from a .env file It uses dotenv this means a .env file is required.
ALARMURL=URL-TO-ALARM # https://example.com EXTRAHEADER=EXTRA-HEADER # eg. ApiKey EXTRAHEADERVALUE=VALUE-FOR-THE-HEADER # eg. password1234
func (*Helper) ChangeAlarm ¶
ChangeAlarm changes the alarm on the given index with the data of the passed instance
func (*Helper) CheckHealth ¶
CheckHealth checks wether the api is reachable and returns 200 on the health endpoint
func (*Helper) DeleteAlarm ¶
DeleteAlarm deletes the alarm with the given index
func (*Helper) StartRadio ¶
StartRadio starts the radio
Click to show internal directories.
Click to hide internal directories.