From d55d2719bd2e47df359589fe1a88395b90d4c021 Mon Sep 17 00:00:00 2001 From: "Stanko K.R." Date: Sat, 22 Aug 2026 17:16:12 +0200 Subject: [PATCH] Answer which calendars are selected on the list ToggleCalendar answers the selection it left behind, which is enough to follow it but not to open on it: a client that has toggled nothing has never been told what is on. HEY serves it on the calendar list for exactly that reason, and the payload was not modelling it, so the field went nowhere. One read at startup, and the toggle from then on. --- go/pkg/generated/client.gen.go | 5 +++++ go/pkg/hey/calendar_periods_test.go | 26 ++++++++++++++++++++++++++ go/pkg/hey/version.go | 2 +- openapi.json | 8 ++++++++ spec/hey.smithy | 5 +++++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/go/pkg/generated/client.gen.go b/go/pkg/generated/client.gen.go index 8a6759a..69f419e 100644 --- a/go/pkg/generated/client.gen.go +++ b/go/pkg/generated/client.gen.go @@ -217,6 +217,11 @@ type CalendarDayListPayload struct { type CalendarListPayload struct { CalendarChangesUrl string `json:"calendar_changes_url,omitempty"` Calendars []CalendarWithRecordingChangesUrl `json:"calendars,omitempty"` + + // SelectedCalendarIds The calendars every period read is drawn from. ToggleCalendar changes this and + // answers the new one, so a client reads it here once — to open on what is already + // on — and takes it from the toggle after that. + SelectedCalendarIds []int64 `json:"selected_calendar_ids,omitempty"` } // CalendarPeriod CalendarPeriod — a day or a week: its bounds and everything in it, grouped by type. diff --git a/go/pkg/hey/calendar_periods_test.go b/go/pkg/hey/calendar_periods_test.go index 00b9995..1f6dd83 100644 --- a/go/pkg/hey/calendar_periods_test.go +++ b/go/pkg/hey/calendar_periods_test.go @@ -240,6 +240,32 @@ func TestCalendarsToggleAnswersTheSelection(t *testing.T) { } } +// The calendar list carries the selection too, so a client can open on what is already on +// without a toggle to tell it. +func TestCalendarsListCarriesTheSelection(t *testing.T) { + client := periodsClient(t, func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{ + "calendars": [ + { "calendar": { "id": 41, "name": "Design Team", "color": "teal", "personal": false } }, + { "calendar": { "id": 42, "name": "", "personal": true } } + ], + "selected_calendar_ids": [42] + }`)) + }) + + payload, err := client.Calendars().List(context.Background()) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if len(payload.SelectedCalendarIds) != 1 || payload.SelectedCalendarIds[0] != 42 { + t.Errorf("selected ids = %v, want [42]", payload.SelectedCalendarIds) + } + if payload.Calendars[0].Calendar.Color != "teal" { + t.Errorf("color = %q, want teal", payload.Calendars[0].Calendar.Color) + } +} + func TestCalendarPeriodsReportNotFound(t *testing.T) { client := periodsClient(t, func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") diff --git a/go/pkg/hey/version.go b/go/pkg/hey/version.go index 29db69f..56d322a 100644 --- a/go/pkg/hey/version.go +++ b/go/pkg/hey/version.go @@ -1,7 +1,7 @@ package hey // Version is the current version of the HEY Go SDK. -const Version = "0.16.0" +const Version = "0.17.0" // APIVersion is the HEY API version this SDK targets. const APIVersion = "2026-08-21" diff --git a/openapi.json b/openapi.json index 5016e6a..695a44b 100644 --- a/openapi.json +++ b/openapi.json @@ -9832,6 +9832,14 @@ }, "calendar_changes_url": { "type": "string" + }, + "selected_calendar_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "description": "The calendars every period read is drawn from. ToggleCalendar changes this and\nanswers the new one, so a client reads it here once — to open on what is already\non — and takes it from the toggle after that." } } }, diff --git a/spec/hey.smithy b/spec/hey.smithy index 1c2915b..d5c2e25 100644 --- a/spec/hey.smithy +++ b/spec/hey.smithy @@ -822,6 +822,11 @@ list CalendarWithRecordingChangesUrlList { structure CalendarListPayload { calendars: CalendarWithRecordingChangesUrlList calendar_changes_url: String + + /// The calendars every period read is drawn from. ToggleCalendar changes this and + /// answers the new one, so a client reads it here once — to open on what is already + /// on — and takes it from the toggle after that. + selected_calendar_ids: CalendarIdList } /// RecurrenceSchedule