db-vendo-client/p/mobil-nrw/example.js

58 lines
1.4 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 mobilNrwProfile} from './index.js'
2021-01-10 17:46:09 +01:00
// Pick a descriptive user agent! hafas-client won't work with this string.
const client = createClient(mobilNrwProfile, 'hafas-client-example')
2021-01-10 17:46:09 +01:00
const soest = '8000076'
const aachenHbf = '8000001'
let data = await client.locations('soest', {results: 3})
// let data = await client.nearby({
// type: 'location',
// latitude: 51.4503,
// longitude: 6.6581,
// }, {distance: 1200})
// let data = await client.reachableFrom({
2021-01-10 17:46:09 +01:00
// type: 'location',
// id: '980301639',
// latitude: 51.387609,
// longitude: 6.684019,
// address: 'Duisburg, Am Mühlenberg 1',
// }, {
// maxDuration: 15,
// })
// let data = await client.stop(soest)
// let data = await client.departures(soest, {duration: 20})
// let data = await client.journeys(soest, aachenHbf, {
// results: 1,
// stopovers: 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})
// }
2021-01-10 17:46:09 +01:00
// let data = await client.radar({
2021-01-10 17:46:09 +01:00
// north: 51.4358,
// west: 6.7625,
// south: 51.4214,
// east: 6.7900,
// }, {results: 10})
// let data = await client.remarks()
2021-01-10 17:46:09 +01:00
console.log(inspect(data, {depth: null, colors: true}))