mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
improve docs readability 📝
This commit is contained in:
parent
ef7bd42d15
commit
0165320808
4 changed files with 9 additions and 6 deletions
|
@ -334,7 +334,7 @@ departure of first (later) journey 2017-12-17T19:19:00+01:00
|
|||
|
||||
If you pass `polylines: true`, each journey leg will have a `polyline` field. Refer to [the section in the `trip()` docs](trip.md#polyline-option) for details.
|
||||
|
||||
If you pass `scheduledDays: true`, each journey will have a `scheduledDays` field looking like this:
|
||||
If you pass `scheduledDays: true`, each journey will have a `scheduledDays` object looking like this:
|
||||
|
||||
```js
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@ The response may look like this:
|
|||
latitude: 52.521508,
|
||||
longitude: 13.411267
|
||||
},
|
||||
|
||||
line: {
|
||||
type: 'line',
|
||||
id: 's9',
|
||||
|
@ -68,6 +69,7 @@ The response may look like this:
|
|||
},
|
||||
direction: 'S Flughafen Berlin-Schönefeld',
|
||||
trip: 31463,
|
||||
|
||||
nextStopovers: [ {
|
||||
stop: {
|
||||
type: 'stop',
|
||||
|
|
|
@ -55,6 +55,7 @@ The response looked like this:
|
|||
```js
|
||||
{
|
||||
id: '1|31431|28|86|17122017',
|
||||
|
||||
origin: {
|
||||
type: 'station',
|
||||
id: '900000260005',
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# Writing a profile
|
||||
|
||||
**Per HAFAS endpoint, `hafas-client` has an endpoint-specific customisation called *profile***, which may for example do the following:
|
||||
**Per HAFAS endpoint, `hafas-client` has an endpoint-specific customisation called *profile*.** A profile may, for example, do the following:
|
||||
|
||||
- handle the additional requirements of the endpoint (e.g. authentication),
|
||||
- extract additional information from the data provided by the endpoint,
|
||||
- guard against triggering bugs of certain endpoints (e.g. time limits).
|
||||
|
||||
This guide is about writing such a profile. If you just want to use an already supported endpoint, refer to the [API documentation](readme.md) instead.
|
||||
This guide is about writing such a profile. If you just want to use an already supported endpoint, refer to the [main readme](../readme.md) instead.
|
||||
|
||||
*Note*: **If you get stuck, ask for help by [creating an issue](https://github.com/public-transport/hafas-client/issues/new)!** We want to help people expand the scope of this library.
|
||||
*Note*: **If you get stuck, ask for help by [creating an issue](https://github.com/public-transport/hafas-client/issues/new)**; We're happy to help you expand the scope of this library!
|
||||
|
||||
## 0. How do the profiles work?
|
||||
|
||||
|
@ -21,7 +21,7 @@ A profile may consist of three things:
|
|||
- **flags indicating which features are supported by the endpoint** – e.g. `trip`
|
||||
- **methods overriding the [default profile](../lib/default-profile.js)**
|
||||
|
||||
As an example, let's say we have an [Austrian](https://en.wikipedia.org/wiki/Austria) endpoint:
|
||||
Let's use a fictional endpoint for [Austria](https://en.wikipedia.org/wiki/Austria) as an example:
|
||||
|
||||
```js
|
||||
const myProfile = {
|
||||
|
@ -31,7 +31,7 @@ const myProfile = {
|
|||
}
|
||||
```
|
||||
|
||||
Assuming their HAFAS endpoint returns all lines names prefixed with `foo `, We can strip them like this:
|
||||
Assuming their HAFAS endpoint returns all line names prefixed with `foo `, we can adapt our profile to clean them:
|
||||
|
||||
```js
|
||||
// get the default line parser
|
||||
|
|
Loading…
Add table
Reference in a new issue