diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 00000000..7acf15d4 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,17 @@ +# `hafas-client` API + +- [`journeys(from, to, [opt])`](journeys.md) – get journeys between locations +- [`refreshJourney(refreshToken, [opt])`](refresh-journey.md) – fetch up-to-date/more details of a `journey` +- [`journeysFromTrip(tripId, previousStopover, to, [opt])`](journeys-from-trip.md) – get journeys from a trip to a location +- [`trip(id, lineName, [opt])`](trip.md) – get details for a trip +- [`tripsByName(lineNameOrFahrtNr, [opt])`](trips-by-name.md) – get all trips matching a name +- [`departures(station, [opt])`](departures.md) – query the next departures at a station +- [`arrivals(station, [opt])`](arrivals.md) – query the next arrivals at a station +- [`locations(query, [opt])`](locations.md) – find stations, POIs and addresses +- [`stop(id, [opt])`](stop.md) – get details about a stop/station +- [`nearby(location, [opt])`](nearby.md) – show stations & POIs around +- [`radar(north, west, south, east, [opt])`](radar.md) – find all vehicles currently in a certain area +- [`reachableFrom(address, [opt])`](reachable-from.md) – get all stations reachable from an address within `n` minutes +- [`remarks([opt])`](remarks.md) – get all remarks +- [`lines(query, [opt])`](lines.md) – get all lines matching a name +- [`serverInfo([opt])`](server-info.md) – fetch meta information from HAFAS diff --git a/docs/changelog.md b/docs/changelog.md index 11838d3f..1f8c2a43 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -16,8 +16,8 @@ ## `5.25.0` -- 0a636981 parse `CHKI` (check-in, check-out) legs ✅ -- 7c68f962 `parse{Stopover,JourneyLeg, Trip}`: expose `{arrival,departure}PrognosisType` ✅ +- 0a636981 parse `CHKI` (check-in, check-out) legs ✅ – Thanks @yu-re-ka! +- 7c68f962 `parse{Stopover,JourneyLeg, Trip}`: expose `{arrival,departure}PrognosisType` ✅ – Thanks @HybridFox! - 95af0a01 `parseArrival` & `parseDeparture`: expose `prognosisType` ✅ [🏷 `5.25.0`](https://github.com/public-transport/hafas-client/releases/tag/5.25.0), 2022-07-30 diff --git a/docs/readme.md b/docs/readme.md index a10760c0..11877c5e 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,20 +1,6 @@ -# API documentation +# `hafas-client` documentation -- [`journeys(from, to, [opt])`](journeys.md) – get journeys between locations -- [`refreshJourney(refreshToken, [opt])`](refresh-journey.md) – fetch up-to-date/more details of a `journey` -- [`journeysFromTrip(tripId, previousStopover, to, [opt])`](journeys-from-trip.md) – get journeys from a trip to a location -- [`trip(id, lineName, [opt])`](trip.md) – get details for a trip -- [`tripsByName(lineNameOrFahrtNr, [opt])`](trips-by-name.md) – get all trips matching a name -- [`departures(station, [opt])`](departures.md) – query the next departures at a station -- [`arrivals(station, [opt])`](arrivals.md) – query the next arrivals at a station -- [`locations(query, [opt])`](locations.md) – find stations, POIs and addresses -- [`stop(id, [opt])`](stop.md) – get details about a stop/station -- [`nearby(location, [opt])`](nearby.md) – show stations & POIs around -- [`radar(north, west, south, east, [opt])`](radar.md) – find all vehicles currently in a certain area -- [`reachableFrom(address, [opt])`](reachable-from.md) – get all stations reachable from an address within `n` minutes -- [`remarks([opt])`](remarks.md) – get all remarks -- [`lines(query, [opt])`](lines.md) – get all lines matching a name -- [`serverInfo([opt])`](server-info.md) – fetch meta information from HAFAS +**[API documentation](api.md)** ## Migrating from an old `hafas-client` version diff --git a/index.js b/index.js index 075a7bb4..bddf2bdc 100644 --- a/index.js +++ b/index.js @@ -139,7 +139,7 @@ const createClient = (profile, userAgent, opt = {}) => { subStops: true, // parse & expose sub-stops of stations? entrances: true, // parse & expose entrances of stops/stations? remarks: true, // parse & expose hints & warnings? - scheduledDays: false + scheduledDays: false, // parse & expose dates each journey is valid on? }, opt) if (opt.via) opt.via = profile.formatLocation(profile, opt.via, 'opt.via') @@ -245,7 +245,8 @@ const createClient = (profile, userAgent, opt = {}) => { polylines: false, // return leg shapes? (not supported by all endpoints) subStops: true, // parse & expose sub-stops of stations? entrances: true, // parse & expose entrances of stops/stations? - remarks: true // parse & expose hints & warnings? + remarks: true, // parse & expose hints & warnings? + scheduledDays: false, // parse & expose dates the journey is valid on? }, opt) const req = profile.formatRefreshJourneyReq({profile, opt}, refreshToken) diff --git a/readme.md b/readme.md index cec31d7f..547887b6 100644 --- a/readme.md +++ b/readme.md @@ -8,6 +8,8 @@ [![support Jannis via GitHub Sponsors](https://img.shields.io/badge/support%20Jannis-donate-fa7664.svg)](https://github.com/sponsors/derhuerst) [![chat with Jannis on Twitter](https://img.shields.io/badge/chat%20with%20Jannis-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst) +**[documentation](docs/readme.md)** + ## Background @@ -206,11 +208,11 @@ Each [profile](p/readme.md) has more detailed example code. ### in the browser -While `hafas-client` itself should work in the browser via a bundler like [Webpack](https://webpack.js.org), most HAFAS API endpoints don't enable [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), so you won't be able query them directly. +While `hafas-client` itself should work in the browser via a bundler like [Webpack](https://webpack.js.org), most HAFAS API endpoints don't allow [cross-origin resource sharing (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), so you won't be able query them (without a proxy server). -## TypeScript +### TypeScript -There are [community-maintained TypeScript typings](https://www.npmjs.com/package/@types/hafas-client). +There are [community-maintained TypeScript typings available as `@types/hafas-client`](https://www.npmjs.com/package/@types/hafas-client). ## API @@ -248,7 +250,7 @@ There are [community-maintained TypeScript typings](https://www.npmjs.com/packag - [`hafas-monitor-journeys`](https://github.com/derhuerst/hafas-monitor-journeys) – Use `hafas-client` to monitor journeys from A to B. - [`hafas-discover-stations`](https://github.com/derhuerst/hafas-discover-stations#hafas-discover-stations) – Pass in a HAFAS client, discover stations by querying departures. - [`hafas-estimate-station-weight`](https://github.com/derhuerst/hafas-estimate-station-weight#hafas-estimate-station-weight) – Pass in a HAFAS client, estimate the importance of a station. -- [`db-ticket`](https://github.com/envake/db-tickets) – A library to retrieve ticket information from Deutsche Bahn. +- [`db-tickets`](https://github.com/envake/db-tickets) – A library to retrieve ticket information from Deutsche Bahn. More related libraries can be found [via the npm package index](https://www.npmjs.com/search?q=hafas).