add success logic

This commit is contained in:
Ryan Cavicchioni 2020-02-28 22:15:40 -06:00
parent c0c49b6d7c
commit fb36967670
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -7,6 +7,8 @@ import (
const API_BASE_URL = "https://api.lifx.com/v1" const API_BASE_URL = "https://api.lifx.com/v1"
type ( type (
Status string
State struct { State struct {
Power string `json:"power,omitempty"` Power string `json:"power,omitempty"`
Color string `json:"color,omitempty"` Color string `json:"color,omitempty"`
@ -35,3 +37,13 @@ type (
Duration float64 `json:"duration,omitempty"` Duration float64 `json:"duration,omitempty"`
} }
) )
const (
OK Status = "ok"
TimedOut Status = "timed_out"
Offline Status = "offline"
)
func (s Status) Success() bool {
return s == OK
}