Skip to content

Commit

Permalink
hafas-client@6 πŸ’₯πŸ“
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Dec 28, 2022
1 parent 84fb57b commit 49f6a0c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,7 +10,7 @@ const createBvgHafas = (userAgent, opt = {}) => {
profile,
} = {...defaults, ...opt}

return createHafasClient(profile, userAgent)
return createClient(profile, userAgent)
}

export {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"node": ">=18"
},
"dependencies": {
"hafas-client": "^5.0.1"
"hafas-client": "^6.0.1"
},
"devDependencies": {
"eslint": "^8.30.0"
Expand Down
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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])
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions retry.js
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
6 changes: 3 additions & 3 deletions throttle.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 49f6a0c

Please sign in to comment.