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

46 lines
1.3 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 vmtProfile} from './index.js'
2020-03-02 23:16:45 +01:00
// Pick a descriptive user agent! hafas-client won't work with this string.
const client = createClient(vmtProfile, 'hafas-client-example')
2020-03-02 23:16:45 +01:00
const jena = '190014'
2021-04-18 19:18:41 +02:00
const gothaZOB = '167280'
2020-03-02 23:16:45 +01:00
let data = await client.locations('ohrdruf', {results: 2})
// let data = await client.nearby({
2020-03-02 23:16:45 +01:00
// type: 'location',
// latitude: 50.975615,
// longitude: 11.032374
// })
// let data = await client.reachableFrom({
2020-03-02 23:16:45 +01:00
// type: 'location',
// id: '980348376',
// address: 'Erfurt, Grafengasse 12',
// latitude: 50.975993, longitude: 11.031553
// }, {
// when: new Date('2020-03-04T10:00:00+01:00')
// })
// let data = await client.stop(jena, {linesOfStops: true}) // Dammtor
2020-03-02 23:16:45 +01:00
// let data = await client.departures(jena)
// let data = await client.arrivals(jena, {duration: 10, linesOfStops: true})
// let data = await client.journeys(jena, gothaZOB, {results: 1})
// {
// 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})
// }
2020-03-02 23:16:45 +01:00
console.log(inspect(data, {depth: null, colors: true}))