diff options
author | Collin Guarino <collin.guarino@gmail.com> | 2016-01-30 13:29:48 -0500 |
---|---|---|
committer | Collin Guarino <collin.guarino@gmail.com> | 2016-01-30 13:29:48 -0500 |
commit | 9635b6615ca84c7c1018e28c0da9700f016b0497 (patch) | |
tree | 77c1127adee3dae1edd4822580da6b4926333619 | |
parent | 1c83569b783a7ad01039ed525be94f75abfc0b67 (diff) |
Cleaned up CreateUser function and added documentation.
-rw-r--r-- | bridge.go | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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 } |