2022-05-07 16:17:37 +02:00
|
|
|
import {inspect} from 'util'
|
|
|
|
import {createClient} from '../../index.js'
|
|
|
|
import {profile} from './index.js'
|
2019-08-20 23:47:12 +02:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
const client = createClient(profile, 'hafas-client-example')
|
2019-08-20 23:47:12 +02:00
|
|
|
|
|
|
|
// Hagen Bauhaus to Schwerte Bahnhof
|
|
|
|
// returns hafas error PARSE
|
2021-04-18 19:18:41 +02:00
|
|
|
client.journeys('3307002', '3357026', {results: 1})
|
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const leg = journeys[0].legs[0]
|
2021-12-29 21:33:42 +01:00
|
|
|
// return client.trip(leg.tripId, {polyline: true})
|
2021-04-18 19:18:41 +02:00
|
|
|
// })
|
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
|
|
|
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
|
|
|
|
// })
|
2019-08-20 23:47:12 +02:00
|
|
|
|
|
|
|
// client.departures('3307002', {duration: 60})
|
|
|
|
// client.arrivals('3307002', {duration: 30, linesOfStops: true})
|
|
|
|
// client.locations('Hagen Vorhalle')
|
|
|
|
// client.stop('3307002') // Hagen Bauhaus
|
|
|
|
|
|
|
|
// client.nearby({
|
|
|
|
// type: 'location',
|
|
|
|
// latitude: 51.38,
|
|
|
|
// longitude: 7.45
|
|
|
|
// }, {results: 1})
|
|
|
|
|
|
|
|
// client.radar({
|
|
|
|
// north: 51.5,
|
|
|
|
// west: 7.2,
|
|
|
|
// south: 51.2,
|
|
|
|
// east: 7.8
|
|
|
|
// }, {results: 10})
|
|
|
|
|
|
|
|
.then((data) => {
|
2022-05-07 16:17:37 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|
2019-08-20 23:47:12 +02:00
|
|
|
}, console.error)
|
|
|
|
|