aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-14 19:03:26 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-14 19:03:26 -0500
commit5c230f73b5d481dd21a52877395e63739897cb58 (patch)
treeb10dfaf6b717a6d83bd656bbbdd40d0171955766
parentee75d43f6f19a295531323d22d035bc9fcabc289 (diff)
Implemented Bridge.GetSchedule for individual schedule attribute inspections.
-rw-r--r--schedule.go11
-rw-r--r--schedule_test.go5
2 files changed, 16 insertions, 0 deletions
diff --git a/schedule.go b/schedule.go
index c7c2690..a98358a 100644
--- a/schedule.go
+++ b/schedule.go
@@ -60,6 +60,17 @@ func (bridge *Bridge) GetSchedules() ([]Schedule, error) {
return scheduleList, nil
}
+// Bridge.GetSchedule will get the attributes for an individual schedule.
+// This is used as to optimize time when updating the state of a schedule item.
+func (bridge *Bridge) GetSchedule(id string) (Schedule, error) {
+ uri := fmt.Sprintf("/api/%s/schedules/%s", bridge.Username, id)
+ body, _, err := bridge.Get(uri)
+ if err != nil {
+ return Schedule{}, err
+ }
+ return Schedule{}, nil
+}
+
// func (bridge *Bridge) CreateSchedule(schedule interface{}) error {
// return nil
// }
diff --git a/schedule_test.go b/schedule_test.go
index 43d6e70..6618b27 100644
--- a/schedule_test.go
+++ b/schedule_test.go
@@ -15,3 +15,8 @@ func TestGetSchedules(t *testing.T) {
bridge, _ := NewBridge("192.168.1.128", "427de8bd6d49f149c8398e4fc08f")
_, _ = bridge.GetSchedules()
}
+
+func TestGetSchedule(t *testing.T) {
+ bridge, _ := NewBridge("192.168.1.128", "427de8bd6d49f149c8398e4fc08f")
+ _, _ = bridge.GetSchedule("4673980164949558")
+}