aboutsummaryrefslogtreecommitdiff
path: root/scene.go
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-15 10:15:23 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-15 10:15:23 -0500
commit0653dcab284be6f05ebf8dc4b3054b49d9a5b519 (patch)
tree81da2d0154a90a2ce6359548619eb55e282f2229 /scene.go
parentfa89d06b0ba2a5cb8a1bc1285703a99bc8109028 (diff)
Implementation for Bridge.CreateScene
Diffstat (limited to 'scene.go')
-rw-r--r--scene.go36
1 files changed, 23 insertions, 13 deletions
diff --git a/scene.go b/scene.go
index da26718..4ef319f 100644
--- a/scene.go
+++ b/scene.go
@@ -15,19 +15,19 @@ import (
// Scene struct defines attributes for Scene items
type Scene struct {
- Appdata struct {
- Data string `json:"data"`
- Version int `json:"version"`
- } `json:"appdata"`
- Lastupdated string `json:"lastupdated"`
- Lights []string `json:"lights"`
- Locked bool `json:"locked"`
- Name string `json:"name"`
- Owner string `json:"owner"`
- Picture string `json:"picture"`
- Recycle bool `json:"recycle"`
- Version int `json:"version"`
- ID string
+ Appdata *struct {
+ Data string `json:"data,omitempty"`
+ Version int `json:"version,omitempty"`
+ } `json:"appdata,omitempty"`
+ Lastupdated string `json:"lastupdated,omitempty"`
+ Lights []string `json:"lights,omitempty"`
+ Locked bool `json:"locked,omitempty"`
+ Name string `json:"name,omitempty"`
+ Owner string `json:"owner,omitempty"`
+ Picture string `json:"picture,omitempty"`
+ Recycle bool `json:"recycle,omitempty"`
+ Version int `json:"version,omitempty"`
+ ID string `json:",omitempty"`
}
// Bridge.GetScenes will get attributes for all scenes.
@@ -70,3 +70,13 @@ func (bridge *Bridge) GetScene(id string) (Scene, error) {
}
return scene, nil
}
+
+// Bridge.CreateScene will post a new scene configuration to the bridge.
+func (bridge *Bridge) CreateScene(scene Scene) error {
+ uri := fmt.Sprintf("/api/%s/scenes/", bridge.Username)
+ body, _, err := bridge.Post(uri, scene)
+ if err != nil {
+ return err
+ }
+ return nil
+}