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 ivbProfile} from './index.js'
|
2021-08-05 19:06:03 +02: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(ivbProfile, 'hafas-client example')
|
2021-08-05 19:06:03 +02:00
|
|
|
|
|
|
|
const innsbruckGriesauweg = '476162400'
|
|
|
|
const völsWest = '476431800'
|
2023-07-28 21:35:56 +02:00
|
|
|
const lönsstr9 = {
|
|
|
|
type: 'location',
|
|
|
|
id: '980076175',
|
|
|
|
address: 'Lönsstraße 9, 6020 Innsbruck',
|
|
|
|
latitude: 47.262765,
|
|
|
|
longitude: 11.419851,
|
|
|
|
}
|
2021-08-05 19:06:03 +02:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
let data = await client.locations('griesauweg', {results: 3})
|
|
|
|
// let data = await client.nearby(lönsstr9, {distance: 1000})
|
|
|
|
// let data = await client.reachableFrom(lönsstr9, {
|
|
|
|
// maxDuration: 30,
|
2021-08-05 19:06:03 +02:00
|
|
|
// })
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// let data = await client.stop(innsbruckGriesauweg, {linesOfStops: true})
|
2021-08-05 19:06:03 +02:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
// let data = await client.departures(innsbruckGriesauweg, {duration: 1})
|
|
|
|
// let data = await client.arrivals(innsbruckGriesauweg, {duration: 10, linesOfStops: true})
|
|
|
|
|
|
|
|
// let data = await client.journeys(innsbruckGriesauweg, völsWest, {
|
|
|
|
// results: 1, stopovers: true,
|
2021-08-05 19:06:03 +02:00
|
|
|
// })
|
2023-07-28 21:35:56 +02:00
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
|
|
|
// data = await client.refreshJourney(journey.refreshToken, {
|
|
|
|
// stopovers: true,
|
|
|
|
// remarks: true,
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
|
|
|
// const leg = journey.legs[0]
|
|
|
|
// data = await client.trip(leg.tripId, {polyline: true})
|
|
|
|
// }
|
2021-08-05 19:06:03 +02:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|