aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-08-13 14:52:24 +0200
committerMartin Polden <mpolden@mpolden.no>2021-08-13 14:58:32 +0200
commit1f3910af30856e22a7a2d1125c9db583b706be09 (patch)
treefd18942800029a98180cf9e85d00bb558cbd8b8d
parentd3fe81a584d9d452f2171a7c26e847ff3e5a1281 (diff)
http: Increase departure count
-rw-r--r--entur/entur.go4
-rw-r--r--http/http.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/entur/entur.go b/entur/entur.go
index 4dfc60b..d918ca3 100644
--- a/entur/entur.go
+++ b/entur/entur.go
@@ -74,9 +74,9 @@ type line struct {
}
// Departures returns departures from the given stop ID. Use https://stoppested.entur.org/ to determine stop IDs.
-func (c *Client) Departures(stopID int) ([]Departure, error) {
+func (c *Client) Departures(count, stopID int) ([]Departure, error) {
// https://api.entur.io/journey-planner/v2/ide/ for query testing
- query := fmt.Sprintf(`{"query":"{stopPlace(id:\"NSR:StopPlace:%d\"){id name estimatedCalls{realtime expectedDepartureTime actualDepartureTime destinationDisplay{frontText}serviceJourney{journeyPattern{directionType line{publicCode}}}}}}"}`, stopID)
+ query := fmt.Sprintf(`{"query":"{stopPlace(id:\"NSR:StopPlace:%d\"){id name estimatedCalls(numberOfDepartures:%d){realtime expectedDepartureTime actualDepartureTime destinationDisplay{frontText}serviceJourney{journeyPattern{directionType line{publicCode}}}}}}"}`, stopID, count)
req, err := http.NewRequest("POST", c.URL, strings.NewReader(query))
if err != nil {
return nil, err
diff --git a/http/http.go b/http/http.go
index a87ba74..d8f82ad 100644
--- a/http/http.go
+++ b/http/http.go
@@ -123,7 +123,7 @@ func (s *Server) enturDepartures(urlPrefix string, stopID int, direction string)
if hit {
departures = cached.(Departures)
} else {
- enturDepartures, err := s.Entur.Departures(stopID)
+ enturDepartures, err := s.Entur.Departures(10, stopID)
if err != nil {
return Departures{}, hit, err
}