db-vendo-client/p/mobil-nrw/example.js

53 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} from './index.js'
2021-01-10 17:46:09 +01:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client-example')
2021-01-10 17:46:09 +01:00
const soest = '8000076'
const aachenHbf = '8000001'
client.journeys(soest, aachenHbf, {results: 1, stopovers: true})
// .then(({journeys}) => {
2021-04-18 19:18:41 +02:00
// const [journey] = journeys
// const leg = journey.legs[0]
// return client.trip(leg.tripId, {polyline: true})
2021-04-18 19:18:41 +02:00
// })
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
2021-01-10 17:46:09 +01:00
// })
// client.locations('soest', {results: 3})
// client.reachableFrom({
// type: 'location',
// id: '980301639',
// latitude: 51.387609,
// longitude: 6.684019,
// address: 'Duisburg, Am Mühlenberg 1',
// }, {
// maxDuration: 15,
// })
// client.nearby({
// type: 'location',
// latitude: 51.4503,
// longitude: 6.6581,
// }, {distance: 1200})
// client.station(soest)
// client.departures(soest, {duration: 20})
// client.radar({
// north: 51.4358,
// west: 6.7625,
// south: 51.4214,
// east: 6.7900,
// }, {results: 10})
// client.remarks()
.then(data => {
console.log(inspect(data, {depth: null, colors: true}))
})
.catch(console.error)