diff --git a/p/cfl/example.js b/p/cfl/example.js index e91a6345..ab56f9a6 100644 --- a/p/cfl/example.js +++ b/p/cfl/example.js @@ -5,29 +5,48 @@ const cflProfile = require('.') const client = createClient(cflProfile, 'hafas-client-example') -// from Mersch to Pfaffenthal-Kirchberg -// client.journeys('009864348', '008200102', {results: 1}) -client.departures('009864348', { duration: 5 }) -// client.locations('Pfaffenthal Kirchberg', {results: 2}) -// client.station('009864348') // Mersch +const mersch = '9864348' +const bruxellesCentral = '8800003' + +// from Mersch to Bruxelles Central +client.journeys(mersch, bruxellesCentral, {results: 1}) +// .then(({journeys}) => { +// const leg = journeys[0].legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) + +// client.locations('mersch', {results: 3}) +// client.stop(mersch) // client.nearby({ // type: 'location', // latitude: 49.7523, // longitude: 6.1103 // }, {distance: 500}) + +// client.departures(mersch, {duration: 5}) +// client.arrivals(mersch, {duration: 10, linesOfStops: true}) + // client.radar({ // north: 49.9, // west: 6.11, // south: 49.7, // east: 6.13 // }, {results: 10}) - -// .then(({journeys}) => { -// const leg = journeys[0].legs[0] -// return client.trip(leg.tripId, leg.line.name) +// client.reachableFrom({ +// type: 'location', +// id: '980005067', +// address: '7557 Mersch, Rue Mies 1', +// latitude: 49.746044, +// longitude: 6.102228, +// }, { +// maxDuration: 30, // }) .then(data => { - console.log(require('util').inspect(data, { depth: null })) + console.log(require('util').inspect(data, {depth: null, colors: true})) }) .catch(console.error) diff --git a/p/db-busradar-nrw/example.js b/p/db-busradar-nrw/example.js index 5464c965..09747a55 100644 --- a/p/db-busradar-nrw/example.js +++ b/p/db-busradar-nrw/example.js @@ -7,7 +7,15 @@ const client = createClient(dbbusradarnrwProfile, 'hafas-client-example') // Hagen Bauhaus to Schwerte Bahnhof // returns hafas error PARSE -// client.journeys('3307002', '3357026', {results: 1}) +client.journeys('3307002', '3357026', {results: 1}) +// .then(({journeys}) => { +// const leg = journeys[0].legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) // client.departures('3307002', {duration: 60}) // client.arrivals('3307002', {duration: 30, linesOfStops: true}) diff --git a/p/db/example.js b/p/db/example.js index ce12163d..a5d6be43 100644 --- a/p/db/example.js +++ b/p/db/example.js @@ -7,6 +7,15 @@ const client = createClient(dbProfile, 'hafas-client-example') // Berlin Jungfernheide to München Hbf client.journeys('8011167', '8000261', {results: 1, tickets: true}) +// .then(({journeys}) => { +// const leg = journeys[0].legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) + // client.departures('8011167', {duration: 1}) // client.arrivals('8011167', {duration: 10, linesOfStops: true}) // client.locations('Berlin Jungfernheide') diff --git a/p/insa/example.js b/p/insa/example.js index 624eec3b..7e6b6981 100644 --- a/p/insa/example.js +++ b/p/insa/example.js @@ -14,6 +14,7 @@ const hellestr1 = { // from Magdeburg-Neustadt to Magdeburg-Buckau client.journeys('008010226', '008013456', {results: 1}) + // client.departures('008010226', { duration: 5 }) // client.arrivals('8010226', {duration: 10, linesOfStops: true}) // client.locations('Magdeburg Hbf', {results: 2}) diff --git a/p/invg/example.js b/p/invg/example.js index 34e0b9fe..593adbc0 100644 --- a/p/invg/example.js +++ b/p/invg/example.js @@ -9,11 +9,13 @@ const ingolstadtHbf = '8000183' const audiParkplatz = '84999' client.journeys(ingolstadtHbf, audiParkplatz, {results: 1}) -// .then(([journey]) => { +// .then(({journeys}) => { +// const [journey] = journeys // const leg = journey.legs[0] -// return client.trip(leg.id, leg.line.name, {polyline: true}) +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) // }) -// .then(([journey]) => { +// .then(({journeys}) => { +// const [journey] = journeys // return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) // }) diff --git a/p/irish-rail/example.js b/p/irish-rail/example.js index ddea918d..bddcf4f4 100644 --- a/p/irish-rail/example.js +++ b/p/irish-rail/example.js @@ -3,13 +3,14 @@ const createClient = require('../..') const irishProfile = require('.') -const client = createClient(irishProfile) +const client = createClient(irishProfile, 'hafas-client example') // from Dublin to Belfast Central client.journeys('9909002', '9990840', {results: 1}) // .then(({journeys}) => { -// const leg = journeys[0].legs[0] -// return client.trip(leg.tripId, leg.line && leg.line.name) +// const [journey] = journeys +// const leg = journey.legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) // }) // client.departures('9909002', {duration: 5}) @@ -30,6 +31,6 @@ client.journeys('9909002', '9990840', {results: 1}) // }, {results: 10}) .then(data => { - console.log(require('util').inspect(data, { depth: null })) + console.log(require('util').inspect(data, {depth: null, colors: true})) }) .catch(console.error) diff --git a/p/mobil-nrw/example.js b/p/mobil-nrw/example.js index c66f69bd..67e82fbd 100644 --- a/p/mobil-nrw/example.js +++ b/p/mobil-nrw/example.js @@ -11,8 +11,13 @@ const aachenHbf = '8000001' client.journeys(soest, aachenHbf, {results: 1, stopovers: true}) // .then(({journeys}) => { -// const leg = journeys[0].legs[0] -// return client.trip(leg.tripId, leg.line.name) +// const [journey] = journeys +// const leg = journey.legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) // }) // client.locations('soest', {results: 3}) diff --git a/p/mobiliteit-lu/example.js b/p/mobiliteit-lu/example.js index a70023d3..d81bee74 100644 --- a/p/mobiliteit-lu/example.js +++ b/p/mobiliteit-lu/example.js @@ -5,14 +5,19 @@ const mobiliteitProfile = require('.') const client = createClient(mobiliteitProfile, 'hafas-client example') -const mersch = '160904001' -const bruxellesCentral = '300000079' +const mersch = '160904011' +const luxembourgCentral = '200405060' // from Mersch to Bruxelles Central -client.journeys(mersch, bruxellesCentral, {results: 1}) +client.journeys(mersch, luxembourgCentral, {results: 1}) // .then(({journeys}) => { -// const leg = journeys[0].legs[0] -// return client.trip(leg.id, leg.line.name, {polyline: true}) +// const [journey] = journeys +// const leg = journey.legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) // }) // client.locations('mersch', {results: 3}) @@ -38,7 +43,6 @@ client.journeys(mersch, bruxellesCentral, {results: 1}) // address: 'Mersch, Rue Mies 1', // latitude: 49.746044, longitude: 6.102228, // }, { -// when: new Date('2020-10-10T10:00:00+02:00'), // maxDuration: 30 // }) diff --git a/p/nahsh/example.js b/p/nahsh/example.js index 051f9632..7d3d93ff 100644 --- a/p/nahsh/example.js +++ b/p/nahsh/example.js @@ -7,6 +7,16 @@ const client = createClient(nahshProfile, 'hafas-client-example') // Flensburg Hbf to Kiel Hbf client.journeys('8000103', '8000199', {results: 10, tickets: true}) +// .then(({journeys}) => { +// const [journey] = journeys +// const leg = journey.legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) + // client.departures('8000199', {duration: 10}) // client.arrivals('8000199', {duration: 5, linesOfStops: true}) // client.trip('1|30161|5|100|14032018', 'Bus 52') @@ -17,7 +27,6 @@ client.journeys('8000103', '8000199', {results: 10, tickets: true}) // latitude: 54.295691, // longitude: 10.116424 // }, {distance: 60}) -// client.radar(54.4, 10.0, 54.2, 10.2, {results: 10}) // client.reachableFrom({ // type: 'location', // address: 'Husum, Berliner Straße 80', @@ -28,6 +37,15 @@ client.journeys('8000103', '8000199', {results: 10, tickets: true}) // maxDuration: 20 // }) +// client.radar({ +// north: 54.4, +// west: 10.0, +// south: 54.2, +// east: 10.2 +// }, { +// results: 10, +// }) + .then((data) => { console.log(require('util').inspect(data, {depth: null, colors: true})) }) diff --git a/p/nvv/example.js b/p/nvv/example.js index dcd0d4aa..641586c6 100644 --- a/p/nvv/example.js +++ b/p/nvv/example.js @@ -17,7 +17,7 @@ client.journeys('2200073', '2200042', {results: 1, polylines: true}) // return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) // }) -// client.departures('2200005', {duration: 1, stopovers: true}) +// client.departures('2200005', {duration: 1}) // client.arrivals('2200005', {duration: 10, linesOfStops: true}) // client.locations('kirchweg', {results: 2}) // client.stop('2200005', {linesOfStops: true}) // Kassel Kirchweg diff --git a/p/oebb/example.js b/p/oebb/example.js index e06c6bdb..1f520897 100644 --- a/p/oebb/example.js +++ b/p/oebb/example.js @@ -7,6 +7,15 @@ const client = createClient(oebbProfile, 'hafas-client-example') // Wien Westbahnhof to Salzburg Hbf client.journeys('1291501', '8100002', {results: 1}) +// .then(({journeys}) => { +// const leg = journeys[0].legs[0] +// return client.trip(leg.tripId, leg.line.name) +// }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) + // client.departures('8100002', {duration: 1}) // client.arrivals('8100002', {duration: 10, linesOfStops: true}) // client.locations('Salzburg', {results: 2}) diff --git a/p/rsag/example.js b/p/rsag/example.js index b46dc555..2db22243 100644 --- a/p/rsag/example.js +++ b/p/rsag/example.js @@ -15,6 +15,18 @@ const albertEinsteinStr = { } client.journeys(rostockHbf, güstrow, {results: 1}) + +// .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, leg.line.name, {polyline: true}) +// }) + // client.departures(rostockHbf, {duration: 1}) // client.arrivals(rostockHbf, {duration: 10, linesOfStops: true}) // client.locations('güstrow', {results: 2}) @@ -31,12 +43,6 @@ client.journeys(rostockHbf, güstrow, {results: 1}) // maxDuration: 10 // }) -// .then(({journeys}) => { -// const [journey] = journeys -// const leg = journey.legs[0] -// return client.trip(leg.tripId, leg.line.name, {polyline: true}) -// }) - .then((data) => { console.log(require('util').inspect(data, {depth: null, colors: true})) }) diff --git a/p/sbb/example.js b/p/sbb/example.js index 51492d77..93238d8f 100644 --- a/p/sbb/example.js +++ b/p/sbb/example.js @@ -16,6 +16,14 @@ const locBaden = { type: 'location', latitude: 47.476, longitude: 8.30613 } // client.journeys(zurich1, basel1, { results: 1 }) // client.journeys(zurich2, basel2, { results: 1 }) client.journeys(baden1, baden2, { results: 1 }) +// .then(({journeys}) => { +// const leg = journeys[0].legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) +// .then(({journeys}) => { +// return client.refreshJourney(journeys[0].refreshToken, {remarks: true}) +// }) + // client.departures(zurich2, {duration: 1}) // client.arrivals(zurich2, {duration: 10, linesOfStops: true}) // client.locations('Basel', { results: 2 }) diff --git a/p/sncb/example.js b/p/sncb/example.js index 6f5a23cc..91c1011e 100644 --- a/p/sncb/example.js +++ b/p/sncb/example.js @@ -13,7 +13,7 @@ const gentPaddenhoek = { latitude: 51.0517, longitude: 3.724878, } -// client.journeys(gentStPieters, bruxellesMidi, {stopovers: true, remarks: true}) +client.journeys(gentStPieters, bruxellesMidi, {stopovers: true, remarks: true}) // .then(({journeys}) => { // const leg = journeys[0].legs[0] // return client.trip(leg.tripId, leg.line.name, {polyline: true}) diff --git a/p/svv/example.js b/p/svv/example.js index 8c8aeff2..d918ffae 100644 --- a/p/svv/example.js +++ b/p/svv/example.js @@ -30,12 +30,6 @@ client.journeys(sam, volksgarten, {results: 1, polylines: true}) // client.locations('salzburg sam', {results: 2}) // client.stop(sam, {linesOfStops: true}) // Dammtor // client.nearby(zillnerstr2) -// client.radar({ -// north: 47.815, -// west: 13.007, -// south: 47.792, -// east: 13.059 -// }, {results: 10}) // client.reachableFrom(zillnerstr2, { // when: new Date('2020-06-01T10:00:00+0200'), // }) diff --git a/p/vbn/example.js b/p/vbn/example.js index 2b469556..1fa5c2a7 100644 --- a/p/vbn/example.js +++ b/p/vbn/example.js @@ -15,6 +15,18 @@ const bremenRutenstr = { } client.journeys(bremerhavenHbf, verden, {results: 1}) + +// .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, leg.line.name, {polyline: true}) +// }) + // client.departures(bremerhavenHbf, {duration: 1}) // client.arrivals(bremerhavenHbf, {duration: 10, linesOfStops: true}) // client.locations('oldenburg', {results: 2}) @@ -31,17 +43,6 @@ client.journeys(bremerhavenHbf, verden, {results: 1}) // maxDuration: 10 // }) -// .then(({journeys}) => { -// const [journey] = journeys -// const leg = journey.legs[0] -// return client.trip(leg.tripId, leg.line.name, {polyline: true}) -// }) - -// .then(({journeys}) => { -// const [journey] = journeys -// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) -// }) - .then((data) => { console.log(require('util').inspect(data, {depth: null, colors: true})) }) diff --git a/p/vmt/example.js b/p/vmt/example.js index fd566e64..55d75eec 100644 --- a/p/vmt/example.js +++ b/p/vmt/example.js @@ -6,7 +6,7 @@ const vmtProfile = require('.') const client = createClient(vmtProfile, 'hafas-client-example') const jena = '190014' -const gothaZOB = '167049' +const gothaZOB = '167280' client.journeys(jena, gothaZOB, {results: 1}) // client.departures(jena) diff --git a/p/vrn/example.js b/p/vrn/example.js index 1393e6aa..fd9865db 100644 --- a/p/vrn/example.js +++ b/p/vrn/example.js @@ -8,7 +8,7 @@ const client = createClient(hvvProfile, 'hafas-client-example') const ludwigshafen = '8000236' const meckesheim = '8003932' -// client.journeys(ludwigshafen, meckesheim, {results: 1, polylines: true}) +client.journeys(ludwigshafen, meckesheim, {results: 1, polylines: true}) // .then(({journeys}) => { // const leg = journeys[0].legs[0] // return client.trip(leg.tripId, leg.line.name, {polyline: true}) diff --git a/p/vsn/example.js b/p/vsn/example.js index 30d613f2..13292332 100644 --- a/p/vsn/example.js +++ b/p/vsn/example.js @@ -5,10 +5,22 @@ const vsnProfile = require('.') const client = createClient(vsnProfile, 'hafas-client-example') -// client.journeys('9033961', '9033962', {results: 1, polylines: true}) +client.journeys('9033961', '9033962', {results: 1, polylines: true}) + +// .then(({journeys}) => { +// const [journey] = journeys +// const leg = journey.legs[0] +// return client.trip(leg.tripId, leg.line.name, {polyline: true}) +// }) + +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) + // client.departures('9033961', {duration: 1}) // client.arrivals('9033961', {duration: 10, linesOfStops: true}) -client.locations('jugendherberge', {results: 2}) +// client.locations('jugendherberge', {results: 2}) // client.stop('9033961', {linesOfStops: true}) // client.nearby({ // type: 'location', @@ -30,17 +42,6 @@ client.locations('jugendherberge', {results: 2}) // when: new Date('2019-05-16T10:00:00+0200'), // maxDuration: 8 // }) - -// .then(({journeys}) => { -// const [journey] = journeys -// const leg = journey.legs[0] -// return client.trip(leg.tripId, leg.line.name, {polyline: true}) -// }) - -// .then(({journeys}) => { -// const [journey] = journeys -// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) -// }) .then((data) => { console.log(require('util').inspect(data, {depth: null, colors: true})) }) diff --git a/p/zvv/example.js b/p/zvv/example.js index 7e84c207..8d399a02 100644 --- a/p/zvv/example.js +++ b/p/zvv/example.js @@ -15,12 +15,18 @@ client.locations('bürkli', {results: 2}) // }, {distance: 60}) // client.journeys(bürkliplatz, '8591123', {results: 1, polylines: true}) + // .then(({journeys}) => { // const [journey] = journeys // const leg = journey.legs[0] // return client.trip(leg.tripId, leg.line.name, {polyline: true}) // }) +// .then(({journeys}) => { +// const [journey] = journeys +// return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true}) +// }) + // client.departures(bürkliplatz, {duration: 1}) // client.arrivals(bürkliplatz, {duration: 10, linesOfStops: true}) // client.stop(bürkliplatz, {linesOfStops: true}) // Dammtor