add journeysOutFrwd profile flag

This commit is contained in:
Jannis R 2019-12-29 22:16:45 +01:00
parent 00b184df36
commit ed0c606db1
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
3 changed files with 6 additions and 1 deletions

View file

@ -164,6 +164,9 @@ const createClient = (profile, userAgent, request = _request) => {
when = new Date(opt.departure)
if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid')
} else if (opt.arrival !== undefined && opt.arrival !== null) {
if (!profile.journeysOutFrwd) {
throw new Error('opt.arrival is unsupported')
}
when = new Date(opt.arrival)
if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid')
outFrwd = false
@ -201,7 +204,6 @@ const createClient = (profile, userAgent, request = _request) => {
arrLocL: [to],
jnyFltrL: filters,
getTariff: !!opt.tickets,
outFrwd,
// todo: this is actually "take additional stations nearby the given start and destination station into account"
// see rest.exe docs
ushrp: !!opt.startWithWalking,
@ -212,6 +214,7 @@ const createClient = (profile, userAgent, request = _request) => {
getPolyline: !!opt.polylines
}
if (profile.journeysNumF) query.numF = opt.results
if (profile.journeysOutFrwd) query.outFrwd = outFrwd
return request(profile, userAgent, opt, {
cfg: {polyEnc: 'GPA'},

View file

@ -66,6 +66,7 @@ const defaultProfile = {
filters,
journeysNumF: true, // `journeys()` method: support for `numF` field?
journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field?
departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field?
departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field?
trip: false,

View file

@ -95,6 +95,7 @@ const dbBusradarNrwProfile = {
products: products,
journeysOutFrwd: false,
trip: true,
radar: true
}