diff --git a/docs/departures.md b/docs/departures.md index d13d8364..113c942a 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -62,28 +62,8 @@ The response may look like this: ```js [ { tripId: '1|31431|28|86|17122017', - stop: { - type: 'station', - id: '900000024101', - name: 'S Charlottenburg', - location: { - type: 'location', - latitude: 52.504806, - longitude: 13.303846 - }, - products: { - suburban: true, - subway: false, - tram: false, - bus: true, - ferry: false, - express: false, - regional: true - } - }, - when: '2017-12-17T19:32:00+01:00', - delay: null, - platform: '2', + trip: 31431, + direction: 'S Spandau', line: { type: 'line', id: '18299', @@ -103,14 +83,37 @@ The response may look like this: name: 'S-Bahn Berlin GmbH' } }, - direction: 'S Spandau', - trip: 31431 -}, { - tripId: '1|30977|8|86|17122017', - stop: { /* … */ }, - when: null, + + stop: { + type: 'station', + id: '900000024101', + name: 'S Charlottenburg', + location: { + type: 'location', + latitude: 52.504806, + longitude: 13.303846 + }, + products: { + suburban: true, + subway: false, + tram: false, + bus: true, + ferry: false, + express: false, + regional: true + } + }, + + when: '2017-12-17T19:32:00+01:00', + plannedWhen: '2017-12-17T19:32:00+01:00', delay: null, + platform: '2', + plannedPlatform: '2' +}, { cancelled: true, + tripId: '1|30977|8|86|17122017', + trip: 30977, + direction: 'S Westkreuz', line: { type: 'line', id: '16441', @@ -126,15 +129,19 @@ The response may look like this: night: false, operator: { /* … */ } }, - direction: 'S Westkreuz', - trip: 30977 + + stop: { /* … */ }, + + when: null, + plannedWhen: '2017-12-17T19:33:00+01:00' + delay: null, + platform: null, + plannedPlatform: '2', + prognosedPlatform: '2' }, { tripId: '1|28671|4|86|17122017', trip: 28671, - stop: { /* … */ }, - when: '2017-12-17T19:35:00+01:00', - delay: 0, - platform: null, + direction: 'U Rudow', line: { type: 'line', id: '19494', @@ -150,6 +157,13 @@ The response may look like this: night: false, operator: { /* … */ } }, - direction: 'U Rudow' + + stop: { /* … */ }, + + when: '2017-12-17T19:35:00+01:00', + plannedWhen: '2017-12-17T19:35:00+01:00', + delay: 0, + platform: null, + plannedPlatform: null } ] ``` diff --git a/docs/journeys.md b/docs/journeys.md index 58676c74..32168610 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -104,42 +104,7 @@ The `Promise` returned by `journeys()` will resolve with an object with the `jou journeys: [ { legs: [ { tripId: '1|32615|6|86|10072018', - origin: { - type: 'station', - id: '900000003201', - name: 'S+U Berlin Hauptbahnhof', - location: { - type: 'location', - latitude: 52.52585, - longitude: 13.368928 - }, - products: { - suburban: true, - subway: true, - tram: true, - bus: true, - ferry: false, - express: true, - regional: true - } - }, - destination: { - type: 'station', - id: '900000100004', - name: 'S+U Jannowitzbrücke', - location: { - type: 'location', - latitude: 52.504806, - longitude: 13.303846 - }, - products: { /* … */ } - }, - departure: '2018-07-10T23:54:00+02:00', - departureDelay: 60, - departurePlatform: '15', - arrival: '2018-07-11T00:02:00+02:00', - arrivalDelay: 60, - arrivalPlatform: '3', + direction: 'S Ahrensfelde', line: { type: 'line', id: '16845', @@ -159,18 +124,66 @@ The `Promise` returned by `journeys()` will resolve with an object with the `jou express: false, night: false }, - direction: 'S Ahrensfelde', + + origin: { + type: 'station', + id: '900000003201', + name: 'S+U Berlin Hauptbahnhof', + location: { + type: 'location', + latitude: 52.52585, + longitude: 13.368928 + }, + products: { + suburban: true, + subway: true, + tram: true, + bus: true, + ferry: false, + express: true, + regional: true + } + }, + departure: '2018-07-10T23:54:00+02:00', + plannedDeparture: '2018-07-10T23:53:00+02:00', + departureDelay: 60, + departurePlatform: '15', + plannedDeparturePlatform: '14', + + destination: { + type: 'station', + id: '900000100004', + name: 'S+U Jannowitzbrücke', + location: { + type: 'location', + latitude: 52.504806, + longitude: 13.303846 + }, + products: { /* … */ } + }, + arrival: '2018-07-11T00:02:00+02:00', + plannedArrival: '2018-07-11T00:01:00+02:00', + arrivalDelay: 60, + arrivalPlatform: '3', + plannedArrivalPlatform: '3', + stopovers: [ { stop: { type: 'station', id: '900000003201', name: 'S+U Berlin Hauptbahnhof', - location: { /* … */ }, - products: { /* … */ } + /* … */ }, + arrival: null, + plannedArrival: null, + arrivalPlatform: null, + plannedArrivalPlatform: null, departure: null, - cancelled: true, + plannedDeparture: null, + departurePlatform: null, + plannedDeparturePlatform: null, + remarks: [ {type: 'hint', code: 'bf', text: 'barrier-free'}, {type: 'hint', code: 'FB', text: 'Bicycle conveyance'} @@ -180,34 +193,54 @@ The `Promise` returned by `journeys()` will resolve with an object with the `jou type: 'station', id: '900000100001', name: 'S+U Friedrichstr.', - location: { /* … */ }, - products: { /* … */ } + /* … */ }, - arrival: '2018-07-10T23:56:00+02:00', + + cancelled: true, + arrival: null, + plannedArrival: '2018-07-10T23:55:00+02:00', + prognosedArrival: '2018-07-10T23:56:00+02:00', arrivalDelay: 60, arrivalPlatform: null, - departure: '2018-07-10T23:57:00+02:00', + plannedArrivalPlatform: null, + + departure: null, + plannedDeparture: '2018-07-10T23:56:00+02:00', + prognosedDeparture: '2018-07-10T23:57:00+02:00', departureDelay: 60, departurePlatform: null, + plannedDeparturePlatform: null, + remarks: [ /* … */ ] }, /* … */ { + stop: { type: 'station', id: '900000100004', name: 'S+U Jannowitzbrücke', - location: { /* … */ }, - products: { /* … */ } + /* … */ }, + arrival: '2018-07-11T00:02:00+02:00', + plannedArrival: '2018-07-11T00:01:00+02:00', arrivalDelay: 60, arrivalPlatform: null, + plannedArrivalPlatform: null, + departure: '2018-07-11T00:02:00+02:00', + plannedDeparture: '2018-07-11T00:02:00+02:00', departureDelay: null, departurePlatform: null, + plannedDeparturePlatform: null, + remarks: [ /* … */ ] } ] }, { + public: true, + walking: true, + distance: 558, + origin: { type: 'station', id: '900000100004', @@ -215,6 +248,8 @@ The `Promise` returned by `journeys()` will resolve with an object with the `jou location: { /* … */ }, products: { /* … */ } }, + departure: '2018-07-11T00:01:00+02:00', + destination: { type: 'station', id: '900000100008', @@ -222,11 +257,7 @@ The `Promise` returned by `journeys()` will resolve with an object with the `jou location: { /* … */ }, products: { /* … */ } }, - departure: '2018-07-11T00:01:00+02:00', - arrival: '2018-07-11T00:10:00+02:00', - public: true, - walking: true, - distance: 558 + arrival: '2018-07-11T00:10:00+02:00' } ] } ], earlierRef: '…', // use with the `earlierThan` option diff --git a/docs/migrating-to-5.md b/docs/migrating-to-5.md index 18df3281..6b4a404a 100644 --- a/docs/migrating-to-5.md +++ b/docs/migrating-to-5.md @@ -1,5 +1,58 @@ # Migrating to `hafas-client@5` +## new fields for departure/arrival time & delays + +An arrival/departure now looks like this: + +```js +{ + when: null, // realtime/prognosed + plannedWhen: '2019-10-10T10:10+10:00', + platform: '3', // realtime/prognosed + plannedPlatform: '4' +} +``` + +A stopover/journey leg now will look like this: + +```js +{ + arrival: null, // realtime/prognosed + plannedArrival: '2019-10-10T10:10+10:00', + arrivalDelay: null, + arrivalPlatform: '3', // realtime/prognosed + plannedArrivalPlatform: '4', + + departure: '2019-10-10T10:12+10:00', // realtime/prognosed + plannedDeparture: '2019-10-10T10:10+10:00', + departureDelay: 120, // seconds + departurePlatform: null, // realtime/prognosed + plannedDeparturePlatform: null +} +``` + +If the same stopover/journey leg is `cancelled: true`, it will look like this: + +```js +{ + arrival: null, + prognosedArrival: null, + plannedArrival: '2019-10-10T10:10+10:00', + arrivalDelay: null, + arrivalPlatform: null, + prognosedArrivalPlatform: '3', + plannedArrivalPlatform: '4', + + departure: null, + prognosedDeparture: '2019-10-10T10:12+10:00', + plannedDeparture: '2019-10-10T10:10+10:00', + departureDelay: 120, // seconds + departurePlatform: null, + prognosedDeparturePlatform: null, + plannedDeparturePlatform: null +} +``` + ## If you use `journeys()`… …with the `walkingSpeed` option and a custom profile, add `journeysWalkingSpeed` to your profile. 937583e diff --git a/docs/radar.md b/docs/radar.md index cf25e5f4..6e94c423 100644 --- a/docs/radar.md +++ b/docs/radar.md @@ -89,9 +89,15 @@ The response may look like this: } }, arrival: null, + plannedArrival: null, arrivalDelay: null, - departure: '2017-12-17T19:16:00+01:00', - departureDelay: null + arrivalPlatform: null, + plannedArrivalPlatform: null, + departure: null, + plannedDeparture: '2017-12-17T19:16:00+01:00', + departureDelay: null, + departurePlatform: null, + plannedDeparturePlatform: '1' } /* … */ ], frames: [ { origin: { @@ -144,15 +150,23 @@ The response may look like this: nextStopovers: [ { stop: { /* S+U Alexanderplatz/Dircksenstr. */ }, arrival: null, + plannedArrival: null, arrivalDelay: null, - departure: '2017-12-17T19:52:00+01:00', + departure: null, + plannedAeparture: '2017-12-17T19:52:00+01:00', departureDelay: null }, { stop: { /* Memhardstr. */ }, - arrival: '2017-12-17T19:54:00+01:00', + arrival: null, + plannedArrival: '2017-12-17T19:54:00+01:00', arrivalDelay: null, - departure: '2017-12-17T19:54:00+01:00', - departureDelay: null + arrivalPlatform: null, + plannedArrivalPlatform: null, + departure: null, + plannedDeparture: '2017-12-17T19:54:00+01:00', + departureDelay: null, + departurePlatform: null, + plannedDeparturePlatform: '1' }, /* … */ ], frames: [ { origin: { /* S+U Alexanderplatz/Dircksenstr. */ }, diff --git a/docs/trip.md b/docs/trip.md index 1f19aa44..e1545f30 100644 --- a/docs/trip.md +++ b/docs/trip.md @@ -75,7 +75,11 @@ The response looked like this: } }, departure: '2017-12-17T18:37:00+01:00', + plannedDeparture: '2017-12-17T18:37:00+01:00', + departureDelay: null, departurePlatform: '13', + plannedDeparturePlatform: '13', + destination: { type: 'station', id: '900000029101', @@ -95,8 +99,11 @@ The response looked like this: regional: true } }, - arrival: '2017-12-17T19:49:00+01:00', - arrivalPlatform: '2', + arrival: '2017-12-17T19:50:30+01:00', + plannedArrival: '2017-12-17T19:49:00+01:00', + arrivalDelay: 90, + arrivalPlatform: '3a', + plannedArrivalPlatform: '2', line: { type: 'line', id: '18299', diff --git a/readme.md b/readme.md index d348be16..e5bc3f26 100644 --- a/readme.md +++ b/readme.md @@ -53,9 +53,11 @@ client.journeys('8011167', '8000261', {results: 1}) location: { /* … */ }, products: { /* … */ } }, - departure: '2019-12-17T17:05:30+01:00', + departure: '2017-12-19T17:05:30+01:00', + plannedDeparture: '2017-12-19T17:05:00+01:00', departureDelay: 30, departurePlatform: '5', + plannedDeparturePlatform: '5', destination: { type: 'station', @@ -64,9 +66,11 @@ client.journeys('8011167', '8000261', {results: 1}) location: { /* … */ }, products: { /* … */ } }, - arrival: '2019-12-17T22:44:00+01:00', + arrival: '2017-12-19T22:44:00+01:00', + plannedArrival: '2017-12-19T22:45:00+01:00', arrivalDelay: -60, arrivalPlatform: '11A', + plannedArrivalPlatform: '13', legs: [ { id: '1|100067|48|81|17122017', @@ -96,9 +100,11 @@ client.journeys('8011167', '8000261', {results: 1}) }, products: { /* … */ } }, - departure: '2019-12-17T17:05:30+01:00', + departure: '2017-12-19T17:05:30+01:00', + plannedDeparture: '2017-12-19T17:05:00+01:00', departureDelay: 30, departurePlatform: '5', + plannedDeparturePlatform: '5', destination: { type: 'station', @@ -106,9 +112,11 @@ client.journeys('8011167', '8000261', {results: 1}) name: 'Berlin Beusselstraße' /* … */ }, - arrival: '2019-12-17T17:08:00+01:00', + arrival: '2017-12-19T17:08:00+01:00', + plannedArrival: '2017-12-19T17:08:00+01:00', arrivalDelay: null, - arrivalPlatform: '2a-b' + arrivalPlatform: '2a-b', + plannedArrivalPlatform: '1' }, /* more legs… */ { @@ -121,7 +129,8 @@ client.journeys('8011167', '8000261', {results: 1}) name: 'Berlin Hauptbahnhof (S+U), Berlin' /* … */ }, - departure: '2019-12-17T17:25:00+01:00', + plannedDeparture: '2017-12-19T17:25:00+01:00', + prognosedDeparture: null, departureDelay: null, destination: { @@ -130,7 +139,8 @@ client.journeys('8011167', '8000261', {results: 1}) name: 'Berlin Hbf (tief)' /* … */ }, - arrival: '2019-12-17T17:33:00+01:00', + arrival: '2017-12-19T17:33:00+01:00', + plannedArrival: '2017-12-19T17:33:00+01:00', arrivalDelay: null }, { id: '1|70906|0|81|17122017', @@ -143,9 +153,11 @@ client.journeys('8011167', '8000261', {results: 1}) name: 'Berlin Hbf (tief)' /* … */ }, - departure: '2019-12-17T17:35:00+01:00', + departure: '2017-12-19T17:35:00+01:00', + plannedDeparture: '2017-12-19T17:37:00+01:00', departureDelay: -120, departurePlatform: '1', + plannedDeparturePlatform: '1', destination: { type: 'station', @@ -153,9 +165,11 @@ client.journeys('8011167', '8000261', {results: 1}) name: 'München Hbf', /* … */ }, - arrival: '2019-12-17T22:44:00+01:00', + arrival: '2017-12-19T22:44:00+01:00', + plannedArrival: '2017-12-19T22:45:00+01:00', arrivalDelay: -60, - arrivalPlatform: '11A' + arrivalPlatform: '11A', + plannedArrivalPlatform: '13' } ], price: { amount: null,