Add serverTime to response
All checks were successful
Build image / build-image (push) Successful in 3m7s
All checks were successful
Build image / build-image (push) Successful in 3m7s
This commit is contained in:
parent
4964c62212
commit
6e53521b84
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
vrnp-static = pkgs.buildGoModule {
|
vrnp-static = pkgs.buildGoModule {
|
||||||
pname = "vrnp";
|
pname = "vrnp";
|
||||||
version = "0.0.9";
|
version = "0.0.10";
|
||||||
vendorHash = null;
|
vendorHash = null;
|
||||||
|
|
||||||
# For building the package, we use only the files not ignored by Git as inputs.
|
# For building the package, we use only the files not ignored by Git as inputs.
|
||||||
|
9
main.go
9
main.go
@ -17,6 +17,7 @@ import "time"
|
|||||||
// JSON unmarshaling types for departure monitor API
|
// JSON unmarshaling types for departure monitor API
|
||||||
|
|
||||||
type DMResponse struct {
|
type DMResponse struct {
|
||||||
|
DateTime DMDateTime `json:"dateTime"`
|
||||||
DepartureList []DMDeparture `json:"departureList"`
|
DepartureList []DMDeparture `json:"departureList"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,6 +214,7 @@ func FetchDepartures(c EFAClient, stopId string) (DMResponse, error) {
|
|||||||
|
|
||||||
type Departures struct {
|
type Departures struct {
|
||||||
Departures []Departure `json:"departures"`
|
Departures []Departure `json:"departures"`
|
||||||
|
ServerTime string `json:"serverTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Departure struct {
|
type Departure struct {
|
||||||
@ -273,7 +275,12 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
|
|||||||
return cmp.Compare(a.Countdown, b.Countdown)
|
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() {
|
func main() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user