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
|
|
|
|
2018-07-19 21:55:03 +02: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 })
|
2019-01-23 13:03:01 +08:00
|
|
|
// 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})
|
2018-11-21 19:54:59 +01:00
|
|
|
// client.stop('008010226') // Magdeburg-Neustadt
|
2018-03-12 22:43:50 +01:00
|
|
|
// client.nearby({
|
|
|
|
// type: 'location',
|
|
|
|
// latitude: 52.148842,
|
|
|
|
// longitude: 11.641705
|
|
|
|
// }, {distance: 200})
|
2018-03-16 17:28:48 +01:00
|
|
|
// client.radar({
|
|
|
|
// north: 52.148364,
|
|
|
|
// west: 11.600826,
|
|
|
|
// south: 52.108486,
|
|
|
|
// east: 11.651451
|
|
|
|
// }, {results: 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]
|
2018-11-21 23:56:39 +01:00
|
|
|
// 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
|
2018-07-24 18:16:14 +02:00
|
|
|
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
|
|
|
|
// })
|
|
|
|
|
2018-03-12 22:43:50 +01:00
|
|
|
.then(data => {
|
2018-12-10 14:38:07 +01:00
|
|
|
console.log(require('util').inspect(data, {depth: null, colors: true}))
|
2018-03-12 22:43:50 +01:00
|
|
|
})
|
|
|
|
.catch(console.error)
|