Add serverTime to response
Build image / build-image (push) Successful in 4m48s

This commit is contained in:
2025-04-28 00:59:18 +02:00
parent 4964c62212
commit 6e53521b84
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -17,6 +17,7 @@ import "time"
// JSON unmarshaling types for departure monitor API
type DMResponse struct {
DateTime DMDateTime `json:"dateTime"`
DepartureList []DMDeparture `json:"departureList"`
}
@@ -213,6 +214,7 @@ func FetchDepartures(c EFAClient, stopId string) (DMResponse, error) {
type Departures struct {
Departures []Departure `json:"departures"`
ServerTime string `json:"serverTime"`
}
type Departure struct {
@@ -273,7 +275,12 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
return cmp.Compare(a.Countdown, b.Countdown)
})
return Departures{ds}, nil
dt := response.DateTime
return Departures{
ds,
fmt.Sprintf("%02s:%02s", dt.Hour, dt.Minute),
}, nil
}
func main() {