db: support for polylines

This commit is contained in:
Traines 2025-01-14 21:12:23 +00:00
parent 2b55f7148f
commit 911a6d371e
3 changed files with 29 additions and 17 deletions

View file

@ -1,6 +1,7 @@
{ {
"journeysEndpoint": "https://int.bahn.de/web/api/angebote/fahrplan", "journeysEndpoint": "https://int.bahn.de/web/api/angebote/fahrplan",
"refreshJourneysEndpoint": "https://int.bahn.de/web/api/angebote/recon", "refreshJourneysEndpointTickets": "https://int.bahn.de/web/api/angebote/recon",
"refreshJourneysEndpointPolyline": "https://int.bahn.de/web/api/reiseloesung/verbindung",
"locationsEndpoint": "https://int.bahn.de/web/api/reiseloesung/orte", "locationsEndpoint": "https://int.bahn.de/web/api/reiseloesung/orte",
"nearbyEndpoint": "https://int.bahn.de/web/api/reiseloesung/orte/nearby", "nearbyEndpoint": "https://int.bahn.de/web/api/reiseloesung/orte/nearby",
"tripEndpoint": "https://int.bahn.de/web/api/reiseloesung/fahrt", "tripEndpoint": "https://int.bahn.de/web/api/reiseloesung/fahrt",

View file

@ -44,7 +44,8 @@ const formatJourneysReq = (ctx, from, to, when, outFrwd, journeysRef) => {
}; };
// TODO poly conditional other endpoint // TODO poly conditional other endpoint
const formatRefreshJourneyReq = (ctx, refreshToken) => { const formatRefreshJourneyReq = (ctx, refreshToken) => {
const {profile} = ctx; const {profile, opt} = ctx;
if (opt.tickets) {
let query = { let query = {
ctxRecon: refreshToken, ctxRecon: refreshToken,
deutschlandTicketVorhanden: false, deutschlandTicketVorhanden: false,
@ -53,10 +54,20 @@ const formatRefreshJourneyReq = (ctx, refreshToken) => {
}; };
query = Object.assign(query, profile.formatTravellers(ctx)); query = Object.assign(query, profile.formatTravellers(ctx));
return { return {
endpoint: profile.refreshJourneysEndpoint, endpoint: profile.refreshJourneysEndpointTickets,
body: query, body: query,
method: 'post', method: 'post',
}; };
} else {
return {
endpoint: profile.refreshJourneysEndpointPolyline,
body: {
ctxRecon: refreshToken,
poly: true,
},
method: 'post',
};
}
}; };
export { export {

View file

@ -8,7 +8,7 @@
This is a very early version. What works: This is a very early version. What works:
* `journeys()`, `refreshJourney()` including tickets * `journeys()`, `refreshJourney()` including tickets
* `locations()`, `nearby()` * `locations()`, `nearby()`, `stop()`
* `departures()`, `arrivals()` boards * `departures()`, `arrivals()` boards
* `trip()` * `trip()`
@ -28,8 +28,8 @@ Depending on the configured profile, db-vendo-client will use multiple different
| max duration boards | 12h | 1h | | max duration boards | 12h | 1h |
| remarks | not for boards | ✅ (still no `remarks()` endpoint) | | remarks | not for boards | ✅ (still no `remarks()` endpoint) |
| cancelled trips | not contained in boards | contained with cancelled flag | | cancelled trips | not contained in boards | contained with cancelled flag |
| tickets | only for `refreshJourney()` | 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 `trip()` | 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 | | trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) | HAFAS trip ids |
| 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()` | | 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 | adminCode only for boards | only for journeys | | adminCode/operator | adminCode only for boards | only for journeys |