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

53 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 tpgProfile} from './index.js'
2021-07-26 17:30:11 +02:00
const client = createClient(tpgProfile, 'hafas-client-example')
2021-07-26 17:30:11 +02:00
const miremont = '100449'
const moillebeau = '100451'
client.journeys(miremont, moillebeau, {results: 1, stopovers: true})
// .then(({journeys}) => {
// const [journey] = journeys
// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
// })
// .then(({journeys}) => {
// const [journey] = journeys
// const leg = journey.legs[0]
// return client.trip(leg.tripId, {polyline: true})
2021-07-26 17:30:11 +02:00
// })
// client.departures(miremont, {duration: 1})
// client.arrivals(miremont, {duration: 10, linesOfStops: true})
// client.radar({
// north: 46.1849,
// east: 6.1919,
// south: 46.2215,
// west: 6.1192,
// }, {results: 10})
// client.locations('miremont', {results: 3})
// client.stop(miremont, {linesOfStops: true})
// client.nearby({
// type: 'location',
// latitude: 46.197768,
// longitude: 6.148046,
// }, {distance: 500})
// client.reachableFrom({
// type: 'location',
// id: '990001624',
// address: 'Cours des Bastions 10, 1205 Genève',
// latitude: 46.197768,
// longitude: 6.148046,
// }, {
// maxDuration: 10,
// })
.then((data) => {
2022-05-07 16:17:37 +02:00
console.log(inspect(data, {depth: null, colors: true}))
2021-07-26 17:30:11 +02:00
})
.catch(console.error)