diff --git a/example.js b/example.js index 701c60e..1b1f037 100644 --- a/example.js +++ b/example.js @@ -12,8 +12,8 @@ const hafas = createHafas('bvg-hafas-example') // retryOpts: {retries: 2} // }) -const spichernstr = '900000042101' -const bismarckstr = '900000024201' +const spichernstr = '900042101' +const bismarckstr = '900024201' // let data = await hafas.locations('Alexanderplatz', {results: 2}) // let data = await hafas.nearby(52.5137344, 13.4744798, {distance: 60}) diff --git a/index.js b/index.js index adee102..6e59503 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ -import createHafasClient from 'hafas-client' -import bvgProfile from 'hafas-client/p/bvg/index.js' +import {createClient} from 'hafas-client' +import {profile as bvgProfile} from 'hafas-client/p/bvg/index.js' const defaults = { profile: bvgProfile @@ -10,7 +10,7 @@ const createBvgHafas = (userAgent, opt = {}) => { profile, } = {...defaults, ...opt} - return createHafasClient(profile, userAgent) + return createClient(profile, userAgent) } export { diff --git a/package.json b/package.json index bfc6cd0..d0b47de 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "node": ">=18" }, "dependencies": { - "hafas-client": "^5.0.1" + "hafas-client": "^6.0.1" }, "devDependencies": { "eslint": "^8.30.0" diff --git a/readme.md b/readme.md index cc9b3d2..ced5d5d 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ **A client for the [HAFAS](https://de.wikipedia.org/wiki/HAFAS) endpoint of [*Berliner Verkehrsbetriebe* (BVG)](https://en.wikipedia.org/wiki/Berliner_Verkehrsbetriebe), the largest public transport provider in Berlin.** It acts as a consistent and straightforward interface on top of their verbose API. -This project is actually a thin wrapper around [`hafas-client@5`](https://github.com/public-transport/hafas-client/tree/5#hafas-client). [Its docs](https://github.com/public-transport/hafas-client/tree/5/docs) document the API in general. +This project is actually a thin wrapper around [`hafas-client@6`](https://github.com/public-transport/hafas-client/tree/6#hafas-client). [Its docs](https://github.com/public-transport/hafas-client/tree/6/docs) document the API in general. *Note*: The BVG HAFAS endpoint covers Brandenburg as well. @@ -21,7 +21,7 @@ npm install bvg-hafas ## API -Check [the docs for `hafas-client@5`](https://github.com/public-transport/hafas-client/tree/5/docs) as well as [its BVG-specific customisations](https://github.com/public-transport/hafas-client/tree/5/p/bvg). +Check [the docs for `hafas-client@6`](https://github.com/public-transport/hafas-client/tree/6/docs) as well as [its BVG-specific customisations](https://github.com/public-transport/hafas-client/tree/6/p/bvg). ## Usage @@ -32,10 +32,10 @@ import {createBvgHafas} from 'bvg-hafas' const client = createBvgHafas('my-awesome-program') ``` -As an example, we will search for a route from *Berlin Jungfernheide* to *Tempelhof*. To get the station IDs, use [`locations(query, [opt])`](https://github.com/public-transport/hafas-client/blob/5/docs/locations.md). +As an example, we will search for a route from *Berlin Jungfernheide* to *Tempelhof*. To get the station IDs, use [`locations(query, [opt])`](https://github.com/public-transport/hafas-client/blob/6/docs/locations.md). ```javascript -const journeys = await client.journeys('900000020201', '900000068201', { +const journeys = await client.journeys('900020201', '900068201', { results: 1, }) console.log(journeys[0]) @@ -50,7 +50,7 @@ The output will be an array of [`journey` objects in the *Friendly Public Transp id: '1|62072|0|86|14082018', origin: { type: 'stop', - id: '900000020201', + id: '900020201', name: 'S+U Jungfernheide', location: { type: 'location', @@ -72,7 +72,7 @@ The output will be an array of [`journey` objects in the *Friendly Public Transp departureDelay: 0, destination: { type: 'stop', - id: '900000068201', + id: '900068201', name: 'S+U Tempelhof', location: { type: 'location', @@ -104,7 +104,7 @@ The output will be an array of [`journey` objects in the *Friendly Public Transp ## Related -Check [`hafas-client`'s related projects](https://github.com/public-transport/hafas-client/blob/5/readme.md#related-projects). +Check [`hafas-client`'s related projects](https://github.com/public-transport/hafas-client/blob/6/readme.md#related-projects). ## Contributing diff --git a/retry.js b/retry.js index 3f552f4..36e4fc5 100644 --- a/retry.js +++ b/retry.js @@ -1,6 +1,6 @@ -import createClient from 'hafas-client' -import withRetrying from 'hafas-client/retry.js' -import bvgProfile from 'hafas-client/p/bvg/index.js' +import {createClient} from 'hafas-client' +import {withRetrying} from 'hafas-client/retry.js' +import {profile as bvgProfile} from 'hafas-client/p/bvg/index.js' const createRetryingClient = (userAgent, opt = {}) => { const {retryOpts} = {retryOpts: {}, ...opt} diff --git a/throttle.js b/throttle.js index 591962c..dc9f8dd 100644 --- a/throttle.js +++ b/throttle.js @@ -1,6 +1,6 @@ -import createClient from 'hafas-client' -import withThrottling from 'hafas-client/throttle.js' -import bvgProfile from 'hafas-client/p/bvg/index.js' +import {createClient} from 'hafas-client' +import {withThrottling} from 'hafas-client/throttle.js' +import {profile as bvgProfile} from 'hafas-client/p/bvg/index.js' const createThrottledClient = (userAgent, opt = {}) => { const {