db-vendo-client/p/sncb/example.js

47 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2022-05-07 16:17:37 +02:00
import {inspect} from 'util'
import {createClient} from '../../index.js'
import {profile as sncbProfile} from './index.js'
2020-03-18 03:08:13 +01:00
// Pick a descriptive user agent! hafas-client won't work with this string.
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,
}
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
// })
// {
// 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
// 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})
console.log(inspect(data, {depth: null, colors: true}))