aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-13 11:25:45 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-13 11:25:45 -0500
commit922e7290c37e46046b1a4e68818c77c44a192b2e (patch)
treec3c0f24523c05f4edcec1a77fe12ac57a6c90ddc
parent0a6419db7d1db3f7521c6532b126d78526c65caa (diff)
Added documentation for Bridge.Delete, Bridge.Put, Light.Delete.
-rw-r--r--bridge.go3
-rw-r--r--light.go2
2 files changed, 5 insertions, 0 deletions
diff --git a/bridge.go b/bridge.go
index bf50f2d..62cd252 100644
--- a/bridge.go
+++ b/bridge.go
@@ -80,6 +80,8 @@ func (self *Bridge) Post(path string, params interface{}) ([]byte, io.Reader, er
return handleResponse(resp)
}
+// Bridge.Put will send an http PUT to the bridge with
+// a body formatted with parameters (in a generic interface)
func (self *Bridge) Put(path string, params interface{}) ([]byte, io.Reader, error) {
uri := fmt.Sprintf("http://" + self.IPAddress + path)
client := &http.Client{}
@@ -99,6 +101,7 @@ func (self *Bridge) Put(path string, params interface{}) ([]byte, io.Reader, err
return handleResponse(resp)
}
+// Bridge.Delete will send an http DELETE to the bridge
func (self *Bridge) Delete(path string) error {
uri := fmt.Sprintf("http://" + self.IPAddress + path)
client := &http.Client{}
diff --git a/light.go b/light.go
index 3d3b68c..aab344b 100644
--- a/light.go
+++ b/light.go
@@ -90,6 +90,8 @@ func (self *Light) Toggle() error {
return nil
}
+// Light.Delete will remove the light from the list of
+// lights available on the bridge.
func (self *Light) Delete() error {
uri := fmt.Sprintf("/api/%s/lights/%d", self.Bridge.Username, self.Index)
err := self.Bridge.Delete(uri)