mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
minimal profiles docs 📝
This commit is contained in:
parent
75513aa0f7
commit
c4f67e15d3
3 changed files with 17 additions and 2 deletions
|
@ -31,7 +31,7 @@ With `opt`, you can override the default options, which look like this:
|
||||||
|
|
||||||
## Response
|
## Response
|
||||||
|
|
||||||
*Note:* As stated in the [*Friendly Public Transport Format* `1.0.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.0.1), the `when` include 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.0.1`](https://github.com/public-transport/friendly-public-transport-format/tree/1.0.1), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule.
|
||||||
|
|
||||||
You may pass the `journeyId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey.
|
You may pass the `journeyId` field into [`journeyLeg(ref, lineName, [opt])`](journey-leg.md) to get details on the vehicle's journey.
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ The response may look like this:
|
||||||
} ]
|
} ]
|
||||||
```
|
```
|
||||||
|
|
||||||
If you pass `tickets: true`, each `journey` will have a tickets array that looks like this:
|
Some [profiles](../p) are able to parse the ticket information, if returned by the API. For example, if you pass `tickets: true` with the [VBB profile](../p/vbb), each `journey` will have a tickets array that looks like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
[ {
|
[ {
|
||||||
|
|
15
p/readme.md
Normal file
15
p/readme.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Profiles
|
||||||
|
|
||||||
|
This directory contains specific customisations for each endpoint, called *profiles*. They **parse data from the API differently, add additional information, or enable non-default methods** (such as [`journeyLeg`](../docs/journey-leg.md)) if they are supported.
|
||||||
|
|
||||||
|
Each profile has it's own directory. It will be passed into `hafas-client` and is expected to be in a certain structure:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const createClient = require('hafas-client')
|
||||||
|
const someProfile = require('hafas-client/p/some-profile')
|
||||||
|
|
||||||
|
// create a client with the profile
|
||||||
|
const client = createClient(dbProfile)
|
||||||
|
|
||||||
|
// use it to query data…
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue