2022-05-07 16:17:37 +02:00
|
|
|
import {inspect} from 'util'
|
|
|
|
import {createClient} from '../../index.js'
|
|
|
|
import {profile} from './index.js'
|
2020-03-18 03:08:13 +01:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
const client = createClient(profile, 'hafas-client-example')
|
2020-03-18 03:08:13 +01:00
|
|
|
|
|
|
|
const gentStPieters = '8892007'
|
|
|
|
const bruxellesMidi = '8814001'
|
|
|
|
const gentPaddenhoek = {
|
|
|
|
type: 'location',
|
|
|
|
address: 'Gent, Paddenhoek',
|
|
|
|
latitude: 51.0517, longitude: 3.724878,
|
|
|
|
}
|
|
|
|
|
2021-04-18 19:18:41 +02:00
|
|
|
client.journeys(gentStPieters, bruxellesMidi, {stopovers: true, remarks: true})
|
2020-03-18 03:08:13 +01:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const leg = journeys[0].legs[0]
|
2021-12-29 21:33:42 +01:00
|
|
|
// return client.trip(leg.tripId, {polyline: true})
|
2020-03-18 03:08:13 +01:00
|
|
|
// })
|
|
|
|
// .then(({journeys}) => {
|
|
|
|
// return client.refreshJourney(journeys[0].refreshToken, {remarks: true})
|
|
|
|
// })
|
|
|
|
|
|
|
|
// client.departures(gentStPieters)
|
|
|
|
// client.arrivals(gentStPieters, {duration: 10, linesOfStops: true})
|
|
|
|
// client.locations('gent')
|
|
|
|
// client.stop(gentStPieters, {linesOfStops: true})
|
|
|
|
// client.nearby(gentPaddenhoek)
|
|
|
|
// client.radar({
|
|
|
|
// north: 51.065,
|
|
|
|
// west: 3.688,
|
|
|
|
// south: 51.04,
|
|
|
|
// east: 3.748
|
|
|
|
// }, {results: 10})
|
|
|
|
// client.reachableFrom(gentPaddenhoek)
|
|
|
|
|
|
|
|
.then((data) => {
|
2022-05-07 16:17:37 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|
2020-03-18 03:08:13 +01:00
|
|
|
})
|
|
|
|
.catch(console.error)
|