mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
adapt docs & examples to 0a0cddc 📝
This commit is contained in:
parent
5d9d738152
commit
f20931b6de
15 changed files with 27 additions and 13 deletions
|
@ -19,6 +19,7 @@ This version is not fully backwords-compatible. Check out [the migration guide](
|
|||
|
||||
### breaking changes 💥
|
||||
|
||||
- c4935bc new mandatory `User-Agent` parameter
|
||||
- b7c1ee3 profiles: new products markup ([guide](https://github.com/public-transport/hafas-client/blob/ebe4fa64d871f711ced99d528c0171b180edc135/docs/writing-a-profile.md#3-products))
|
||||
- 40b559f change `radar(n, w, s, e)` signature to `radar({north, west, south, east})`
|
||||
- 005f3f8 remove `journey.departure`, `journey.arrival`, …
|
||||
|
|
|
@ -48,7 +48,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
// S Charlottenburg
|
||||
client.departures('900000024101', {duration: 3})
|
||||
|
|
|
@ -82,7 +82,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
// Hauptbahnhof to Heinrich-Heine-Str.
|
||||
client.journeys('900000003201', '900000100008', {
|
||||
|
|
|
@ -24,7 +24,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
client.locations('Alexanderplatz', {results: 3})
|
||||
.then(console.log)
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
# Migrating to `hafas-client@3`
|
||||
|
||||
## New `User-Agent` parameter
|
||||
|
||||
Pass an additional `User-Agent` string into `createClient`:
|
||||
|
||||
```js
|
||||
const createClient = require('hafas-client')
|
||||
const dbProfile = require('hafas-client/p/db')
|
||||
|
||||
const client = createClient(dbProfile, 'my-awesome-program')
|
||||
```
|
||||
|
||||
Pick a name that describes your program and – if possible – the website/repo of it.
|
||||
|
||||
## If you use the `journeyLeg()` method…
|
||||
|
||||
…change the `journeyLeg(id, lineName)` call to `trip(id, lineName)`. c8ff217
|
||||
|
|
|
@ -24,7 +24,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
client.nearby({
|
||||
type: 'location',
|
||||
|
|
|
@ -26,7 +26,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
client.radar({
|
||||
north: 52.52411,
|
||||
|
|
|
@ -35,7 +35,7 @@ As an example, we're going to use the [VBB profile](../p/vbb):
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
client.station('900000042101') // U Spichernstr.
|
||||
.then(console.log)
|
||||
|
|
|
@ -10,7 +10,7 @@ Let's say you used [`journeys`](journeys.md) and now want to get more up-to-date
|
|||
const createClient = require('hafas-client')
|
||||
const vbbProfile = require('hafas-client/p/vbb')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'my-awesome-program')
|
||||
|
||||
// Hauptbahnhof to Heinrich-Heine-Str.
|
||||
client.journeys('900000003201', '900000100008', {results: 1})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const createClient = require('../../')
|
||||
const dbProfile = require('.')
|
||||
|
||||
const client = createClient(dbProfile)
|
||||
const client = createClient(dbProfile, 'hafas-client-example')
|
||||
|
||||
// Berlin Jungfernheide to München Hbf
|
||||
client.journeys('8011167', '8000261', {results: 1, tickets: true})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const createClient = require('../..')
|
||||
const insaProfile = require('.')
|
||||
|
||||
const client = createClient(insaProfile)
|
||||
const client = createClient(insaProfile, 'hafas-client-example')
|
||||
|
||||
// from Magdeburg-Neustadt to Magdeburg-Buckau
|
||||
client.journeys('008010226', '008013456', {results: 1})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const createClient = require('../..')
|
||||
const nahshProfile = require('.')
|
||||
|
||||
const client = createClient(nahshProfile)
|
||||
const client = createClient(nahshProfile, 'hafas-client-example')
|
||||
|
||||
// Flensburg Hbf to Kiel Hbf
|
||||
client.journeys('8000103', '8000199', {results: 10, tickets: true})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const createClient = require('../..')
|
||||
const oebbProfile = require('.')
|
||||
|
||||
const client = createClient(oebbProfile)
|
||||
const client = createClient(oebbProfile, 'hafas-client-example')
|
||||
|
||||
// Wien Westbahnhof to Salzburg Hbf
|
||||
client.journeys('1291501', '8100002', {results: 1})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const createClient = require('../..')
|
||||
const vbbProfile = require('.')
|
||||
|
||||
const client = createClient(vbbProfile)
|
||||
const client = createClient(vbbProfile, 'hafas-client-example')
|
||||
|
||||
// Hauptbahnhof to Charlottenburg
|
||||
client.journeys('900000003201', '900000024101', {results: 1, polylines: true})
|
||||
|
|
|
@ -47,7 +47,7 @@ const createClient = require('hafas-client')
|
|||
const dbProfile = require('hafas-client/p/db')
|
||||
|
||||
// create a client with Deutsche Bahn profile
|
||||
const client = createClient(dbProfile)
|
||||
const client = createClient(dbProfile, 'my-awesome-program')
|
||||
|
||||
// Berlin Jungfernheide to München Hbf
|
||||
client.journeys('8011167', '8000261', {results: 1})
|
||||
|
|
Loading…
Add table
Reference in a new issue