This repository was archived by the owner on Mar 31, 2021. It is now read-only.
forked from public-transport/hafas-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
49 lines (44 loc) · 1.38 KB
/
example.js
File metadata and controls
49 lines (44 loc) · 1.38 KB
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
'use strict'
const createClient = require('../..')
const nvvProfile = require('.')
const client = createClient(nvvProfile, 'hafas-client-example')
// Scheidemannplatz to Auestadion
client.journeys('2200073', '2200042', {results: 1, polylines: true})
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs.find(l => !!l.line)
// return client.trip(leg.tripId, leg.line.name, {polyline: true})
// })
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
// client.departures('2200005', {duration: 1, stopovers: true})
// client.arrivals('2200005', {duration: 10, linesOfStops: true})
// client.locations('kirchweg', {results: 2})
// client.stop('2200005', {linesOfStops: true}) // Kassel Kirchweg
// client.nearby({
// type: 'location',
// latitude: 51.313,
// longitude: 9.4654
// }, {distance: 400})
// client.radar({
// north: 51.320153,
// west: 9.458359,
// south: 51.304304,
// east: 9.493672
// }, {results: 10})
// client.reachableFrom({
// type: 'location',
// id: '990100251',
// address: 'Kassel, Heckerstraße 2',
// latitude: 51.308108,
// longitude: 9.475152
// }, {
// when: new Date('2019-04-02T10:00:00+0200'),
// maxDuration: 10
// })
.then((data) => {
console.log(require('util').inspect(data, {depth: null, colors: true}))
})
.catch(console.error)