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

49 lines
1.3 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'
2021-08-05 19:17:16 +02:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client example')
2021-08-05 19:17:16 +02:00
const grazSonnenhang = '460413500'
const grazHödlweg = '460415400'
// client.journeys(grazSonnenhang, grazHödlweg, {
// 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[0]
// return client.trip(leg.tripId, {polyline: true})
2021-08-05 19:17:16 +02:00
// })
// client.departures(grazSonnenhang, {duration: 1})
// client.arrivals(grazSonnenhang, {duration: 10, linesOfStops: true})
client.locations('sonnenhang', {results: 3})
// client.stop(grazSonnenhang, {linesOfStops: true})
// client.nearby({
// type: 'location',
// id: '980027564',
// address: 'Eisengasse 10, 8020 Graz',
// latitude: 47.076553,
// longitude: 15.406064,
// }, {distance: 1000})
// client.reachableFrom({
// type: 'location',
// id: '980027564',
// address: 'Eisengasse 10, 8020 Graz',
// latitude: 47.076553,
// longitude: 15.406064,
// }, {
// maxDuration: 30,
// })
.then((data) => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2021-08-05 19:17:16 +02:00
})
.catch(console.error)