mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-09-17 19:49:23 +03:00
switch db profile to db nav for boards (regioguide deprecation)
This commit is contained in:
parent
d15369406d
commit
8e9d6ea67a
8 changed files with 25 additions and 30 deletions
|
@ -634,7 +634,9 @@
|
|||
"dbbahnhof",
|
||||
"Deutschlandticket",
|
||||
"fahrverguenstigungen",
|
||||
"cancelation"
|
||||
"cancelation",
|
||||
"MOTIS",
|
||||
"motis"
|
||||
],
|
||||
"ignorePaths": [
|
||||
"docs/dumps/**",
|
||||
|
|
|
@ -26,12 +26,11 @@ const {nearbyEndpoint} = dbnavBase;
|
|||
|
||||
// trip()
|
||||
import {formatTripReq} from './trip-req.js';
|
||||
const tripEndpoint_dbnav = dbnavBase.tripEndpoint;
|
||||
const tripEndpoint_dbregioguide = dbregioguideBase.tripEndpoint;
|
||||
const {tripEndpoint} = dbnavBase;
|
||||
|
||||
// arrivals(), departures()
|
||||
import {formatStationBoardReq} from '../dbregioguide/station-board-req.js';
|
||||
const {boardEndpoint} = dbregioguideBase;
|
||||
import {formatStationBoardReq} from '../dbnav/station-board-req.js';
|
||||
const {boardEndpoint} = dbnavBase;
|
||||
|
||||
const profile = {
|
||||
locale: 'de-DE',
|
||||
|
@ -55,7 +54,7 @@ const profile = {
|
|||
nearbyEndpoint,
|
||||
|
||||
formatTripReq,
|
||||
tripEndpoint_dbnav, tripEndpoint_dbregioguide,
|
||||
tripEndpoint,
|
||||
|
||||
formatStationBoardReq,
|
||||
boardEndpoint,
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
import {formatTripReq as hafasFormatTripReq} from '../dbnav/trip-req.js';
|
||||
import {formatTripReq as risTripReq} from '../dbregioguide/trip-req.js';
|
||||
|
||||
|
||||
const formatTripReq = ({profile, opt}, id) => {
|
||||
const _profile = {...profile};
|
||||
if (id.includes('#')) {
|
||||
_profile['tripEndpoint'] = profile.tripEndpoint_dbnav;
|
||||
_profile['tripEndpoint'] = profile.tripEndpoint;
|
||||
return hafasFormatTripReq({profile: _profile, opt}, id);
|
||||
}
|
||||
|
||||
_profile['tripEndpoint'] = profile.tripEndpoint_dbregioguide;
|
||||
return risTripReq({profile: _profile, opt}, id);
|
||||
};
|
||||
|
||||
export {
|
||||
|
|
|
@ -15,7 +15,7 @@ const profile = {
|
|||
journeysOutFrwd: false,
|
||||
departuresGetPasslist: false,
|
||||
departuresStbFltrEquiv: true,
|
||||
trip: false,
|
||||
trip: true,
|
||||
radar: false,
|
||||
refreshJourney: false,
|
||||
journeysFromTrip: false,
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "db-vendo-client",
|
||||
"version": "6.9.0",
|
||||
"version": "6.10.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "db-vendo-client",
|
||||
"version": "6.9.0",
|
||||
"version": "6.10.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "db-vendo-client",
|
||||
"description": "Client for bahn.de public transport APIs.",
|
||||
"version": "6.9.0",
|
||||
"version": "6.10.0",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
|
|
19
readme.md
19
readme.md
|
@ -27,21 +27,21 @@ Depending on the configured profile, db-vendo-client will use multiple different
|
|||
| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- |
|
||||
| no API key required | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||||
| all above endpoints supported | ✅ | ✅ | except `stop()` | only boards | only boards |
|
||||
| duration for boards | up to 12h | always 1h | always 1h | up to 6h, only from current time | up to 12h |
|
||||
| remarks | not for boards | for boards only most important remarks | all remarks on boards and journeys | most remarks | all remarks |
|
||||
| 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 |
|
||||
| duration for boards | always 1h | always 1h | always 1h | up to 6h, only from current time | up to 12h |
|
||||
| remarks | for boards only most important remarks | for boards only most important remarks | all remarks on boards and journeys | most remarks | all remarks |
|
||||
| cancelled trips | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | contained with cancelled flag | 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 | ❌ | ❌ |
|
||||
| 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 | ❌ | ❌ |
|
||||
| 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 |
|
||||
| line.id/fahrtNr used | actual fahrtNr | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id | unreliable/route id | ✅ |
|
||||
| adminCode/operator | ✅ | only for journeys | only operator | only adminCode | ✅ |
|
||||
| polylines | only for `refreshJourney()/trip()`, mutually exclusive with tickets | only for `refreshJourney()/trip()`, mutually exclusive with tickets | only for `refreshJourney()/trip()`, mutually exclusive with tickets | ❌ | ❌ |
|
||||
| trip ids used | HAFAS trip ids | HAFAS trip ids | HAFAS trip ids | RIS trip ids | RIS trip ids |
|
||||
| line.id/fahrtNr used | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | actual fahrtNr for journeys, unreliable/route id for boards and `trip()` | unreliable/route id | unreliable/route id | ✅ |
|
||||
| adminCode/operator | only for journeys | only for journeys | only operator | only adminCode | ✅ |
|
||||
| stopovers | not in boards | not in boards | ✅ | some | ✅ |
|
||||
| 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) | aggressive blocking (IPv4/IPv6) | ? | depends on API key |
|
||||
| quotas | 60 requests per minute (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).
|
||||
> 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), e.g. [motis-fptf-client](https://github.com/motis-project/motis-fptf-client) (a drop-in replacement for db-vendo-client/hafas-client) in conjunction with https://transitous.org or a self-hosted [MOTIS](https://github.com/motis-project/motis) instance.
|
||||
|
||||
Feel free to report anything that you stumble upon via Issues or create a PR :)
|
||||
|
||||
|
@ -92,6 +92,7 @@ There are [community-maintained TypeScript typings available as `@types/hafas-cl
|
|||
- [hafas-client](https://github.com/public-transport/hafas-client/) – including further related projects
|
||||
- [hafas-rest-api](https://github.com/public-transport/hafas-rest-api/) – expose a hafas-client or db-vendo-client instance as a REST API
|
||||
- [db-rest](https://github.com/derhuerst/db-rest/) – for the legacy DB HAFAS endpoint
|
||||
- [motis-fptf-client](https://github.com/motis-project/motis-fptf-client) – a drop-in replacement for db-vendo-client/hafas-client wrapping a [MOTIS](https://github.com/motis-project/motis) instance
|
||||
- [`*.transport.rest`](https://transport.rest/) – Public APIs wrapping some HAFAS endpoints.
|
||||
|
||||
## Contributing
|
||||
|
|
|
@ -38,10 +38,10 @@ tap.test('db trip(): dynamic request formatting', (t) => {
|
|||
|
||||
const reqDbNav = profile.formatTripReq(ctx, tripIdHafas);
|
||||
delete reqDbNav.headers['X-Correlation-ID'];
|
||||
const reqDbRegioGuide = profile.formatTripReq(ctx, tripIdRis);
|
||||
//const reqDbRegioGuide = profile.formatTripReq(ctx, tripIdRis);
|
||||
|
||||
t.same(reqDbNav, reqDbNavExpected);
|
||||
t.same(reqDbRegioGuide, reqDbRegioGuideExpected);
|
||||
//t.same(reqDbRegioGuide, reqDbRegioGuideExpected);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue