2018-06-03 17:10:01 -05:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const createClient = require('../..')
|
|
|
|
const cmtaProfile = require('.')
|
|
|
|
|
2018-08-24 19:25:57 +02:00
|
|
|
const client = createClient(cmtaProfile, 'hafas-client-example')
|
2018-06-03 17:10:01 -05:00
|
|
|
|
|
|
|
// Broadie Oaks to Domain
|
2018-06-03 17:30:14 -05:00
|
|
|
client.journeys('000002370', '000005919', {results: 1, polylines: true})
|
2018-06-03 17:10:01 -05:00
|
|
|
// client.departures('000002370', {duration: 1})
|
2018-08-24 19:25:57 +02:00
|
|
|
// client.arrivals('000002370', {duration: 10, stationLines: true})
|
2018-06-03 17:10:01 -05:00
|
|
|
// client.locations('Westgate', {results: 2})
|
2018-11-21 19:54:59 +01:00
|
|
|
// client.stop('000005534') // Downtown light rail station
|
2018-06-04 08:30:24 -05:00
|
|
|
// client.nearby({
|
2018-08-24 19:25:57 +02:00
|
|
|
// type: 'location',
|
|
|
|
// latitude: 30.266222,
|
2018-08-27 13:18:24 +02:00
|
|
|
// longitude: -97.746058
|
2018-06-04 08:30:24 -05:00
|
|
|
// }, {distance: 60})
|
2018-08-24 19:25:57 +02:00
|
|
|
// client.radar({
|
|
|
|
// north: 30.240877,
|
|
|
|
// west: -97.804588,
|
|
|
|
// south: 30.225378,
|
|
|
|
// east: -97.786692
|
|
|
|
// }, {results: 10})
|
2018-08-26 18:35:27 +02:00
|
|
|
// client.reachableFrom({
|
|
|
|
// type: 'location',
|
|
|
|
// address: '604 W 9TH ST, Austin, TX 78701',
|
|
|
|
// latitude: 30.272910,
|
|
|
|
// longitude: -97.747883
|
|
|
|
// }, {
|
|
|
|
// when: new Date('2018-08-27T10:00:00+0200'),
|
|
|
|
// maxDuration: 15
|
|
|
|
// })
|
2018-08-24 19:25:57 +02:00
|
|
|
|
2019-01-16 21:40:45 +08:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
2018-06-03 17:10:01 -05:00
|
|
|
// const leg = journey.legs[0]
|
2018-11-21 23:56:39 +01:00
|
|
|
// return client.trip(leg.tripId, leg.line.name, {polyline: true})
|
2018-06-03 17:10:01 -05:00
|
|
|
// })
|
2019-01-16 21:40:45 +08:00
|
|
|
// .then(({journeys}) => {
|
|
|
|
// const [journey] = journeys
|
2018-08-24 19:28:31 +02:00
|
|
|
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
|
|
|
|
// })
|
2018-08-24 19:25:57 +02:00
|
|
|
|
2018-06-03 17:10:01 -05:00
|
|
|
.then((data) => {
|
2018-12-10 14:38:07 +01:00
|
|
|
console.log(require('util').inspect(data, {depth: null, colors: true}))
|
2018-06-03 17:10:01 -05:00
|
|
|
})
|
|
|
|
.catch(console.error)
|