mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
docs fixes
[skip ci]
This commit is contained in:
parent
22c839847f
commit
3c7227635a
8 changed files with 21 additions and 48 deletions
|
@ -46,7 +46,7 @@ If you pass an object `opt.products`, its fields will partially override the def
|
|||
|
||||
*Note:* As stated in the [*Friendly Public Transport Format* v2 draft spec](https://github.com/public-transport/friendly-public-transport-format/blob/3bd36faa721e85d9f5ca58fb0f38cdbedb87bbca/spec/readme.md), the `when` field includes the current delay. The `delay` field, if present, expresses how much the former differs from the schedule.
|
||||
|
||||
You may pass a departure's `tripId` into [`trip(id, lineName, [opt])`](trip.md) to get details on the whole trip. For the `dbnav` profile HAFAS trip ids will be returned, for the `db` profile, RIS trip ids will be returned, then the `trip()` endpoint support both id types.
|
||||
You may pass a departure's `tripId` into [`trip(id, lineName, [opt])`](trip.md) to get details on the whole trip. For the `dbnav` profile HAFAS trip ids will be returned, for the `db` profile, RIS trip ids will be returned, then the `trip()` endpoint supports both id types.
|
||||
|
||||
For `db` profile, cancelled trips will not be contained in the response!
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ With `opt`, you can override the default options, which look like this:
|
|||
entrances: true, // not supported
|
||||
remarks: true, // parse & expose hints & warnings?
|
||||
scheduledDays: false, // not yet supported
|
||||
firstClass: true // first or second class for tickets
|
||||
loyaltyCard: '' // BahnCards etc., see below
|
||||
firstClass: false, // first or second class for tickets
|
||||
loyaltyCard: null, // BahnCards etc., see below
|
||||
language: 'en', // language to get results in
|
||||
}
|
||||
```
|
||||
|
@ -89,10 +89,10 @@ With `opt`, you can override the default options, which look like this:
|
|||
|
||||
```js
|
||||
import {createClient} 'db-vendo-client'
|
||||
import {profile as vbbProfile} from 'db-vendo-client/p/vbb/index.js'
|
||||
import {profile as dbProfile} from 'db-vendo-client/p/db/index.js'
|
||||
|
||||
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
||||
const client = createClient(vbbProfile, userAgent)
|
||||
const client = createClient(dbProfile, userAgent)
|
||||
|
||||
// Frankfurt to Stuttgart
|
||||
await client.journeys('8000105', '8000096', {
|
||||
|
@ -316,4 +316,4 @@ hafas.journeys(from, to, {
|
|||
|
||||
## The `routingMode` option
|
||||
|
||||
The `routingMode` option is not supported by db-vendo-client. The behavior will be the same as the `HYBRID` mode of hafas-client, i.e. cancelled trains/infeasible journeys will also be contained for informational purpose.
|
||||
The `routingMode` option is not supported by db-vendo-client. The behavior will be the same as the [`HYBRID` mode of hafas-client](https://github.com/public-transport/hafas-client/blob/main/p/db/readme.md#using-the-routingmode-option), i.e. cancelled trains/infeasible journeys will also be contained for informational purpose.
|
|
@ -20,14 +20,13 @@ With `opt`, you can override the default options, which look like this:
|
|||
|
||||
## Response
|
||||
|
||||
As an example, we're going to use the [VBB profile](../p/vbb):
|
||||
|
||||
```js
|
||||
import {createClient} from 'db-vendo-client'
|
||||
import {profile as vbbProfile} from 'db-vendo-client/p/vbb/index.js'
|
||||
import {profile as dbnavProfile} from 'db-vendo-client/p/dbnav/index.js'
|
||||
|
||||
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
||||
const client = createClient(vbbProfile, userAgent)
|
||||
const client = createClient(dbnavProfile, userAgent)
|
||||
|
||||
await client.locations('Alexanderplatz', {results: 3})
|
||||
```
|
||||
|
|
|
@ -21,14 +21,12 @@ With `opt`, you can override the default options, which look like this:
|
|||
|
||||
## Response
|
||||
|
||||
As an example, we're going to use the [VBB profile](../p/vbb):
|
||||
|
||||
```js
|
||||
import {createClient} from 'db-vendo-client'
|
||||
import {profile as vbbProfile} from 'db-vendo-client/p/vbb/index.js'
|
||||
import {profile as dbProfile} from 'db-vendo-client/p/db/index.js'
|
||||
|
||||
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
||||
const client = createClient(vbbProfile, userAgent)
|
||||
const client = createClient(dbProfile, userAgent)
|
||||
|
||||
await client.nearby({
|
||||
type: 'location',
|
||||
|
|
|
@ -143,13 +143,10 @@ Each `HafasError` error has the following properties:
|
|||
|
||||
## Using `db-vendo-client` from another language
|
||||
|
||||
If you want to use `db-vendo-client` to access DB APIs but work with non-Node.js environments, you can use it together with [hafas-rest-api](https://github.com/public-transport/hafas-rest-api) to create a REST API(see the [root readme](https://github.com/public-transport/db-vendo-client/tree/main#usage) and the Docker image).
|
||||
If you want to use `db-vendo-client` to access DB APIs but work with non-Node.js environments, you can use it together with [hafas-rest-api](https://github.com/public-transport/hafas-rest-api) to create a REST API (see the [root readme](https://github.com/public-transport/db-vendo-client/tree/main#usage) and the Docker image).
|
||||
Or use [`hafas-client-rpc`](https://github.com/derhuerst/hafas-client-rpc) to create a [JSON-RPC](https://www.jsonrpc.org) interface that you can send commands to.
|
||||
|
||||
## Writing a profile
|
||||
|
||||
Check [the guide](writing-a-profile.md).
|
||||
## General documentation and notes for DB APIs
|
||||
|
||||
## General documentation for `mgate.exe` APIs
|
||||
|
||||
[`hafas-mgate-api.md`](hafas-mgate-api.md)
|
||||
[`db-apis.md`](db-apis.md)
|
||||
|
|
|
@ -20,10 +20,10 @@ With `opt`, you can override the default options, which look like this:
|
|||
|
||||
```js
|
||||
import {createClient} from 'db-vendo-client'
|
||||
import {profile as vbbProfile} from 'db-vendo-client/p/vbb/index.js'
|
||||
import {profile as dbProfile} from 'db-vendo-client/p/db/index.js'
|
||||
|
||||
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
||||
const client = createClient(vbbProfile, userAgent)
|
||||
const client = createClient(dbProfile, userAgent)
|
||||
|
||||
const {journeys} = await client.journeys('8000105', '8000096', {results: 1})
|
||||
|
||||
|
|
25
docs/stop.md
25
docs/stop.md
|
@ -34,14 +34,13 @@ With `opt`, you can override the default options, which look like this:
|
|||
|
||||
## Response
|
||||
|
||||
As an example, we're going to use the [VBB profile](../p/vbb):
|
||||
|
||||
```js
|
||||
import {createClient} from 'hafas-client'
|
||||
import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js'
|
||||
import {profile as dbProfile} from 'hafas-client/p/db/index.js'
|
||||
|
||||
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
||||
const client = createClient(vbbProfile, userAgent)
|
||||
const client = createClient(dbProfile, userAgent)
|
||||
|
||||
await client.stop('900000042101') // U Spichernstr.
|
||||
```
|
||||
|
@ -74,11 +73,6 @@ The result may look like this:
|
|||
product: 'subway',
|
||||
public: true,
|
||||
name: 'U1',
|
||||
symbol: 'U',
|
||||
nr: 1,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: false
|
||||
},
|
||||
// …
|
||||
{
|
||||
|
@ -88,21 +82,6 @@ The result may look like this:
|
|||
product: 'bus',
|
||||
public: true,
|
||||
name: 'N9',
|
||||
symbol: 'N',
|
||||
nr: 9,
|
||||
metro: false,
|
||||
express: false,
|
||||
night: true
|
||||
} ]
|
||||
}
|
||||
```
|
||||
|
||||
If the endpoint returns a list of entrances for a station, the resulting station object will have an `entrances` array looking similar to this:
|
||||
|
||||
```js
|
||||
[
|
||||
{type: 'location', latitude: 47.411069, longitude: 10.277412},
|
||||
{type: 'location', latitude: 47.410493, longitude: 10.277223},
|
||||
{type: 'location', latitude: 47.410754, longitude: 10.278023}
|
||||
]
|
||||
```
|
||||
|
|
|
@ -6,10 +6,10 @@ Let's say you used [`journeys`](journeys.md) and now want to get more up-to-date
|
|||
|
||||
```js
|
||||
import {createClient} from 'db-vendo-client'
|
||||
import {profile as vbbProfile} from 'db-vendo-client/p/dbnav/index.js'
|
||||
import {profile as dbnavProfile} from 'db-vendo-client/p/dbnav/index.js'
|
||||
|
||||
const userAgent = 'link-to-your-project-or-email' // adapt this to your project!
|
||||
const client = createClient(vbbProfile, userAgent)
|
||||
const client = createClient(dbnavProfile, userAgent)
|
||||
|
||||
const {journeys} = client.journeys('8000096', '8000105', {results: 1})
|
||||
const leg = journeys[0].legs[0]
|
||||
|
@ -37,9 +37,9 @@ With `opt`, you can override the default options, which look like this:
|
|||
|
||||
```js
|
||||
import {createClient} from 'db-vendo-client'
|
||||
import {profile as vbbProfile} from 'db-vendo-client/p/dbnav/index.js'
|
||||
import {profile as dbnavProfile} from 'db-vendo-client/p/dbnav/index.js'
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(dbnavProfile)
|
||||
|
||||
const {
|
||||
trip,
|
||||
|
|
Loading…
Add table
Reference in a new issue