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

49 lines
1.4 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'
2019-03-29 15:40:12 +01:00
2022-05-07 16:17:37 +02:00
const client = createClient(profile, 'hafas-client-example')
2019-03-29 15:40:12 +01:00
// Scheidemannplatz to Auestadion
client.journeys('2200073', '2200042', {results: 1, polylines: true})
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs.find(l => !!l.line)
// return client.trip(leg.tripId, {polyline: true})
2019-03-29 15:40:12 +01:00
// })
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
2021-04-18 19:18:41 +02:00
// client.departures('2200005', {duration: 1})
2019-03-29 15:40:12 +01:00
// client.arrivals('2200005', {duration: 10, linesOfStops: true})
// client.locations('kirchweg', {results: 2})
// client.stop('2200005', {linesOfStops: true}) // Kassel Kirchweg
// client.nearby({
// type: 'location',
// latitude: 51.313,
// longitude: 9.4654
// }, {distance: 400})
// client.radar({
// north: 51.320153,
// west: 9.458359,
// south: 51.304304,
// east: 9.493672
// }, {results: 10})
// client.reachableFrom({
// type: 'location',
// id: '990100251',
// address: 'Kassel, Heckerstraße 2',
// latitude: 51.308108,
// longitude: 9.475152
// }, {
// when: new Date('2019-04-02T10:00:00+0200'),
// maxDuration: 10
// })
.then((data) => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2019-03-29 15:40:12 +01:00
})
.catch(console.error)