mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
add journeysOutFrwd profile flag
This commit is contained in:
parent
00b184df36
commit
ed0c606db1
3 changed files with 6 additions and 1 deletions
5
index.js
5
index.js
|
@ -164,6 +164,9 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
when = new Date(opt.departure)
|
when = new Date(opt.departure)
|
||||||
if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid')
|
if (Number.isNaN(+when)) throw new TypeError('opt.departure is invalid')
|
||||||
} else if (opt.arrival !== undefined && opt.arrival !== null) {
|
} else if (opt.arrival !== undefined && opt.arrival !== null) {
|
||||||
|
if (!profile.journeysOutFrwd) {
|
||||||
|
throw new Error('opt.arrival is unsupported')
|
||||||
|
}
|
||||||
when = new Date(opt.arrival)
|
when = new Date(opt.arrival)
|
||||||
if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid')
|
if (Number.isNaN(+when)) throw new TypeError('opt.arrival is invalid')
|
||||||
outFrwd = false
|
outFrwd = false
|
||||||
|
@ -201,7 +204,6 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
arrLocL: [to],
|
arrLocL: [to],
|
||||||
jnyFltrL: filters,
|
jnyFltrL: filters,
|
||||||
getTariff: !!opt.tickets,
|
getTariff: !!opt.tickets,
|
||||||
outFrwd,
|
|
||||||
// todo: this is actually "take additional stations nearby the given start and destination station into account"
|
// todo: this is actually "take additional stations nearby the given start and destination station into account"
|
||||||
// see rest.exe docs
|
// see rest.exe docs
|
||||||
ushrp: !!opt.startWithWalking,
|
ushrp: !!opt.startWithWalking,
|
||||||
|
@ -212,6 +214,7 @@ const createClient = (profile, userAgent, request = _request) => {
|
||||||
getPolyline: !!opt.polylines
|
getPolyline: !!opt.polylines
|
||||||
}
|
}
|
||||||
if (profile.journeysNumF) query.numF = opt.results
|
if (profile.journeysNumF) query.numF = opt.results
|
||||||
|
if (profile.journeysOutFrwd) query.outFrwd = outFrwd
|
||||||
|
|
||||||
return request(profile, userAgent, opt, {
|
return request(profile, userAgent, opt, {
|
||||||
cfg: {polyEnc: 'GPA'},
|
cfg: {polyEnc: 'GPA'},
|
||||||
|
|
|
@ -66,6 +66,7 @@ const defaultProfile = {
|
||||||
filters,
|
filters,
|
||||||
|
|
||||||
journeysNumF: true, // `journeys()` method: support for `numF` field?
|
journeysNumF: true, // `journeys()` method: support for `numF` field?
|
||||||
|
journeysOutFrwd: true, // `journeys()` method: support for `outFrwd` field?
|
||||||
departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field?
|
departuresGetPasslist: true, // `departures()` method: support for `getPasslist` field?
|
||||||
departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field?
|
departuresStbFltrEquiv: true, // `departures()` method: support for `stbFltrEquiv` field?
|
||||||
trip: false,
|
trip: false,
|
||||||
|
|
|
@ -95,6 +95,7 @@ const dbBusradarNrwProfile = {
|
||||||
|
|
||||||
products: products,
|
products: products,
|
||||||
|
|
||||||
|
journeysOutFrwd: false,
|
||||||
trip: true,
|
trip: true,
|
||||||
radar: true
|
radar: true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue