-
Notifications
You must be signed in to change notification settings - Fork 4
/
example.js
62 lines (53 loc) · 1.72 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import {inspect} from 'util'
import {createVbbHafas as createHafas} from './index.js'
// import {createThrottledHafas} from './throttle.js'
// import {createHafasWithRetry} from './retry.js'
const hafas = createHafas('vbb-hafas-example')
// const hafas = createThrottledHafas('vbb-hafas-example', 5, 100)
// const hafas = createHafasWithRetry('vbb-hafas-example', {retries: 2})
const spichernstr = '900042101'
const bismarckstr = '900024201'
let data = await hafas.journeys(spichernstr, bismarckstr, {
results: 1,
tickets: true,
stopovers: true,
transferInfo: true,
polylines: true,
})
// {
// const [journey] = data.journeys
// data = await hafas.refreshJourney(journey.refreshToken, {
// stopovers: true,
// transferInfo: true,
// })
// }
// {
// const [journey] = data.journeys
// const leg = journey.legs[0]
// data = await hafas.trip(leg.tripId, leg.line.name, {polyline: true})
// }
// let data = await hafas.departures('spichernstr', {duration: 1})
// let data = await hafas.arrivals('spichernstr', {duration: 10, linesOfStops: true})
// let data = await hafas.locations('spichernstr', {results: 2})
// let data = await hafas.nearby({
// type: 'location',
// latitude: 52.5137344,
// longitude: 13.4744798
// }, {distance: 60})
// let data = await hafas.reachableFrom({
// type: 'location',
// address: '13353 Berlin-Wedding, Torfstr. 17',
// latitude: 52.541797,
// longitude: 13.350042
// }, {
// when: new Date('2018-08-27T10:00:00+0200'),
// maxDuration: 10
// })
// let data = await hafas.stop(spichernstr, {linesOfStops: true})
// let data = await hafas.radar({
// north: 52.52411,
// west: 13.41002,
// south: 52.51942,
// east: 13.41709
// }, {results: 10})
console.log(inspect(data, {depth: null, colors: true}))