db-vendo-client/p/sbahn-muenchen/example.js

56 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2022-05-07 16:17:37 +02:00
import {inspect} from 'util'
import {createClient} from '../../index.js'
import {profile as sMuenchenProfile} from './index.js'
2018-09-07 19:56:05 +02:00
// Pick a descriptive user agent! hafas-client won't work with this string.
const client = createClient(sMuenchenProfile, 'hafas-client-example')
2018-09-07 19:56:05 +02:00
const mittersendling = '8004154'
const charlottenburg = '0621790'
let data = await client.locations('mittersendling', {results: 5})
// let data = await client.nearby({
2018-09-07 19:56:05 +02:00
// type: 'location',
// latitude: 48.153858,
// longitude: 11.533059
// }, {distance: 750})
// let data = await client.reachableFrom({
2018-09-07 19:56:05 +02:00
// type: 'location',
// address: 'Pötschnerstraße 3, neuhausen',
// latitude: 48.152499,
// longitude: 11.531695
// }, {
// when: new Date('2018-08-27T10:00:00+0200'),
// maxDuration: 20
// })
// let data = await client.stop(mittersendling, {linesOfStops: true})
// let data = await client.departures(mittersendling, {duration: 5})
// let data = await client.arrivals(mittersendling, {duration: 10, linesOfStops: true})
2018-09-07 19:56:05 +02:00
// let data = await client.journeys(mittersendling, charlottenburg, {
// results: 1,
// polylines: true,
// })
// {
// const [journey] = data.journeys
// data = await client.refreshJourney(journey.refreshToken, {
2018-09-07 19:56:05 +02:00
// stopovers: true, remarks: true
// })
// }
// {
// const [journey] = data.journeys
// const leg = journey.legs.find(leg => leg.line)
// data = await client.trip(leg.tripId, {polyline: true})
// }
// let data = await client.radar({
// north: 48.145121,
// west: 11.543736,
// south: 48.138339,
// east: 11.553776
// }, {results: 10})
2018-09-07 19:56:05 +02:00
console.log(inspect(data, {depth: null, colors: true}))