Stopovers (departures and arrivals) at a given station (or optionally other location).
FPTF@1 station
object or id
. Modules might optionally also accept other FPTF object types like location
or stop
, however only stopovers at station
s will be supported by every module.
Required
options are supported by every module. For non-required
options, the main FPTI principle still applies: If a certain feature/option is available, it must be provided as described below.
Note that modules might provide additional options as long as they don't use reserved option attributes.
Attribute | Description | Required | Value type | Default |
---|---|---|---|---|
when |
Stopover date, synonym to departureAfter |
✅ | Date |
new Date() |
results |
Max. number of results returned | ✅ | Number |
null |
interval |
Results for how many minutes after when |
✅ | Number |
null |
departureAfter |
List stopovers with a departure after this date, mutually exclusive with arrivalBefore |
✅ | Date |
new Date() |
arrivalBefore |
List stopovers with an arrival before this date, mutually exclusive with departureAfter |
❌ | Date |
null |
direction |
Only show departures heading to this station | ❌ | station object or id * |
null |
*Or other FPTF types, if the module supports it..
The features
object would look like this for a module which only supports the required options:
{
when: 'Stopover date, synonym to `departureAfter`',
results: 'Max. number of results returned',
interval: 'Results for how many minutes after `when`',
departureAfter: 'List stopovers with a departure after this date'
// additionalOption: 'description of this option'
}
Returns a Promise
that resolves in an Array
of stopover
FPTF@1 objects.
const module = require('fpti-module')
const station = {
type: 'station',
id: '123456'
}
const otherStation = '234567' // station id
const stopovers = module.stopovers(station)
const stopoversWithOptions = module.stopovers(otherStation, {
when: new Date('2019-03-01T12:00+01:00'),
interval: 6*60, // 6 hours
direction: {type: 'station', id: '345678'}
})
stopovers.then(data => {
// data is an array of FPTF stopover objects
console.log(data)
})
console.log(module.stopovers.features) // all options