2022-05-07 16:17:37 +02:00
|
|
|
import {inspect} from 'util'
|
|
|
|
import {createClient} from '../../index.js'
|
|
|
|
import {profile} from './index.js'
|
2017-12-29 10:15:32 +01:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
const client = createClient(profile, 'hafas-client-example')
|
2017-12-29 10:15:32 +01:00
|
|
|
|
|
|
|
// Wien Westbahnhof to Salzburg Hbf
|
|
|
|
client.journeys('1291501', '8100002', {results: 1})
|
2021-04-18 19:18:41 +02:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const leg = journeys[0].legs[0]
|
|
|
|
// return client.trip(leg.tripId, leg.line.name)
|
|
|
|
// })
|
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
|
|
|
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
|
|
|
|
// })
|
|
|
|
|
2017-12-29 10:15:32 +01:00
|
|
|
// client.departures('8100002', {duration: 1})
|
2019-01-23 13:03:01 +08:00
|
|
|
// client.arrivals('8100002', {duration: 10, linesOfStops: true})
|
2017-12-29 10:15:32 +01:00
|
|
|
// client.locations('Salzburg', {results: 2})
|
2018-11-21 19:54:59 +01:00
|
|
|
// client.stop('8100173') // Graz Hbf
|
2018-06-28 12:08:54 +02:00
|
|
|
// client.nearby({
|
|
|
|
// type: 'location',
|
|
|
|
// latitude: 47.812851,
|
|
|
|
// longitude: 13.045604
|
|
|
|
// }, {distance: 60})
|
2018-03-16 17:28:48 +01:00
|
|
|
// client.radar({
|
|
|
|
// north: 47.827203,
|
|
|
|
// west: 13.001261,
|
|
|
|
// south: 47.773278,
|
|
|
|
// east: 13.07562
|
|
|
|
// }, {results: 10})
|
2018-08-26 18:35:27 +02:00
|
|
|
// client.reachableFrom({
|
|
|
|
// type: 'location',
|
|
|
|
// id: '970053039',
|
|
|
|
// name: 'Graz, BILLA, Hauptplatz',
|
|
|
|
// latitude: 47.070656,
|
|
|
|
// longitude: 15.438002
|
|
|
|
// }, {
|
|
|
|
// when: new Date('2018-08-27T10:00:00+0200'),
|
|
|
|
// maxDuration: 20
|
|
|
|
// })
|
2017-12-29 10:15:32 +01:00
|
|
|
|
|
|
|
.then((data) => {
|
2022-05-07 16:17:37 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|
2017-12-29 10:15:32 +01:00
|
|
|
})
|
|
|
|
.catch(console.error)
|