mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
db: support for polylines
This commit is contained in:
parent
2b55f7148f
commit
911a6d371e
3 changed files with 29 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"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",
|
||||
"nearbyEndpoint": "https://int.bahn.de/web/api/reiseloesung/orte/nearby",
|
||||
"tripEndpoint": "https://int.bahn.de/web/api/reiseloesung/fahrt",
|
||||
|
|
|
@ -44,19 +44,30 @@ const formatJourneysReq = (ctx, from, to, when, outFrwd, journeysRef) => {
|
|||
};
|
||||
// TODO poly conditional other endpoint
|
||||
const formatRefreshJourneyReq = (ctx, refreshToken) => {
|
||||
const {profile} = ctx;
|
||||
let query = {
|
||||
ctxRecon: refreshToken,
|
||||
deutschlandTicketVorhanden: false,
|
||||
nurDeutschlandTicketVerbindungen: false,
|
||||
reservierungsKontingenteVorhanden: false,
|
||||
};
|
||||
query = Object.assign(query, profile.formatTravellers(ctx));
|
||||
return {
|
||||
endpoint: profile.refreshJourneysEndpoint,
|
||||
body: query,
|
||||
method: 'post',
|
||||
};
|
||||
const {profile, opt} = ctx;
|
||||
if (opt.tickets) {
|
||||
let query = {
|
||||
ctxRecon: refreshToken,
|
||||
deutschlandTicketVorhanden: false,
|
||||
nurDeutschlandTicketVerbindungen: false,
|
||||
reservierungsKontingenteVorhanden: false,
|
||||
};
|
||||
query = Object.assign(query, profile.formatTravellers(ctx));
|
||||
return {
|
||||
endpoint: profile.refreshJourneysEndpointTickets,
|
||||
body: query,
|
||||
method: 'post',
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
endpoint: profile.refreshJourneysEndpointPolyline,
|
||||
body: {
|
||||
ctxRecon: refreshToken,
|
||||
poly: true,
|
||||
},
|
||||
method: 'post',
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
This is a very early version. What works:
|
||||
|
||||
* `journeys()`, `refreshJourney()` including tickets
|
||||
* `locations()`, `nearby()`
|
||||
* `locations()`, `nearby()`, `stop()`
|
||||
* `departures()`, `arrivals()` boards
|
||||
* `trip()`
|
||||
|
||||
|
@ -28,8 +28,8 @@ Depending on the configured profile, db-vendo-client will use multiple different
|
|||
| max duration boards | 12h | 1h |
|
||||
| remarks | not for boards | ✅ (still no `remarks()` endpoint) |
|
||||
| cancelled trips | not contained in boards | contained with cancelled flag |
|
||||
| tickets | only for `refreshJourney()` | only for `refreshJourney()`, mutually exclusive with polylines |
|
||||
| polylines | only for `trip()` | only for `refreshJourney()/trip()`, mutually exclusive with tickets |
|
||||
| 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 |
|
||||
| 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()` |
|
||||
| adminCode/operator | adminCode only for boards | only for journeys |
|
||||
|
|
Loading…
Add table
Reference in a new issue