db-vendo-client/p/irish-rail/example.js

36 lines
1,004 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 21:49:55 +02:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client example')
2018-04-12 21:49:55 +02:00
// from Dublin to Belfast Central
client.journeys('9909002', '9990840', {results: 1})
// .then(({journeys}) => {
2021-04-18 19:18:41 +02:00
// const [journey] = journeys
// const leg = journey.legs[0]
// return client.trip(leg.tripId, {polyline: true})
2018-04-12 21:49:55 +02:00
// })
// client.departures('9909002', {duration: 5})
// client.arrivals('9909002', {duration: 10, linesOfStops: true})
// client.locations('Dublin', {results: 2})
// client.locations('Hochschule Dublin', {poi: true, addressses: false, fuzzy: false})
// client.stop('9909002') // Dublin
// client.nearby({
// type: 'location',
// latitude: 53.353,
// longitude: -6.247
// }, {distance: 200})
// client.radar({
// north: 53.35,
// west: -6.245,
// south: 53.34,
// east: -6.244
// }, {results: 10})
.then(data => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2018-04-12 21:49:55 +02:00
})
.catch(console.error)