db-vendo-client/p/oebb/example.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-05-07 16:17:37 +02:00
import {inspect} from 'util'
import {createClient} from '../../index.js'
import {profile as oebbProfile} from './index.js'
2017-12-29 10:15:32 +01:00
// Pick a descriptive user agent! hafas-client won't work with this string.
const client = createClient(oebbProfile, 'hafas-client-example')
2017-12-29 10:15:32 +01:00
const westbahnhof = '1291501'
const salzburgHbf = '8100002'
const grazHbf = '8100173'
2021-04-18 19:18:41 +02:00
let data = await client.locations('Salzburg', {results: 2})
// let data = await client.nearby({
2018-06-28 12:08:54 +02:00
// type: 'location',
// latitude: 47.812851,
// longitude: 13.045604
// }, {distance: 60})
// let data = await client.reachableFrom({
2018-08-26 18:35:27 +02:00
// type: 'location',
// id: '970053039',
// name: 'Graz, BILLA, Hauptplatz',
// latitude: 47.070656,
// longitude: 15.438002
// }, {
// when: new Date('2018-08-27T10:00:00+0200'),
// maxDuration: 20
// })
2017-12-29 10:15:32 +01:00
// let data = await client.stop(grazHbf)
// let data = await client.departures(salzburgHbf, {duration: 1})
// let data = await client.arrivals(salzburgHbf, {duration: 10, linesOfStops: true})
// let data = await client.journeys(westbahnhof, salzburgHbf, {results: 1})
// {
// const [journey] = data.journeys
// data = await client.refreshJourney(journey.refreshToken, {
// stopovers: true,
// remarks: true,
// })
// }
// {
// const [journey] = data.journeys
// const [leg] = journey.legs
// data = await client.trip(leg.tripId, leg.line.name)
// }
// let data = await client.radar({
// north: 47.827203,
// west: 13.001261,
// south: 47.773278,
// east: 13.07562
// }, {results: 10})
console.log(inspect(data, {depth: null, colors: true}))