2022-05-07 16:17:37 +02:00
|
|
|
import {inspect} from 'util'
|
|
|
|
import {createClient} from '../../index.js'
|
2022-11-22 21:08:08 +01:00
|
|
|
import {profile as sMuenchenProfile} from './index.js'
|
2018-09-07 19:56:05 +02:00
|
|
|
|
2022-11-22 21:08:08 +01:00
|
|
|
const client = createClient(sMuenchenProfile, 'hafas-client-example')
|
2018-09-07 19:56:05 +02:00
|
|
|
|
|
|
|
// Mittersendling to Charlottenburg
|
|
|
|
// client.journeys('8004154', '0621790', {results: 1, polylines: true})
|
|
|
|
client.departures('8004154', {duration: 5})
|
2019-01-23 13:03:01 +08:00
|
|
|
// client.arrivals('8004154', {duration: 10, linesOfStops: true})
|
2018-09-07 19:56:05 +02:00
|
|
|
// client.locations('mittersendling', {results: 5})
|
2019-01-23 13:03:01 +08:00
|
|
|
// client.stop('8004154', {linesOfStops: true}) // Mittersendling
|
2018-09-07 19:56:05 +02:00
|
|
|
// client.nearby({
|
|
|
|
// type: 'location',
|
|
|
|
// latitude: 48.153858,
|
|
|
|
// longitude: 11.533059
|
|
|
|
// }, {distance: 750})
|
|
|
|
// client.radar({
|
|
|
|
// north: 48.145121,
|
|
|
|
// west: 11.543736,
|
|
|
|
// south: 48.138339,
|
|
|
|
// east: 11.553776
|
|
|
|
// }, {results: 10})
|
|
|
|
// client.reachableFrom({
|
|
|
|
// type: 'location',
|
|
|
|
// address: 'Pötschnerstraße 3, neuhausen',
|
|
|
|
// latitude: 48.152499,
|
|
|
|
// longitude: 11.531695
|
|
|
|
// }, {
|
|
|
|
// when: new Date('2018-08-27T10:00:00+0200'),
|
|
|
|
// maxDuration: 20
|
|
|
|
// })
|
|
|
|
|
2019-01-16 21:40:45 +08:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
2018-09-07 19:56:05 +02:00
|
|
|
// const leg = journey.legs.find(leg => leg.line)
|
2021-12-29 21:33:42 +01:00
|
|
|
// return client.trip(leg.tripId, {polyline: true})
|
2018-09-07 19:56:05 +02:00
|
|
|
// })
|
|
|
|
|
2019-01-16 21:40:45 +08:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
2018-09-07 19:56:05 +02:00
|
|
|
// 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}))
|
2018-09-07 19:56:05 +02:00
|
|
|
})
|
|
|
|
.catch(console.error)
|