diff options
-rw-r--r-- | entur/entur.go | 4 | ||||
-rw-r--r-- | http/http.go | 2 |
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 } |