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 vbnProfile} from './index.js'
|
2020-03-03 02:36:26 +01:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// Pick a descriptive user agent! hafas-client won't work with this string.
|
2022-11-22 21:08:08 +01:00
|
|
|
const client = createClient(vbnProfile, 'hafas-client-example')
|
2020-03-03 02:36:26 +01:00
|
|
|
|
|
|
|
const bremerhavenHbf = '9014418'
|
|
|
|
const verden = '9093627'
|
|
|
|
const bremenRutenstr = {
|
|
|
|
type: 'location',
|
|
|
|
id: '990025693',
|
|
|
|
address: 'Bremen Rutenstraße 1',
|
|
|
|
latitude: 53.074165, longitude: 8.8184
|
|
|
|
}
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
let data = await client.locations('oldenburg', {results: 2})
|
|
|
|
// let data = await client.nearby(bremenRutenstr)
|
|
|
|
// let data = await client.reachableFrom(bremenRutenstr, {
|
|
|
|
// maxDuration: 10
|
2021-04-18 19:18:41 +02:00
|
|
|
// })
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// let data = await client.stop(bremerhavenHbf, {linesOfStops: true})
|
|
|
|
|
|
|
|
// let data = await client.departures(bremerhavenHbf, {duration: 1})
|
|
|
|
// let data = await client.arrivals(bremerhavenHbf, {duration: 10, linesOfStops: true})
|
|
|
|
|
|
|
|
// let data = await client.journeys(bremerhavenHbf, verden, {results: 1})
|
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
|
|
|
// data = await client.refreshJourney(journey.refreshToken, {
|
|
|
|
// stopovers: true,
|
|
|
|
// remarks: true,
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
2021-04-18 19:18:41 +02:00
|
|
|
// const leg = journey.legs[0]
|
2023-07-28 21:35:56 +02:00
|
|
|
// data = await client.trip(leg.tripId, {polyline: true})
|
|
|
|
// }
|
2021-04-18 19:18:41 +02:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// let data = await client.radar({
|
2020-03-03 02:36:26 +01:00
|
|
|
// north: 53.087,
|
|
|
|
// west: 8.777,
|
|
|
|
// south: 53.072,
|
|
|
|
// east: 8.835
|
|
|
|
// }, {results: 10})
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|