| 
									
										
										
										
											2017-11-18 17:53:12 +01:00
										 |  |  | 'use strict' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const createClient = require('../..') | 
					
						
							|  |  |  | const vbbProfile = require('.') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-19 21:55:03 +02:00
										 |  |  | const client = createClient(vbbProfile, 'hafas-client-example') | 
					
						
							| 
									
										
										
										
											2017-11-18 17:53:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-17 18:16:04 +01:00
										 |  |  | // Hauptbahnhof to Charlottenburg
 | 
					
						
							| 
									
										
										
										
											2018-04-30 12:49:33 +02:00
										 |  |  | client.journeys('900000003201', '900000024101', {results: 1, polylines: true}) | 
					
						
							| 
									
										
										
										
											2017-11-18 17:53:12 +01:00
										 |  |  | // client.departures('900000013102', {duration: 1})
 | 
					
						
							| 
									
										
										
										
											2018-06-28 13:00:33 +02:00
										 |  |  | // client.arrivals('900000013102', {duration: 10, stationLines: true})
 | 
					
						
							| 
									
										
										
										
											2017-11-18 17:53:12 +01:00
										 |  |  | // client.locations('Alexanderplatz', {results: 2})
 | 
					
						
							| 
									
										
										
										
											2018-06-28 13:00:33 +02:00
										 |  |  | // client.station('900000042101', {stationLines: true}) // Spichernstr
 | 
					
						
							| 
									
										
										
										
											2018-06-28 12:08:54 +02:00
										 |  |  | // client.nearby({
 | 
					
						
							|  |  |  | // 	type: 'location',
 | 
					
						
							|  |  |  | // 	latitude: 52.5137344,
 | 
					
						
							|  |  |  | // 	longitude: 13.4744798
 | 
					
						
							|  |  |  | // }, {distance: 60})
 | 
					
						
							| 
									
										
										
										
											2018-03-16 17:28:48 +01:00
										 |  |  | // client.radar({
 | 
					
						
							|  |  |  | // 	north: 52.52411,
 | 
					
						
							|  |  |  | // 	west: 13.41002,
 | 
					
						
							|  |  |  | // 	south: 52.51942,
 | 
					
						
							|  |  |  | // 	east: 13.41709
 | 
					
						
							|  |  |  | // }, {results: 10})
 | 
					
						
							| 
									
										
										
										
											2018-08-26 18:35:27 +02:00
										 |  |  | // client.reachableFrom({
 | 
					
						
							|  |  |  | // 	type: 'location',
 | 
					
						
							|  |  |  | // 	address: '13353 Berlin-Wedding, Torfstr. 17',
 | 
					
						
							|  |  |  | // 	latitude: 52.541797,
 | 
					
						
							|  |  |  | // 	longitude: 13.350042
 | 
					
						
							|  |  |  | // }, {
 | 
					
						
							|  |  |  | // 	when: new Date('2018-08-27T10:00:00+0200'),
 | 
					
						
							|  |  |  | // 	maxDuration: 10
 | 
					
						
							|  |  |  | // })
 | 
					
						
							| 
									
										
										
										
											2017-12-17 18:16:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 13:12:05 +02:00
										 |  |  | // .then(([journey]) => {
 | 
					
						
							|  |  |  | // 	const leg = journey.legs[0]
 | 
					
						
							| 
									
										
										
										
											2018-06-29 15:05:29 +02:00
										 |  |  | // 	return client.trip(leg.id, leg.line.name, {polyline: true})
 | 
					
						
							| 
									
										
										
										
											2018-04-30 13:12:05 +02:00
										 |  |  | // })
 | 
					
						
							| 
									
										
										
										
											2018-07-24 18:16:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // .then(([journey]) => {
 | 
					
						
							|  |  |  | // 	return client.refreshJourney(journey.refreshToken, {stopovers: true, remarks: true})
 | 
					
						
							|  |  |  | // })
 | 
					
						
							| 
									
										
										
										
											2017-11-18 17:53:12 +01:00
										 |  |  | .then((data) => { | 
					
						
							| 
									
										
										
										
											2018-12-10 14:38:07 +01:00
										 |  |  | 	console.log(require('util').inspect(data, {depth: null, colors: true})) | 
					
						
							| 
									
										
										
										
											2017-12-17 18:16:04 +01:00
										 |  |  | }) | 
					
						
							|  |  |  | .catch(console.error) |