db-vendo-client/p/insa/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 insaProfile} from './index.js'
2018-02-26 22:14:11 +01:00
const client = createClient(insaProfile, 'hafas-client-example')
2018-02-26 22:14:11 +01:00
2020-03-07 00:35:32 +01:00
const hellestr1 = {
type: 'location',
id: '980801263',
address: 'Magdeburg - Leipziger Straße, Hellestraße 1',
latitude: 52.116706, longitude: 11.621821
}
2018-02-26 22:14:11 +01:00
// from Magdeburg-Neustadt to Magdeburg-Buckau
2018-03-12 22:43:50 +01:00
client.journeys('008010226', '008013456', {results: 1})
2021-04-18 19:18:41 +02:00
2018-03-12 22:43:50 +01:00
// client.departures('008010226', { duration: 5 })
// client.arrivals('8010226', {duration: 10, linesOfStops: true})
2018-03-12 22:43:50 +01:00
// client.locations('Magdeburg Hbf', {results: 2})
// client.locations('Kunstmuseum Kloster Unser Lieben Frauen Magdeburg', {results: 2})
// client.stop('008010226') // Magdeburg-Neustadt
2020-03-07 00:35:32 +01:00
// client.nearby(hellestr1)
// client.radar({
// north: 52.148364,
// west: 11.600826,
// south: 52.108486,
// east: 11.651451
// }, {results: 10})
2020-03-07 00:35:32 +01:00
// client.reachableFrom(hellestr1, {maxDuration: 10})
2018-02-26 22:14:11 +01:00
2019-01-16 21:40:45 +08:00
// .then(({journeys}) => {
// const [journey] = journeys
2018-03-13 21:04:42 +01:00
// const leg = journey.legs[0]
// return client.trip(leg.tripId, leg.line.name)
2018-03-13 21:04:42 +01:00
// })
2019-01-16 21:40:45 +08:00
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
2018-03-12 22:43:50 +01:00
.then(data => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2018-03-12 22:43:50 +01:00
})
.catch(console.error)