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

48 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'
2020-03-03 01:39:16 +01:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client-example')
2020-03-03 01:39:16 +01:00
const marburgHbf = '3010011'
const mainzGonsenheim = '3011332'
const offenbachLiebigstr = {
type: 'location',
id: '990148095',
address: 'Offenbach am Main, Liebigstraße 22',
latitude: 50.096326, longitude: 8.759979
}
client.journeys(marburgHbf, mainzGonsenheim, {results: 1})
// client.departures(marburgHbf, {duration: 1})
// client.arrivals(marburgHbf, {duration: 10, linesOfStops: true})
// client.locations('wiesbaden igstadt', {results: 2})
// client.stop(marburgHbf, {linesOfStops: true}) // Dammtor
// client.nearby(offenbachLiebigstr)
// client.radar({
// north: 50.125,
// west: 8.661,
// south: 50.098,
// east: 8.71
// }, {results: 10})
// client.reachableFrom(offenbachLiebigstr, {
// when: new Date('2020-03-03T10:00:00+01:00'),
// maxDuration: 10
// })
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs[0]
// return client.trip(leg.tripId, {polyline: true})
2020-03-03 01:39:16 +01: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}))
2020-03-03 01:39:16 +01:00
})
.catch(console.error)