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

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-05-07 16:17:37 +02:00
import {inspect} from 'util'
import {createClient} from '../../index.js'
import {profile as ooevvProfile} from './index.js'
2021-08-05 19:32:41 +02:00
const client = createClient(ooevvProfile, 'hafas-client example')
2021-08-05 19:32:41 +02:00
const linzTheatergasse = '444670100'
const amstettenStadtbad = '431507400'
// client.journeys(linzTheatergasse, amstettenStadtbad, {
// results: 1, stopovers: true,
// })
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs.find(l => !!l.line)
// return client.trip(leg.tripId, {polyline: true})
2021-08-05 19:32:41 +02:00
// })
client.departures(linzTheatergasse, {duration: 12 * 60})
// client.arrivals(linzTheatergasse, {duration: 10, linesOfStops: true})
// client.locations('theatergasse', {results: 3})
// client.stop(linzTheatergasse, {linesOfStops: true})
// client.nearby({
// type: 'location',
// id: '980115190',
// address: 'Steingasse 19, 4020 Linz',
// latitude: 48.301181,
// longitude: 14.284057,
// }, {distance: 1000})
// client.reachableFrom({
// type: 'location',
// id: '980115190',
// address: 'Steingasse 19, 4020 Linz',
// latitude: 48.301181,
// longitude: 14.284057,
// }, {
// maxDuration: 30,
// })
.then((data) => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2021-08-05 19:32:41 +02:00
})
.catch(console.error)