Use the `hafas-client` API to query public transport data
mainThe hafas-client provides a comprehensive set of methods to interact with HAFAS servers. You can query journeys, departures, arrivals, locations, and more. Each method typically accepts a primary identifier (like a station ID or location query) and an optional opt object for fine-tuning the request.
Core API Methods:
Journeys & Trips:
journeys(from, to, [opt]): Get journeys between two locations.refreshJourney(refreshToken, [opt]): Fetch up-to-date details or more information for an existing journey using a refresh token.journeysFromTrip(tripId, previousStopover, to, [opt]): Get journeys starting from a specific trip to a destination.trip(id, lineName, [opt]): Get detailed information for a specific trip.tripsByName(lineNameOrFahrtNr, [opt]): Retrieve all trips matching a specific name or FahrtNr.
Station & Location Queries:
departures(station, [opt]): Query upcoming departures at a specific station.arrivals(station, [opt]): Query upcoming arrivals at a specific station.locations(query, [opt]): Search for stations, Points of Interest (POIs), and addresses.stop(id, [opt]): Get detailed information about a specific stop or station.nearby(location, [opt]): Find stations and POIs near a given location.reachableFrom(address, [opt]): Find all stations reachable from a specific address within a certain time limit.
System & Infrastructure:
radar(north, west, south, east, [opt]): Find all vehicles currently located within a specified bounding box.lines(query, [opt]): Search for lines matching a name.remarks([opt]): Retrieve all current service remarks/alerts.serverInfo([opt]): Fetch metadata and information about the HAFAS server.