aboutsummaryrefslogtreecommitdiff
path: root/bridge.go
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-01-30 13:29:48 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-01-30 13:29:48 -0500
commit9635b6615ca84c7c1018e28c0da9700f016b0497 (patch)
tree77c1127adee3dae1edd4822580da6b4926333619 /bridge.go
parent1c83569b783a7ad01039ed525be94f75abfc0b67 (diff)
Cleaned up CreateUser function and added documentation.
Diffstat (limited to 'bridge.go')
-rw-r--r--bridge.go5
1 files changed, 1 insertions, 4 deletions
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
}