mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
add subStops & entrances options
This commit is contained in:
parent
d98910a651
commit
07c77f8cf9
10 changed files with 39 additions and 3 deletions
|
@ -28,6 +28,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
direction: null, // only show departures heading to this station
|
direction: null, // only show departures heading to this station
|
||||||
duration: 10, // show departures for the next n minutes
|
duration: 10, // show departures for the next n minutes
|
||||||
results: null, // max. number of results; `null` means "whatever HAFAS wants"
|
results: null, // max. number of results; `null` means "whatever HAFAS wants"
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
linesOfStops: false, // parse & expose lines at the stop/station?
|
linesOfStops: false, // parse & expose lines at the stop/station?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
stopovers: false, // fetch & parse previous/next stopovers?
|
stopovers: false, // fetch & parse previous/next stopovers?
|
||||||
|
|
|
@ -70,6 +70,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
},
|
},
|
||||||
tickets: false, // return tickets? only available with some profiles
|
tickets: false, // return tickets? only available with some profiles
|
||||||
polylines: false, // return a shape for each leg?
|
polylines: false, // return a shape for each leg?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
scheduledDays: false, // parse which days each journey is valid on
|
scheduledDays: false, // parse which days each journey is valid on
|
||||||
language: 'en', // language to get results in
|
language: 'en', // language to get results in
|
||||||
|
|
|
@ -11,6 +11,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
, stops: true // return stops/stations?
|
, stops: true // return stops/stations?
|
||||||
, addresses: true
|
, addresses: true
|
||||||
, poi: true // points of interest
|
, poi: true // points of interest
|
||||||
|
, subStops: true // parse & expose sub-stops of stations?
|
||||||
|
, entrances: true // parse & expose entrances of stops/stations?
|
||||||
, linesOfStops: false // parse & expose lines at each stop/station?
|
, linesOfStops: false // parse & expose lines at each stop/station?
|
||||||
, language: 'en' // language to get results in
|
, language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
distance: null, // maximum walking distance in meters
|
distance: null, // maximum walking distance in meters
|
||||||
poi: false, // return points of interest?
|
poi: false, // return points of interest?
|
||||||
stops: true, // return stops/stations?
|
stops: true, // return stops/stations?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
linesOfStops: false, // parse & expose lines at each stop/station?
|
linesOfStops: false, // parse & expose lines at each stop/station?
|
||||||
language: 'en' // language to get results in
|
language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
duration: 30, // compute frames for the next n seconds
|
duration: 30, // compute frames for the next n seconds
|
||||||
frames: 3, // nr of frames to compute
|
frames: 3, // nr of frames to compute
|
||||||
polylines: true, // return a track shape for each vehicle?
|
polylines: true, // return a track shape for each vehicle?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
language: 'en' // language to get results in
|
language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -18,7 +18,9 @@ With `opt`, you can override the default options, which look like this:
|
||||||
suburban: true,
|
suburban: true,
|
||||||
subway: true
|
subway: true
|
||||||
// …
|
// …
|
||||||
}
|
},
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
stopovers: false, // return stations on the way?
|
stopovers: false, // return stations on the way?
|
||||||
polylines: false, // return a shape for each leg?
|
polylines: false, // return a shape for each leg?
|
||||||
tickets: false, // return tickets? only available with some profiles
|
tickets: false, // return tickets? only available with some profiles
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
language: 'en' // language to get results in
|
language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
linesOfStops: false, // parse & expose lines at the stop/station?
|
linesOfStops: false, // parse & expose lines at the stop/station?
|
||||||
language: 'en' // language to get results in
|
language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ With `opt`, you can override the default options, which look like this:
|
||||||
{
|
{
|
||||||
stopovers: true, // return stations on the way?
|
stopovers: true, // return stations on the way?
|
||||||
polyline: false, // return a shape for the trip?
|
polyline: false, // return a shape for the trip?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
language: 'en' // language to get results in
|
language: 'en' // language to get results in
|
||||||
}
|
}
|
||||||
|
|
22
index.js
22
index.js
|
@ -53,6 +53,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
direction: null, // only show departures stopping by this station
|
direction: null, // only show departures stopping by this station
|
||||||
duration: 10, // show departures for the next n minutes
|
duration: 10, // show departures for the next n minutes
|
||||||
results: null, // max. number of results; `null` means "whatever HAFAS wants"
|
results: null, // max. number of results; `null` means "whatever HAFAS wants"
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
linesOfStops: false, // parse & expose lines at the stop/station?
|
linesOfStops: false, // parse & expose lines at the stop/station?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
stopovers: false, // fetch & parse previous/next stopovers?
|
stopovers: false, // fetch & parse previous/next stopovers?
|
||||||
|
@ -126,6 +128,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
startWithWalking: true,
|
startWithWalking: true,
|
||||||
tickets: false, // return tickets?
|
tickets: false, // return tickets?
|
||||||
polylines: false, // return leg shapes?
|
polylines: false, // return leg shapes?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
scheduledDays: false
|
scheduledDays: false
|
||||||
}, opt)
|
}, opt)
|
||||||
|
@ -249,6 +253,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
stopovers: false, // return stations on the way?
|
stopovers: false, // return stations on the way?
|
||||||
tickets: false, // return tickets?
|
tickets: false, // return tickets?
|
||||||
polylines: false, // return leg shapes?
|
polylines: false, // return leg shapes?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true // parse & expose hints & warnings?
|
remarks: true // parse & expose hints & warnings?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
|
@ -279,6 +285,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
stops: true, // return stops/stations?
|
stops: true, // return stops/stations?
|
||||||
addresses: true,
|
addresses: true,
|
||||||
poi: true, // points of interest
|
poi: true, // points of interest
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
linesOfStops: false // parse & expose lines at each stop/station?
|
linesOfStops: false // parse & expose lines at each stop/station?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
|
@ -300,6 +308,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
|
|
||||||
opt = Object.assign({
|
opt = Object.assign({
|
||||||
linesOfStops: false, // parse & expose lines at the stop/station?
|
linesOfStops: false, // parse & expose lines at the stop/station?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true, // parse & expose hints & warnings?
|
remarks: true, // parse & expose hints & warnings?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
|
@ -331,6 +341,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
distance: null, // maximum walking distance in meters
|
distance: null, // maximum walking distance in meters
|
||||||
poi: false, // return points of interest?
|
poi: false, // return points of interest?
|
||||||
stops: true, // return stops/stations?
|
stops: true, // return stops/stations?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
linesOfStops: false // parse & expose lines at each stop/station?
|
linesOfStops: false // parse & expose lines at each stop/station?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
|
@ -355,6 +367,8 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
opt = Object.assign({
|
opt = Object.assign({
|
||||||
stopovers: true, // return stations on the way?
|
stopovers: true, // return stations on the way?
|
||||||
polyline: false, // return a track shape?
|
polyline: false, // return a track shape?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
remarks: true // parse & expose hints & warnings?
|
remarks: true // parse & expose hints & warnings?
|
||||||
}, opt)
|
}, opt)
|
||||||
|
|
||||||
|
@ -391,7 +405,9 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
// todo: what happens with `frames: 0`?
|
// todo: what happens with `frames: 0`?
|
||||||
frames: 3, // nr of frames to compute
|
frames: 3, // nr of frames to compute
|
||||||
products: null, // optionally an object of booleans
|
products: null, // optionally an object of booleans
|
||||||
polylines: true // return a track shape for each vehicle?
|
polylines: true, // return a track shape for each vehicle?
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
}, opt || {})
|
}, opt || {})
|
||||||
opt.when = new Date(opt.when || Date.now())
|
opt.when = new Date(opt.when || Date.now())
|
||||||
if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
|
if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
|
||||||
|
@ -414,7 +430,9 @@ const createClient = (profile, userAgent, opt = {}) => {
|
||||||
when: Date.now(),
|
when: Date.now(),
|
||||||
maxTransfers: 5, // maximum of 5 transfers
|
maxTransfers: 5, // maximum of 5 transfers
|
||||||
maxDuration: 20, // maximum travel duration in minutes, pass `null` for infinite
|
maxDuration: 20, // maximum travel duration in minutes, pass `null` for infinite
|
||||||
products: {}
|
products: {},
|
||||||
|
subStops: true, // parse & expose sub-stops of stations?
|
||||||
|
entrances: true, // parse & expose entrances of stops/stations?
|
||||||
}, opt)
|
}, opt)
|
||||||
if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
|
if (Number.isNaN(+opt.when)) throw new TypeError('opt.when is invalid')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue