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

47 lines
1.2 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} from './index.js'
2019-05-13 22:00:10 +02:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client-example')
2019-05-13 22:00:10 +02:00
// client.journeys('116', '5900', {results: 1, polylines: true})
// client.departures('116', {duration: 1})
// client.arrivals('116', {duration: 10, linesOfStops: true})
client.locations('dammtor', {results: 2})
// client.stop('116', {linesOfStops: true}) // Dammtor
// client.nearby({
// type: 'location',
// latitude: 53.554422,
// longitude: 9.977934
// }, {distance: 60})
// client.radar({
// north: 53.55,
// west: 9.95,
// south: 52.51,
// east: 10
// }, {results: 10})
// client.reachableFrom({
// type: 'location',
// address: 'Hamburg, Holstenwall 9',
// latitude: 53.553766,
// longitude: 9.977514
// }, {
// when: new Date('2019-05-16T10:00:00+0200'),
// maxDuration: 8
// })
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs[0]
// return client.trip(leg.tripId, {polyline: true})
2019-05-13 22:00:10 +02:00
// })
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
.then((data) => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2019-05-13 22:00:10 +02:00
})
.catch(console.error)