From a95deb0690428f3c793ae7b4e2401ff56de72343 Mon Sep 17 00:00:00 2001 From: Collin Guarino Date: Thu, 18 Feb 2016 23:30:40 -0500 Subject: Implemented Bridge.Login() func that will assign Bridge.Username and create the user if it does not exist. Also convered more functions to Bridge.func() --- light.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'light.go') diff --git a/light.go b/light.go index 90fadbf..06d5682 100644 --- a/light.go +++ b/light.go @@ -172,7 +172,7 @@ func (light *Light) SetState(newState LightState) error { } // GetAllLights retreives the state of all lights that the bridge is aware of. -func GetAllLights(bridge *Bridge) ([]Light, error) { +func (bridge *Bridge) GetAllLights() ([]Light, error) { // Loop through all light indicies to see if they exist // and parse their values. Supports 100 lights. var lights []Light @@ -212,8 +212,8 @@ func GetLightByIndex(bridge *Bridge, index int) (Light, error) { } // GetLight returns a light struct containing data on a given name. -func GetLightByName(bridge *Bridge, name string) (Light, error) { - lights, _ := GetAllLights(bridge) +func (bridge *Bridge) GetLightByName(name string) (Light, error) { + lights, _ := bridge.GetAllLights() for _, light := range lights { if light.Name == name { return light, nil -- cgit v1.2.3