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

50 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-08-05 19:17:16 +02:00
'use strict'
const createClient = require('../..')
const stvProfile = require('.')
const client = createClient(stvProfile, 'hafas-client example')
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, leg.line.name, {polyline: true})
// })
// 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) => {
console.log(require('util').inspect(data, {depth: null, colors: true}))
})
.catch(console.error)