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 bvgProfile} from './index.js'
|
2018-07-28 13:43:15 +02:00
|
|
|
|
2022-11-22 21:08:08 +01:00
|
|
|
const client = createClient(bvgProfile, 'hafas-client-example')
|
2018-07-28 13:43:15 +02:00
|
|
|
|
|
|
|
// Hauptbahnhof to Charlottenburg
|
|
|
|
client.journeys('900000003201', '900000024101', {results: 1, polylines: true})
|
|
|
|
// client.departures('900000013102', {duration: 1})
|
2019-01-23 13:03:01 +08:00
|
|
|
// client.arrivals('900000013102', {duration: 10, linesOfStops: true})
|
2018-07-28 13:43:15 +02:00
|
|
|
// client.locations('Alexanderplatz', {results: 2})
|
2019-01-23 13:03:01 +08:00
|
|
|
// client.stop('900000042101', {linesOfStops: true}) // Spichernstr
|
2018-07-28 13:43:15 +02:00
|
|
|
// client.nearby({
|
|
|
|
// type: 'location',
|
|
|
|
// latitude: 52.5137344,
|
|
|
|
// longitude: 13.4744798
|
|
|
|
// }, {distance: 60})
|
|
|
|
// client.radar({
|
|
|
|
// north: 52.52411,
|
|
|
|
// west: 13.41002,
|
|
|
|
// south: 52.51942,
|
|
|
|
// east: 13.41709
|
|
|
|
// }, {results: 10})
|
2018-08-26 18:35:27 +02:00
|
|
|
// client.reachableFrom({
|
|
|
|
// type: 'location',
|
|
|
|
// address: '13353 Berlin-Wedding, Torfstr. 17',
|
|
|
|
// latitude: 52.541797,
|
|
|
|
// longitude: 13.350042
|
|
|
|
// }, {
|
|
|
|
// when: new Date('2018-08-27T10:00:00+0200'),
|
|
|
|
// maxDuration: 10
|
|
|
|
// })
|
2018-07-28 13:43:15 +02:00
|
|
|
|
2019-01-16 21:40:45 +08:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
2018-07-28 13:43:15 +02:00
|
|
|
// const leg = journey.legs[0]
|
2021-12-29 21:33:42 +01:00
|
|
|
// return client.trip(leg.tripId, {polyline: true})
|
2018-07-28 13:43:15 +02:00
|
|
|
// })
|
|
|
|
|
2019-01-16 21:40:45 +08:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
2018-07-28 13:43:15 +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-07-28 13:43:15 +02:00
|
|
|
})
|
|
|
|
.catch(console.error)
|