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

45 lines
1.2 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 invgProfile} from './index.js'
2018-11-12 13:45:29 +01:00
const client = createClient(invgProfile, 'hafas-client-example')
2018-11-12 13:45:29 +01:00
const ingolstadtHbf = '8000183'
const audiParkplatz = '84999'
client.journeys(ingolstadtHbf, audiParkplatz, {results: 1})
2021-04-18 19:18:41 +02:00
// .then(({journeys}) => {
// const [journey] = journeys
2018-11-12 13:45:29 +01:00
// const leg = journey.legs[0]
// return client.trip(leg.tripId, {polyline: true})
2018-11-12 13:45:29 +01:00
// })
2021-04-18 19:18:41 +02:00
// .then(({journeys}) => {
// const [journey] = journeys
2018-11-12 13:45:29 +01:00
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
// client.departures(ingolstadtHbf, {duration: 5})
// client.arrivals(ingolstadtHbf, {duration: 10, stationLines: true})
// client.locations('tillystr 1', {results: 2})
// client.station(audiParkplatz) // Audi Parkplatz
// client.nearby({
// type: 'location',
// latitude: 48.74453,
// longitude: 11.43733
// }, {distance: 200})
// client.radar({
// north: 48.74453,
// west: 11.42733,
// south: 48.73453,
// east: 11.43733
// }, {results: 10})
// todo: `reachableFrom` with `Ingolstadt, Tillystraße 1` 48.745769 | 11.432814
.then((data) => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2018-11-12 13:45:29 +01:00
})
.catch(console.error)