diff --git a/p/vos/example.js b/p/vos/example.js new file mode 100644 index 00000000..8c788cce --- /dev/null +++ b/p/vos/example.js @@ -0,0 +1,53 @@ +'use strict' + +const createClient = require('../..') +const vosProfile = require('.') + +const client = createClient(vosProfile, 'hafas-client-example') + +const saarplatz = '9071733' +const finkenweg = '9071574' + +// client.journeys(saarplatz, finkenweg, {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, leg.line.name, {polyline: true}) +// }) + +// client.departures(saarplatz, {duration: 1}) +// client.arrivals(saarplatz, {duration: 10, linesOfStops: true}) +// client.radar({ +// north: 52.283258, +// west: 8.039188, +// south: 52.263653, +// east: 8.07225, +// }, {results: 10}) + +// client.locations('finkenweg', {results: 3}) +// client.stop(saarplatz, {linesOfStops: true}) +// client.nearby({ +// type: 'location', +// latitude: 53.554422, +// longitude: 9.977934 +// }, {distance: 500}) +// client.reachableFrom({ +// type: 'location', +// id: '990121407', +// address: 'Osnabrück Sandstraße 20', +// latitude: 52.266313, +// longitude: 8.033255, +// }, { +// maxDuration: 8, +// }) + +.then((data) => { + console.log(require('util').inspect(data, {depth: null, colors: true})) +}) +.catch(console.error) diff --git a/p/vos/index.js b/p/vos/index.js new file mode 100644 index 00000000..f6b800b4 --- /dev/null +++ b/p/vos/index.js @@ -0,0 +1,100 @@ +'use strict' + +const products = [{ + id: 'ice', + mode: 'train', + bitmasks: [1], + name: 'ICE', + short: 'ICE', + default: true, +}, { + id: 'national-train', + mode: 'train', + bitmasks: [2], + name: 'IC/EC', + short: 'IC/EC', + default: true, +}, { + id: 'express-train', + mode: 'train', + bitmasks: [4], + name: 'IR, sonstiger Schnellzug', + short: 'IR', + default: true, +}, { + id: 'local-train', + mode: 'train', + bitmasks: [8], + name: 'Nahverkehr', + short: 'Nahverkehr', + default: true, +}, { + id: 'suburban-train', + mode: 'train', + bitmasks: [16], + name: 'S-Bahn', + short: 'S', + default: true, +}, { + id: 'bus', + mode: 'bus', + bitmasks: [32], + name: 'Bus', + short: 'Bus', + default: true, +}, { + id: 'ferry', + mode: 'watercraft', + bitmasks: [64], + name: 'Schiff', + short: 'Schiff', + default: true, +}, { + id: 'subway', + mode: 'train', + bitmasks: [128], + name: 'U-Bahn', + short: 'U', + default: true, +}, { + id: 'tram', + mode: 'train', + bitmasks: [256], + name: 'Tram', + short: 'T', + default: true, +}, { + id: 'on-call', + mode: 'taxi', + bitmasks: [512], + name: 'Anrufverkehr', + short: 'AST', + default: true, +}] + +const vosProfile = { + locale: 'de-DE', + timezone: 'Europe/Berlin', + endpoint: 'https://fahrplan.vos.info/bin/mgate.exe', + + auth: { + type: 'AID', + aid: 'PnYowCQP7Tp1V', + }, + client: { + id: 'SWO', + type: 'WEB', + name: 'webapp', + l: 'vs_swo', + }, + ver: '1.32', + + products, + + trip: true, + radar: true, + refreshJourney: false, // todo: depends on 8615b85 from #204 + reachableFrom: true, +} + +module.exports = vosProfile diff --git a/p/vos/readme.md b/p/vos/readme.md new file mode 100644 index 00000000..69928647 --- /dev/null +++ b/p/vos/readme.md @@ -0,0 +1,13 @@ +# VOS profile for `hafas-client` + +[*Verkehrsgemeinschaft Osnabrück (VOS)*](https://de.wikipedia.org/wiki/Verkehrsgemeinschaft_Osnabrück) is the local transport provider of [Osnabrück](https://en.wikipedia.org/wiki/Osnabrück). This profile adds *VOS* support to `hafas-client`. + +## Usage + +```js +const createClient = require('hafas-client') +const vosProfile = require('hafas-client/p/VOS') + +// create a client with VOS profile +const client = createClient(vosProfile, 'my-awesome-program') +``` diff --git a/readme.md b/readme.md index a5f886c8..5320f3d8 100644 --- a/readme.md +++ b/readme.md @@ -231,6 +231,7 @@ HAFAS endpoint | wrapper library | docs | example code | source code [Verkehrsverbund Rhein-Neckar (VRN)](https://en.wikipedia.org/wiki/Verkehrsverbund_Rhein-Neckar) | - | [docs](p/vrn/readme.md) | [example code](p/vrn/example.js) | [src](p/vrn/index.js) [Rostocker Straßenbahn AG (RSAG)](https://de.wikipedia.org/wiki/Rostocker_Straßenbahn_AG) | - | [docs](p/rsag/readme.md) | [example code](p/rsag/example.js) | [src](p/rsag/index.js) [Verkehrsverbund Mittelthüringen (VMT)](https://en.wikipedia.org/wiki/Verkehrsverbund_Mittelthüringen) | - | [docs](p/vmt/readme.md) | [example code](p/vmt/example.js) | [src](p/vmt/index.js) +[Verkehrsgemeinschaft Osnabrück (VOS)](https://de.wikipedia.org/wiki/Verkehrsgemeinschaft_Osnabrück) | - | [docs](p/vos/readme.md) | [example code](p/vos/example.js) | [src](p/vos/index.js) [Salzburg public transport (SVV)](https://de.wikipedia.org/wiki/Salzburger_Verkehrsverbund) | - | [docs](p/svv/readme.md) | [example code](p/svv/example.js) | [src](p/svv/index.js) [Zürich public transport (ZVV)](https://en.wikipedia.org/wiki/Zürcher_Verkehrsverbund) | - | [docs](p/zvv/readme.md) | [example code](p/zvv/example.js) | [src](p/zvv/index.js)