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

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-03-12 22:43:50 +01:00
'use strict'
2018-02-26 22:14:11 +01:00
2018-03-12 22:43:50 +01:00
const createClient = require('../..')
const insaProfile = require('.')
2018-02-26 22:14:11 +01:00
const client = createClient(insaProfile, 'hafas-client-example')
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})
// client.departures('008010226', { duration: 5 })
// client.arrivals('8010226', {duration: 10, stationLines: 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.station('008010226') // Magdeburg-Neustadt
2018-03-12 22:43:50 +01:00
// client.nearby({
// type: 'location',
// latitude: 52.148842,
// longitude: 11.641705
// }, {distance: 200})
// client.radar({
// north: 52.148364,
// west: 11.600826,
// south: 52.108486,
// east: 11.651451
// }, {results: 10})
2018-02-26 22:14:11 +01:00
2018-03-13 21:04:42 +01:00
// .then(([journey]) => {
// const leg = journey.legs[0]
2018-06-29 15:05:29 +02:00
// return client.trip(leg.id, leg.line.name)
2018-03-13 21:04:42 +01:00
// })
// .then(([journey]) => {
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
2018-03-12 22:43:50 +01:00
.then(data => {
console.log(require('util').inspect(data, {depth: null, colors: true}))
2018-03-12 22:43:50 +01:00
})
.catch(console.error)