From fb14bbfab6d23cac1fc987a6190c11b41fadc4d7 Mon Sep 17 00:00:00 2001 From: Collin Guarino Date: Sun, 14 Feb 2016 23:15:03 -0500 Subject: Added documentation and changed Bridge.GetScenes to Bridge.GetAllScenes for clarification. --- scene.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scene.go') diff --git a/scene.go b/scene.go index 95fac29..06b754a 100644 --- a/scene.go +++ b/scene.go @@ -12,6 +12,7 @@ import ( "encoding/json" ) +// Scene struct defines attributes for Scene items type Scene struct { Appdata struct { Data string `json:"data"` @@ -29,7 +30,7 @@ type Scene struct { } // Bridge.GetScenes will get attributes for all scenes. -func (bridge *Bridge) GetScenes() ([]Scene, error) { +func (bridge *Bridge) GetAllScenes() ([]Scene, error) { uri := fmt.Sprintf("/api/%s/scenes", bridge.Username) body, _, err := bridge.Get(uri) if err != nil { @@ -53,6 +54,9 @@ func (bridge *Bridge) GetScenes() ([]Scene, error) { return scenesList, nil } +// Bridge.GetScene will get the attributes for an individual scene. +// This is used to optimize time when updating the state of the scene. +// Note: The ID is not an index, it's a unique key generated for each scene. func (bridge *Bridge) GetScene(id string) (Scene, error) { uri := fmt.Sprintf("/api/%s/scenes/%s", bridge.Username, id) body, _, err := bridge.Get(uri) -- cgit v1.2.3