mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
docs
Some checks failed
test / lint-and-spellcheck (push) Has been cancelled
test / unit-tests (18.x) (push) Has been cancelled
test / unit-tests (20.x) (push) Has been cancelled
test / unit-tests (22.x) (push) Has been cancelled
test / integration-tests (18.x) (push) Has been cancelled
test / integration-tests (20.x) (push) Has been cancelled
test / integration-tests (22.x) (push) Has been cancelled
test / e2e-tests (18.x) (push) Has been cancelled
Some checks failed
test / lint-and-spellcheck (push) Has been cancelled
test / unit-tests (18.x) (push) Has been cancelled
test / unit-tests (20.x) (push) Has been cancelled
test / unit-tests (22.x) (push) Has been cancelled
test / integration-tests (18.x) (push) Has been cancelled
test / integration-tests (20.x) (push) Has been cancelled
test / integration-tests (22.x) (push) Has been cancelled
test / e2e-tests (18.x) (push) Has been cancelled
This commit is contained in:
parent
29aab87cdf
commit
c4d0a55d41
5 changed files with 28 additions and 23 deletions
|
@ -36,10 +36,11 @@ With `opt`, you can override the default options, which look like this:
|
||||||
// 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,
|
includeRelatedStations: true,
|
||||||
|
moreStops: null // also include departures/arrivals for array of up to nine additional station evaNumbers (not supported with dbnav and dbweb)
|
||||||
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 depends on the profile (see main readme), e.g. 720 for `db` and 60 for `dbnav`. In order to use the `dbris` profile, you need to pass the env vars `DB_API_KEY` and `DB_CLIENT_ID`.
|
||||||
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
|
||||||
|
|
|
@ -82,7 +82,7 @@ const mapRouteParsers = (route, parsers) => {
|
||||||
return {
|
return {
|
||||||
...parsers,
|
...parsers,
|
||||||
moreStops: {
|
moreStops: {
|
||||||
description: 'Also include departures/arrivals for up to nine comma-separated station evaNumbers',
|
description: 'Also include departures/arrivals for up to nine comma-separated station evaNumbers (not supported with dbnav and dbweb)',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '',
|
default: '',
|
||||||
parse: parseArrayOfStrings,
|
parse: parseArrayOfStrings,
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "db-vendo-client",
|
"name": "db-vendo-client",
|
||||||
"version": "6.7.1",
|
"version": "6.8.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "db-vendo-client",
|
"name": "db-vendo-client",
|
||||||
"version": "6.7.1",
|
"version": "6.8.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^1.0.5",
|
||||||
|
|
|
@ -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.7.1",
|
"version": "6.8.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|
38
readme.md
38
readme.md
|
@ -6,7 +6,7 @@
|
||||||

|

|
||||||
[](https://github.com/sponsors/derhuerst)
|
[](https://github.com/sponsors/derhuerst)
|
||||||
|
|
||||||
This is an early version. What works:
|
The following [FPTF](https://github.com/public-transport/friendly-public-transport-format)/[hafas-client](https://github.com/public-transport/hafas-client/) endpoints are supported (depending on the chosen profile, see below):
|
||||||
|
|
||||||
* `journeys()`, `refreshJourney()` including tickets and bestprice option
|
* `journeys()`, `refreshJourney()` including tickets and bestprice option
|
||||||
* `locations()`, `nearby()`,
|
* `locations()`, `nearby()`,
|
||||||
|
@ -23,21 +23,25 @@ What doesn't work:
|
||||||
|
|
||||||
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
|
| Profile | `db` | `dbnav` | `dbweb` | `dbbahnhof` | `dbris` |
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- |
|
||||||
| no API key required | ✅ | ✅ | ✅ |
|
| no API key required | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||||||
| duration for boards | up to 12h | always 1h | always 1h |
|
| all above endpoints supported | ✅ | ✅ | except `stop()` | only boards | only boards |
|
||||||
| remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys |
|
| duration for boards | up to 12h | always 1h | always 1h | up to 6h, only from current time | up to 12h |
|
||||||
| cancelled trips | contained with cancelled flag in journeys, not contained in boards | contained with cancelled flag | contained with cancelled flag |
|
| remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys | most remarks | all remarks |
|
||||||
| tickets | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines |
|
| cancelled trips | contained with cancelled flag in journeys, not contained in boards | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag |
|
||||||
| 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 |
|
| tickets | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | only for `refreshJourney()`, mutually exclusive with polylines | ❌ | ❌ |
|
||||||
| trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids | HAFAS trip ids |
|
| 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 | ❌ | ❌ |
|
||||||
| line.id/fahrtNr used | actual fahrtNr | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id |
|
| trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids | HAFAS trip ids | RIS trip ids | RIS trip ids |
|
||||||
| adminCode/operator | ✅ | only for journeys | only operator |
|
| line.id/fahrtNr used | actual fahrtNr | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id | unreliable/route id | ✅ |
|
||||||
| stopovers | not in boards | not in boards | ✅ |
|
| adminCode/operator | ✅ | only for journeys | only operator | only adminCode | ✅ |
|
||||||
| `stop()` | ✅ | ✅ | ❌ |
|
| stopovers | not in boards | not in boards | ✅ | some | ✅ |
|
||||||
| assumed backend API stability | less stable | more stable | less stable |
|
| assumed backend API stability | less stable | more stable | less stable | less stable | more stable |
|
||||||
| quotas | 60 requests per minute for journeys, unknown for boards (IPv4) | 60 requests per minute (IPv4) | ? (IPv6) |
|
| quotas | 60 requests per minute for journeys, unknown for boards (IPv4) | 60 requests per minute (IPv4) | aggressive blocking (IPv4/IPv6) | ? | depends on API key |
|
||||||
|
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> If you think that for your project, quotas may become an issue, [consider alternative ways to obtain the data you need.](https://github.com/derhuerst/db-rest/blob/6/docs/readme.md#why-not-to-use-this-api).
|
||||||
|
|
||||||
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 :)
|
||||||
|
|
||||||
|
@ -81,7 +85,7 @@ There are [community-maintained TypeScript typings available as `@types/hafas-cl
|
||||||
|
|
||||||
`db-vendo-client` is mostly browser compatible, however none of the endpoints enables CORS, so it is impossible to use `db-vendo-client` in normal browser environments. It was tested with vite + capacitorjs and should also work with cordova or react native and similar projects.
|
`db-vendo-client` is mostly browser compatible, however none of the endpoints enables CORS, so it is impossible to use `db-vendo-client` in normal browser environments. It was tested with vite + capacitorjs and should also work with cordova or react native and similar projects.
|
||||||
|
|
||||||
**Limitations:** Does not work with `enrichStations` option enabled.
|
**Limitations:** Does not work with `enrichStations` option enabled or with the `dbris` profile.
|
||||||
|
|
||||||
## Related Projects
|
## Related Projects
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue