aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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")
+}