Compare commits

..

No commits in common. "9314e590531fe97631aefad4360b0a1ba7d36051" and "c671e995cb9100e47429dc9d473a6a577e1a160b" have entirely different histories.

5 changed files with 24 additions and 26 deletions

View file

@ -32,23 +32,23 @@ With `opt`, you can override the default options, which look like this:
entrances: true, // not supported entrances: true, // not supported
linesOfStops: false, // not supported linesOfStops: false, // not supported
remarks: true, // parse & expose hints & warnings? remarks: true, // parse & expose hints & warnings?
stopovers: false, // fetch & parse previous/next stopovers?, only supported with `dbweb` profile stopovers: false, // fetch & parse previous/next stopovers?
// departures at related stations // departures at related stations
// e.g. those that belong together on the metro map. // e.g. those that belong together on the metro map.
includeRelatedStations: true, // only true supported includeRelatedStations: true, // only true supported
language: 'en' // language to get results in language: 'en' // language to get results in
} }
``` ```
The maximum supported duration is 720 for `db` and 60 for other profiles. The maximum supported duration is 720 for `db` and 60 for `dbnav` profile.
If you pass an object `opt.products`, its fields will partially override the default products defined in the profile. If you pass an object `opt.products`, its fields will partially override the default products defined in the profile.
## Response ## Response
*Note:* As stated in the [*Friendly Public Transport Format* v2 draft spec](https://github.com/public-transport/friendly-public-transport-format/blob/3bd36faa721e85d9f5ca58fb0f38cdbedb87bbca/spec/readme.md), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule. *Note:* As stated in the [*Friendly Public Transport Format* v2 draft spec](https://github.com/public-transport/friendly-public-transport-format/blob/3bd36faa721e85d9f5ca58fb0f38cdbedb87bbca/spec/readme.md), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule.
You may pass a departure's `tripId` into [`trip(id, lineName, [opt])`](trip.md) to get details on the whole trip. For the `dbnav`/`dbweb` profile HAFAS trip ids will be returned, for the `db` profile, RIS trip ids will be returned, then the `trip()` endpoint supports both id types. You may pass a departure's `tripId` into [`trip(id, lineName, [opt])`](trip.md) to get details on the whole trip. For the `dbnav` profile HAFAS trip ids will be returned, for the `db` profile, RIS trip ids will be returned, then the `trip()` endpoint supports both id types.
For `db` profile, cancelled trips will not be contained in the response! For the `db` and `dbnav` profile, only the most important remarks will be contained in the boards. For `db` profile, cancelled trips will not be contained in the response!
```js ```js
import {createClient} from 'db-vendo-client' import {createClient} from 'db-vendo-client'

View file

@ -1,6 +1,6 @@
# `stop(id, [opt])` # `stop(id, [opt])`
This endpoint is not available with `dbweb` profile. This endpoint is only available with `dbnav` profile.
`id` must be in one of these formats: `id` must be in one of these formats:

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "db-vendo-client", "name": "db-vendo-client",
"version": "6.4.0", "version": "6.3.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "db-vendo-client", "name": "db-vendo-client",
"version": "6.4.0", "version": "6.3.4",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@derhuerst/round-robin-scheduler": "^1.0.4", "@derhuerst/round-robin-scheduler": "^1.0.4",

View file

@ -1,7 +1,7 @@
{ {
"name": "db-vendo-client", "name": "db-vendo-client",
"description": "Client for bahn.de public transport APIs.", "description": "Client for bahn.de public transport APIs.",
"version": "6.4.0", "version": "6.3.4",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"files": [ "files": [

View file

@ -5,7 +5,7 @@
![ISC-licensed](https://img.shields.io/github/license/public-transport/db-vendo-client.svg) ![ISC-licensed](https://img.shields.io/github/license/public-transport/db-vendo-client.svg)
[![support Jannis via GitHub Sponsors](https://img.shields.io/badge/support%20Jannis-donate-fa7664.svg)](https://github.com/sponsors/derhuerst) [![support Jannis via GitHub Sponsors](https://img.shields.io/badge/support%20Jannis-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)
This is an early version. What works: This is a very early version. What works:
* `journeys()`, `refreshJourney()` including tickets * `journeys()`, `refreshJourney()` including tickets
* `locations()`, `nearby()`, * `locations()`, `nearby()`,
@ -16,27 +16,25 @@ What doesn't work (yet, see TODO's scattered around the code):
* `journeys()` details like scheduledDays, stop/station groups, some line details ... * `journeys()` details like scheduledDays, stop/station groups, some line details ...
* loadFactor and other details in boards * loadFactor and other details in boards
* certain stop details like products for `locations()` and geopositions and remarks for boards this can be remedied with `enrichStations` in the config (turned on by default), enriching location info with [db-hafas-stations](https://github.com/derhuerst/db-hafas-stations). * certain stop details like products for `locations()` and geopositions and remarks for boards this can be remedied by turning on `enrichStations` in the config, enriching location info with [db-hafas-stations](https://github.com/derhuerst/db-hafas-stations).
* some query options/filters (e.g. routingMode for journeys, direction for boards) * some query options/filters (e.g. routingMode for journeys, direction for boards)
* all other endpoints (`tripsByName()`, `radar()`, `journeysFromTrip()`, `reachableFrom()`, `remarks()`, `lines()`, `station()`) * all other endpoints (`tripsByName()`, `radar()`, `journeysFromTrip()`, `reachableFrom()`, `remarks()`, `lines()`, `station()`)
Depending on the configured profile, db-vendo-client will use multiple different DB APIs that offer varying functionality, so choose wisely: Depending on the configured profile, db-vendo-client will use multiple different DB APIs that offer varying functionality, so choose wisely:
| | `db` Profile | `dbnav` Profile | `dbweb` Profile | | `db` Profile | `dbnav` Profile |
| ------------- | ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- |
| no API key required | ✅ | ✅ | ✅ | | no API key required | ✅ | ✅ |
| max duration boards | 12h | 1h | 1h | | max duration boards | 12h | 1h |
| remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys | | remarks | not for boards | only limited remarks for boards (still no `remarks()` endpoint) |
| cancelled trips | contained with cancelled flag in journeys, not contained in boards | contained with cancelled flag | contained with cancelled flag | | cancelled trips | contained with cancelled flag in journeys, not contained in boards | contained with cancelled flag |
| tickets | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | | tickets | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines |
| polylines | only for `refreshJourney()` (mutually exclusive with tickets) and for `trip()` (only for HAFAS trip ids) | only for `refreshJourney()/trip()`, mutually exclusive with tickets | only for `refreshJourney()/trip()`, mutually exclusive with tickets | | polylines | only for `refreshJourney()` (mutually exclusive with tickets) and for `trip()` (only for HAFAS trip ids) | only for `refreshJourney()/trip()`, mutually exclusive with tickets |
| trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids | HAFAS trip ids | | trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids |
| line.id/fahrtNr used | actual fahrtNr | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id | | line.id/fahrtNr used | unreliable/route id for journeys/`trip()`, actual fahrtNr for boards | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` |
| adminCode/operator | ✅ | only for journeys | only operator | | adminCode/operator | adminCode only for boards | only for journeys |
| stopovers | not in boards | not in boards | ✅ | | `stop()` | ❌ | ✅ |
| `stop()` | ✅ | ✅ | ❌ | | assumed backend API stability | less stable | more stable |
| assumed backend API stability | less stable | more stable | less stable |
| quotas | 60 requests per minute for journeys, unknown for boards (IPv4) | 60 requests per minute (IPv4) | ? (IPv6) |
Feel free to report anything that you stumble upon via Issues or create a PR :) Feel free to report anything that you stumble upon via Issues or create a PR :)
@ -46,7 +44,7 @@ Also consult the **[documentation](docs/readme.md)**.
After DB has switched to the new "vendo"/"movas" platform for bahn.de and DB Navigator, the old [HAFAS](https://de.wikipedia.org/wiki/HAFAS) API (see [hafas-client](https://github.com/public-transport/hafas-client/)) seems now to have been shut off. This project aims to enable easy switching to the new APIs. However, not all information will be available from the new APIs. After DB has switched to the new "vendo"/"movas" platform for bahn.de and DB Navigator, the old [HAFAS](https://de.wikipedia.org/wiki/HAFAS) API (see [hafas-client](https://github.com/public-transport/hafas-client/)) seems now to have been shut off. This project aims to enable easy switching to the new APIs. However, not all information will be available from the new APIs.
Actually, db-vendo-client is a wrapper around multiple different APIs, currently the bahn.de API for `dbweb`, the DB Navigator API for the `dbnav` profile, and a combination of the DB Navigator API and the regio-guide RIS API for the `db` profile. See some [notes about the various new APIs at DB](docs/db-apis.md). Actually, db-vendo-client is a wrapper around multiple different APIs, currently the bahn.de API for route planning and the regio-guide RIS API for boards for the `db` profile and the DB Navigator API for the `dbnav` profile. See some [notes about the various new APIs at DB](docs/db-apis.md).
Strictly speaking, permission is necessary to use this library with the DB APIs. Strictly speaking, permission is necessary to use this library with the DB APIs.