departures()/arrivals(): document opt.products 📝

closes #212

[ci skip]
This commit is contained in:
Jannis R 2021-02-10 21:29:04 +01:00
parent 78bbf9b66c
commit 92f1831c72
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -23,7 +23,6 @@ With `opt`, you can override the default options, which look like this:
```js ```js
{ {
// todo: products
when: new Date(), when: new Date(),
direction: null, // only show departures heading to this station direction: null, // only show departures heading to this station
line: null, // filter by line ID line: null, // filter by line ID
@ -41,6 +40,17 @@ With `opt`, you can override the default options, which look like this:
} }
``` ```
If you pass an object `opt.products`, its fields will partially override the default products defined in the profile. An example with the [BVG profile](../p/bvg):
```js
const createClient = require('hafas-client')
const vbbProfile = require('hafas-client/p/vbb')
const client = createClient(vbbProfile, 'my-awesome-program')
// will query with these products: suburban, subway, bus, express, regional
client.departures('900000024101', {products: {tram: false, ferry: false}})
```
## Response ## Response
*Note:* As stated in the [*Friendly Public Transport Format* `1.2.0`](https://github.com/public-transport/friendly-public-transport-format/tree/1.2.0), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule. *Note:* As stated in the [*Friendly Public Transport Format* `1.2.0`](https://github.com/public-transport/friendly-public-transport-format/tree/1.2.0), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule.