2022-05-07 16:17:37 +02:00
|
|
|
import {inspect} from 'util'
|
|
|
|
import {createClient} from '../../index.js'
|
2022-11-22 21:08:08 +01:00
|
|
|
import {profile as sncbProfile} from './index.js'
|
2020-03-18 03:08:13 +01:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// Pick a descriptive user agent! hafas-client won't work with this string.
|
2022-11-22 21:08:08 +01:00
|
|
|
const client = createClient(sncbProfile, '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,
|
|
|
|
}
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
let data = await client.locations('gent')
|
|
|
|
// let data = await client.nearby(gentPaddenhoek)
|
|
|
|
// let data = await client.reachableFrom(gentPaddenhoek)
|
|
|
|
|
|
|
|
// let data = await client.stop(gentStPieters, {linesOfStops: true})
|
|
|
|
|
|
|
|
// let data = await client.departures(gentStPieters)
|
|
|
|
// let data = await client.arrivals(gentStPieters, {duration: 10, linesOfStops: true})
|
|
|
|
|
|
|
|
// let data = await client.journeys(gentStPieters, bruxellesMidi, {
|
|
|
|
// stopovers: true,
|
|
|
|
// remarks: true,
|
2020-03-18 03:08:13 +01:00
|
|
|
// })
|
2023-07-28 21:35:56 +02:00
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
|
|
|
// const leg = journey.legs[0]
|
|
|
|
// data = await client.trip(leg.tripId, {polyline: true})
|
|
|
|
// }
|
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
|
|
|
// data = await client.refreshJourney(journey.refreshToken, {remarks: true})
|
|
|
|
// }
|
2020-03-18 03:08:13 +01:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// let data = await client.radar({
|
2020-03-18 03:08:13 +01:00
|
|
|
// north: 51.065,
|
|
|
|
// west: 3.688,
|
|
|
|
// south: 51.04,
|
|
|
|
// east: 3.748
|
|
|
|
// }, {results: 10})
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|