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 irishProfile} from './index.js'
|
2018-04-12 21:49:55 +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(irishProfile, 'hafas-client example')
|
2018-04-12 21:49:55 +02:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
const dublin = '9909002'
|
|
|
|
const belfastCentral = '9990840'
|
2018-04-12 21:49:55 +02:00
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
let data = await client.locations('Dublin', {results: 2})
|
|
|
|
// let data = await client.locations('Hochschule Dublin', {
|
|
|
|
// poi: true,
|
|
|
|
// addressses: false,
|
|
|
|
// fuzzy: false,
|
|
|
|
// })
|
|
|
|
// let data = await client.nearby({
|
2018-04-12 21:49:55 +02:00
|
|
|
// type: 'location',
|
|
|
|
// latitude: 53.353,
|
|
|
|
// longitude: -6.247
|
|
|
|
// }, {distance: 200})
|
2023-07-28 21:35:56 +02:00
|
|
|
|
|
|
|
// let data = await client.stop(dublin) // Dublin
|
|
|
|
|
|
|
|
// let data = await client.departures(dublin, {duration: 5})
|
|
|
|
// let data = await client.arrivals(dublin, {duration: 10, linesOfStops: true})
|
|
|
|
|
|
|
|
// let data = await client.journeys(dublin, belfastCentral, {results: 1})
|
|
|
|
// {
|
|
|
|
// const [journey] = data.journeys
|
|
|
|
// const leg = journey.legs[0]
|
|
|
|
// data = await client.trip(leg.tripId, {polyline: true})
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let data = await client.radar({
|
2018-04-12 21:49:55 +02:00
|
|
|
// north: 53.35,
|
|
|
|
// west: -6.245,
|
|
|
|
// south: 53.34,
|
|
|
|
// east: -6.244
|
|
|
|
// }, {results: 10})
|
|
|
|
|
2023-07-28 21:35:56 +02:00
|
|
|
console.log(inspect(data, {depth: null, colors: true}))
|