From 9635b6615ca84c7c1018e28c0da9700f016b0497 Mon Sep 17 00:00:00 2001 From: Collin Guarino Date: Sat, 30 Jan 2016 13:29:48 -0500 Subject: Cleaned up CreateUser function and added documentation. --- bridge.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'bridge.go') diff --git a/bridge.go b/bridge.go index 0a36d17..46f55d4 100644 --- a/bridge.go +++ b/bridge.go @@ -141,7 +141,6 @@ func GetBridgeInfo(self *Bridge) { } // CreateUser posts to ./api on the bridge to create a new whitelisted user. -// If the button on the bridge was not pressed then _____todo_____ func CreateUser(bridge *Bridge, deviceType string) (string, Error) { // Construct the http POST params := map[string]string{"devicetype": deviceType} @@ -165,16 +164,14 @@ func CreateUser(bridge *Bridge, deviceType string) (string, Error) { return "", ErrResponse } + // Parse the result and return it result := string(body) errFound := strings.Contains(result, "error") noLink := strings.Contains(result, "link button not pressed") if errFound && noLink { return "", ErrLink } - // TODO: decode and return - // TODO: handle errors. http://www.developers.meethue.com/documentation/error-messages - return "", NoErr } -- cgit v1.2.3