db-vendo-client/p/vrn/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 vrnProfile} from './index.js'
2020-11-26 13:54:16 +01:00
// Pick a descriptive user agent! hafas-client won't work with this string.
const client = createClient(vrnProfile, 'hafas-client-example')
2020-11-26 13:54:16 +01:00
const ludwigshafen = '8000236'
const meckesheim = '8003932'
let data = await client.locations('meckesheim', {results: 2})
// let data = await client.nearby({
2020-11-26 13:54:16 +01:00
// type: 'location',
// latitude: 53.554422,
// longitude: 9.977934
// }, {distance: 60})
// let data = await client.reachableFrom({
2020-11-26 13:54:16 +01:00
// type: 'location',
// id: '980787337',
// address: 'Ludwigshafen am Rhein - Mitte, Pestalozzistraße 2',
// latitude: 49.474336, longitude: 8.441779,
// }, {
// when: new Date('2020-12-01T10:00:00+01:00'),
// maxDuration: 8,
// })
// let data = await client.stop(ludwigshafen, {linesOfStops: true})
// let data = await client.departures(ludwigshafen, {duration: 1})
// let data = await client.arrivals(ludwigshafen, {duration: 10, linesOfStops: true})
// let data = await client.journeys(ludwigshafen, meckesheim, {
// results: 1,
// polylines: true,
// })
// {
// 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})
// }
// let data = await client.radar({
2020-11-26 13:54:16 +01:00
// north: 49.4940,
// west: 8.4560,
// south: 49.4774,
// east: 8.4834,
// }, {results: 10})
console.log(inspect(data, {depth: null, colors: true}))