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

34 lines
845 B
JavaScript
Raw Normal View History

2022-05-07 16:17:37 +02:00
import {inspect} from 'util'
import {createClient} from '../../index.js'
import {profile} from './index.js'
2018-04-12 22:14:30 +02:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client-example')
2018-04-12 22:14:30 +02:00
// from København Central to Aalborg
// client.journeys('8600626', '8600020', {results: 1})
// .then(({journeys}) => {
// const leg = journeys[0].legs[0]
// return client.trip(leg.tripId, leg.line.name)
// })
client.departures('8600626', {duration: 5})
// client.locations('KØbenhaven', {results: 2})
// client.stop('8600626') // København Central
// client.nearby({
// type: 'location',
// latitude: 55.673,
// longitude: 12.566
// }, {distance: 200})
// client.radar({
// north: 55.673,
// west: 12.566,
// south: 55.672,
// east: 12.567
// }, {results: 10})
.then(data => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2018-04-12 22:14:30 +02:00
})
.catch(console.error)