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

37 lines
1,018 B
JavaScript
Raw Normal View History

2018-04-12 21:49:55 +02:00
'use strict'
const createClient = require('../..')
const irishProfile = require('.')
2021-04-18 19:18:41 +02:00
const client = createClient(irishProfile, '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, leg.line.name, {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 => {
2021-04-18 19:18:41 +02:00
console.log(require('util').inspect(data, {depth: null, colors: true}))
2018-04-12 21:49:55 +02:00
})
.catch(console.error)