From 5910d6253579035d6a98667537f65426a9f91732 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 14 Mar 2023 20:32:50 +0100 Subject: [PATCH] =?UTF-8?q?docs:=20make=20user=20agent=20instructions=20mo?= =?UTF-8?q?re=20specific=20&=20actionable=20=F0=9F=93=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit related: #286 --- docs/departures.md | 6 ++++-- docs/journeys-from-trip.md | 5 +++-- docs/journeys.md | 3 ++- docs/lines.md | 3 ++- docs/locations.md | 3 ++- docs/nearby.md | 3 ++- docs/radar.md | 3 ++- docs/reachable-from.md | 3 ++- docs/readme.md | 24 ++++++++++++++++-------- docs/refresh-journey.md | 3 ++- docs/remarks.md | 3 ++- docs/server-info.md | 3 ++- docs/stop.md | 3 ++- docs/trip.md | 3 ++- docs/trips-by-name.md | 3 ++- p/avv/readme.md | 4 +++- p/bart/readme.md | 4 +++- p/bls/readme.md | 4 +++- p/bvg/readme.md | 4 +++- p/cfl/readme.md | 4 +++- p/cmta/readme.md | 4 +++- p/dart/readme.md | 4 +++- p/db-busradar-nrw/readme.md | 4 +++- p/db/readme.md | 4 +++- p/insa/readme.md | 4 +++- p/invg/readme.md | 4 +++- p/irish-rail/readme.md | 4 +++- p/ivb/readme.md | 4 +++- p/kvb/readme.md | 4 +++- p/mobil-nrw/readme.md | 4 +++- p/mobiliteit-lu/readme.md | 4 +++- p/nahsh/readme.md | 4 +++- p/nvv/readme.md | 4 +++- p/oebb/readme.md | 4 +++- p/ooevv/readme.md | 4 +++- p/pkp/readme.md | 4 +++- p/rejseplanen/readme.md | 4 +++- p/rmv/readme.md | 4 +++- p/rsag/readme.md | 4 +++- p/saarfahrplan/readme.md | 4 +++- p/salzburg/readme.md | 4 +++- p/sbahn-muenchen/readme.md | 4 +++- p/sncb/readme.md | 4 +++- p/stv/readme.md | 4 +++- p/svv/readme.md | 4 +++- p/tpg/readme.md | 4 +++- p/vbb/readme.md | 4 +++- p/vbn/readme.md | 4 +++- p/vkg/readme.md | 4 +++- p/vmt/readme.md | 4 +++- p/vor/readme.md | 4 +++- p/vos/readme.md | 4 +++- p/vrn/readme.md | 4 +++- p/vsn/readme.md | 4 +++- p/vvt/readme.md | 4 +++- p/vvv/readme.md | 4 +++- p/zvv/readme.md | 4 +++- readme.md | 8 ++++++-- 58 files changed, 179 insertions(+), 68 deletions(-) diff --git a/docs/departures.md b/docs/departures.md index fcb0909b..4b7e3763 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -46,7 +46,8 @@ If you pass an object `opt.products`, its fields will partially override the def import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) // will query with these products: suburban, subway, bus, express, regional await client.departures('900000024101', {products: {tram: false, ferry: false}}) @@ -64,7 +65,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) // S Charlottenburg const { diff --git a/docs/journeys-from-trip.md b/docs/journeys-from-trip.md index 8582bd33..f9b9febf 100644 --- a/docs/journeys-from-trip.md +++ b/docs/journeys-from-trip.md @@ -25,12 +25,13 @@ As an example, we're going to use the [*Deutsche Bahn* profile](../p/db): import {createClient} from 'hafas-client' import {profile as dbProfile} from 'hafas-client/p/db/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(dbProfile, userAgent) + const berlinSüdkreuz = '8011113' const münchenHbf = '8000261' const kölnHbf = '8000207' -const client = createClient(dbProfile, 'my-awesome-program') - // find any journey from Berlin Südkreuz to München Hbf const [journey] = await client.journeys(berlinSüdkreuz, münchenHbf, {results: 1, stopovers: true}) // find the ICE leg diff --git a/docs/journeys.md b/docs/journeys.md index e9a1b9fb..115d2b72 100644 --- a/docs/journeys.md +++ b/docs/journeys.md @@ -88,7 +88,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) // Hauptbahnhof to Heinrich-Heine-Str. await client.journeys('900000003201', '900000100008', { diff --git a/docs/lines.md b/docs/lines.md index b7792f8c..34d86da1 100644 --- a/docs/lines.md +++ b/docs/lines.md @@ -10,7 +10,8 @@ As an example, we're going to use the [SVV profile](../p/svv): import {createClient} from 'hafas-client' import {profile as svvProfile} from 'hafas-client/p/svv/index.js' -const client = createClient(svvProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(svvProfile, userAgent) const { lines, diff --git a/docs/locations.md b/docs/locations.md index 2903de56..8ddda6b2 100644 --- a/docs/locations.md +++ b/docs/locations.md @@ -26,7 +26,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) await client.locations('Alexanderplatz', {results: 3}) ``` diff --git a/docs/nearby.md b/docs/nearby.md index d5fe0f6d..26bb8d98 100644 --- a/docs/nearby.md +++ b/docs/nearby.md @@ -27,7 +27,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) await client.nearby({ type: 'location', diff --git a/docs/radar.md b/docs/radar.md index b3bc614d..5139bd59 100644 --- a/docs/radar.md +++ b/docs/radar.md @@ -28,7 +28,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) const { movements, diff --git a/docs/reachable-from.md b/docs/reachable-from.md index 403ca0dc..db096e64 100644 --- a/docs/reachable-from.md +++ b/docs/reachable-from.md @@ -34,7 +34,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) const { reachable, diff --git a/docs/readme.md b/docs/readme.md index 506ad1de..6309b542 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -15,19 +15,21 @@ import {createClient} from 'hafas-client' import {withThrottling} from 'hafas-client/throttle.js' import {profile as dbProfile} from 'hafas-client/p/db/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a throttled HAFAS client with Deutsche Bahn profile -const client = createClient(withThrottling(dbProfile), 'my-awesome-program') +const client = createClient(withThrottling(dbProfile), userAgent) // Berlin Jungfernheide to München Hbf await client.journeys('8011167', '8000261', {results: 1}) ``` -You can pass custom values for the nr of requests (`limit`) per interval into `withThrottling`: +You can also pass custom values for the nr of requests (`limit`) per interval into `withThrottling`: ```js // 2 requests per second const throttledDbProfile = withThrottling(dbProfile, 2, 1000) -const client = createClient(throttledDbProfile, 'my-awesome-program') +const client = createClient(throttledDbProfile, userAgent) ``` ## Retrying failed requests @@ -39,8 +41,10 @@ import {createClient} from 'hafas-client' import {withRetrying} from 'hafas-client/retry.js' import {profile as dbProfile} from 'hafas-client/p/db/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with Deutsche Bahn profile that will retry on HAFAS errors -const client = createClient(withRetrying(dbProfile), 'my-awesome-program') +const client = createClient(withRetrying(dbProfile), userAgent) ``` You can pass custom options into `withRetrying`. They will be passed into [`retry`](https://github.com/tim-kos/node-retry#tutorial). @@ -52,7 +56,7 @@ const retryingDbProfile = withRetrying(dbProfile, { minTimeout: 10 * 1000, factor: 3 }) -const client = createClient(retryingDbProfile, 'my-awesome-program') +const client = createClient(retryingDbProfile, userAgent) ``` ## User agent randomization @@ -62,7 +66,9 @@ By default, `hafas-client` randomizes the client name that you pass into `create ```js import {createClient} from 'hafas-client' // … -const client = createClient(someProfile, 'my-awesome-program') + +const userAgent = 'my-awesome-program' +const client = createClient(someProfile, userAgent) await client.journeys(/* … */) // User-Agent: my-awee70429some-pre70429ogram @@ -76,7 +82,7 @@ You can turn this off by setting `profile.randomizeUserAgent` to `false`: const client = createClient({ ...someProfile, randomizeUserAgent: false, -}, 'my-awesome-program') +}, userAgent) ``` ## Logging requests @@ -89,6 +95,8 @@ As an example, we can implement a custom logger: import {createClient} from 'hafas-client' import {profile as dbProfile} from 'hafas-client/p/db/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + const logRequest = (ctx, fetchRequest, requestId) => { // ctx looks just like with the other profile.* hooks: const {dbProfile, opt} = ctx @@ -105,7 +113,7 @@ const client = createClient({ ...dbProfile, logRequest, logResponse, -}, 'my-awesome-program') +}, userAgent) ``` ```js diff --git a/docs/refresh-journey.md b/docs/refresh-journey.md index 301ac90c..c5e9be06 100644 --- a/docs/refresh-journey.md +++ b/docs/refresh-journey.md @@ -24,7 +24,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile) +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) // Hauptbahnhof to Heinrich-Heine-Str. const {journeys} = await client.journeys('900000003201', '900000100008', {results: 1}) diff --git a/docs/remarks.md b/docs/remarks.md index df372fdf..8f06f5ab 100644 --- a/docs/remarks.md +++ b/docs/remarks.md @@ -23,7 +23,8 @@ As an example, we're going to use the [SVV profile](../p/svv): import {createClient} from 'hafas-client' import {profile as svvProfile} from 'hafas-client/p/svv/index.js' -const client = createClient(svvProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(svvProfile, userAgent) const { remarks, diff --git a/docs/server-info.md b/docs/server-info.md index f0aa5ab9..eea4d651 100644 --- a/docs/server-info.md +++ b/docs/server-info.md @@ -19,7 +19,8 @@ As an example, we're going to use the [SVV profile](../p/svv): import {createClient} from 'hafas-client' import {profile as svvProfile} from 'hafas-client/p/svv/index.js' -const client = createClient(svvProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(svvProfile, userAgent) await client.serverInfo() ``` diff --git a/docs/stop.md b/docs/stop.md index 45d28584..fd2f3c1b 100644 --- a/docs/stop.md +++ b/docs/stop.md @@ -38,7 +38,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) await client.stop('900000042101') // U Spichernstr. ``` diff --git a/docs/trip.md b/docs/trip.md index 56e12ab8..16266518 100644 --- a/docs/trip.md +++ b/docs/trip.md @@ -10,7 +10,8 @@ Let's say you used [`journeys`](journeys.md) and now want to get more up-to-date import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) // Hauptbahnhof to Heinrich-Heine-Str. const {journeys} = client.journeys('900000003201', '900000100008', {results: 1}) diff --git a/docs/trips-by-name.md b/docs/trips-by-name.md index 894fd2dd..3a74bfb1 100644 --- a/docs/trips-by-name.md +++ b/docs/trips-by-name.md @@ -10,7 +10,8 @@ As an example, we're going to use the [VBB profile](../p/vbb): import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' -const client = createClient(vbbProfile, 'my-awesome-program') +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! +const client = createClient(vbbProfile, userAgent) const { trips, diff --git a/p/avv/readme.md b/p/avv/readme.md index c69954de..b7afc5ca 100644 --- a/p/avv/readme.md +++ b/p/avv/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as avvProfile} from 'hafas-client/p/avv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with AVV profile -const client = createClient(avvProfile, 'my-awesome-program') +const client = createClient(avvProfile, userAgent) ``` diff --git a/p/bart/readme.md b/p/bart/readme.md index b13210f4..0b3b940a 100644 --- a/p/bart/readme.md +++ b/p/bart/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as bartProfile} from 'hafas-client/p/bart/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with BART profile -const client = createClient(bartProfile, 'my-awesome-program') +const client = createClient(bartProfile, userAgent) ``` diff --git a/p/bls/readme.md b/p/bls/readme.md index 7c7ce04b..d5d02173 100644 --- a/p/bls/readme.md +++ b/p/bls/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as blsProfile} from 'hafas-client/p/bls/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with BLS profile -const client = createClient(blsProfile, 'my-awesome-program') +const client = createClient(blsProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/bvg/readme.md b/p/bvg/readme.md index 7a040ae2..06ade1fb 100644 --- a/p/bvg/readme.md +++ b/p/bvg/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as bvgProfile} from 'hafas-client/p/bvg/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with BVG profile -const client = createClient(bvgProfile, 'my-awesome-program') +const client = createClient(bvgProfile, userAgent) ``` diff --git a/p/cfl/readme.md b/p/cfl/readme.md index fb4b004a..9a7f4d04 100644 --- a/p/cfl/readme.md +++ b/p/cfl/readme.md @@ -8,8 +8,10 @@ The [*Société Nationale des Chemins de Fer Luxembourgeois (CFL)*](https://en.w import {createClient} from 'hafas-client' import {profile as cflProfile} from 'hafas-client/p/cfl/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with CFL profile -const client = createClient(cflProfile, 'my-awesome-program') +const client = createClient(cflProfile, userAgent) ``` diff --git a/p/cmta/readme.md b/p/cmta/readme.md index 8e612895..5ddc3930 100644 --- a/p/cmta/readme.md +++ b/p/cmta/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as cmtaProfile} from 'hafas-client/p/cmta/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with CMTA profile -const client = createClient(cmtaProfile, 'my-awesome-program') +const client = createClient(cmtaProfile, userAgent) ``` diff --git a/p/dart/readme.md b/p/dart/readme.md index a185ecf4..dbf28f86 100644 --- a/p/dart/readme.md +++ b/p/dart/readme.md @@ -10,8 +10,10 @@ import {createClient} from 'hafas-client' import {profile as dartProfile} from 'hafas-client/p/dart/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with DART profile -const client = createClient(dartProfile, 'my-awesome-program') +const client = createClient(dartProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/db-busradar-nrw/readme.md b/p/db-busradar-nrw/readme.md index 59e212de..5eb02f29 100644 --- a/p/db-busradar-nrw/readme.md +++ b/p/db-busradar-nrw/readme.md @@ -14,6 +14,8 @@ This profile adapts `hafas-client` to the HAFAS endpoint used by the application import {createClient} from 'hafas-client' import {profile as dbbusradarnrwProfile} from 'hafas-client/p/db-busradar-nrw/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with DB Busradar NRW profile -const client = createClient(dbbusradarnrwProfile, 'my-awesome-program') +const client = createClient(dbbusradarnrwProfile, userAgent) ``` diff --git a/p/db/readme.md b/p/db/readme.md index 9053f630..a2739eeb 100644 --- a/p/db/readme.md +++ b/p/db/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as dbProfile} from 'hafas-client/p/db/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with DB profile -const client = createClient(dbProfile, 'my-awesome-program') +const client = createClient(dbProfile, userAgent) ``` diff --git a/p/insa/readme.md b/p/insa/readme.md index 19781e10..63e10c52 100644 --- a/p/insa/readme.md +++ b/p/insa/readme.md @@ -8,8 +8,10 @@ The [Nahverkehr Sachsen-Anhalt (NASA)](https://de.wikipedia.org/wiki/Nahverkehrs import {createClient} from 'hafas-client' import {profile as insaProfile} from 'hafas-client/p/insa/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with INSA profile -const client = createClient(insaProfile, 'my-awesome-program') +const client = createClient(insaProfile, userAgent) ``` diff --git a/p/invg/readme.md b/p/invg/readme.md index 38ae2060..80596794 100644 --- a/p/invg/readme.md +++ b/p/invg/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as invgProfile} from 'hafas-client/p/invg/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with INVG profile -const client = createClient(invgProfile, 'my-awesome-program') +const client = createClient(invgProfile, userAgent) ``` diff --git a/p/irish-rail/readme.md b/p/irish-rail/readme.md index ca3e46c1..4ac460ae 100644 --- a/p/irish-rail/readme.md +++ b/p/irish-rail/readme.md @@ -8,8 +8,10 @@ The [*Iarnród Éireann* (Irish Rail)](https://en.wikipedia.org/wiki/Iarnród_É import {createClient} from 'hafas-client' import {profile as irishProfile} from 'hafas-client/p/irish-rail/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with Irish Rail profile -const client = createClient(irishProfile, 'my-awesome-program') +const client = createClient(irishProfile, userAgent) ``` diff --git a/p/ivb/readme.md b/p/ivb/readme.md index 4da3f276..a8bf03c1 100644 --- a/p/ivb/readme.md +++ b/p/ivb/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as ivbProfile} from 'hafas-client/p/ivb/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with IVB profile -const client = createClient(ivbProfile, 'my-awesome-program') +const client = createClient(ivbProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/kvb/readme.md b/p/kvb/readme.md index 1a866de4..b6bef17a 100644 --- a/p/kvb/readme.md +++ b/p/kvb/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as kvbProfile} from 'hafas-client/p/kvb/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with KVB profile -const client = createClient(kvbProfile, 'my-awesome-program') +const client = createClient(kvbProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/mobil-nrw/readme.md b/p/mobil-nrw/readme.md index bf5dbd9b..479cb938 100644 --- a/p/mobil-nrw/readme.md +++ b/p/mobil-nrw/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as mobilNrwProfile} from 'hafas-client/p/mobil-nrw/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with mobil.nrw profile -const client = createClient(mobilNrwProfile) +const client = createClient(mobilNrwProfile, userAgent) ``` diff --git a/p/mobiliteit-lu/readme.md b/p/mobiliteit-lu/readme.md index 4e76d556..e8936eb2 100644 --- a/p/mobiliteit-lu/readme.md +++ b/p/mobiliteit-lu/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as mobiliteitProfile} from 'hafas-client/p/mobiliteit-lu/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with mobiliteit.lu profile -const client = createClient(mobiliteitProfile, 'my-awesome-program') +const client = createClient(mobiliteitProfile, userAgent) ``` diff --git a/p/nahsh/readme.md b/p/nahsh/readme.md index dc63acee..997f4570 100644 --- a/p/nahsh/readme.md +++ b/p/nahsh/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as nahshProfile} from 'hafas-client/p/nahsh/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with NAH.SH profile -const client = createClient(nahshProfile, 'my-awesome-program') +const client = createClient(nahshProfile, userAgent) ``` diff --git a/p/nvv/readme.md b/p/nvv/readme.md index 5469bff6..cf0dcd94 100644 --- a/p/nvv/readme.md +++ b/p/nvv/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as nvvProfile} from 'hafas-client/p/nvv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with NVV profile -const client = createClient(nvvProfile, 'my-awesome-program') +const client = createClient(nvvProfile, userAgent) ``` diff --git a/p/oebb/readme.md b/p/oebb/readme.md index 0aae9b66..8af5edee 100644 --- a/p/oebb/readme.md +++ b/p/oebb/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as oebbProfile} from 'hafas-client/p/oebb/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with ÖBB profile -const client = createClient(oebbProfile, 'my-awesome-program') +const client = createClient(oebbProfile, userAgent) ``` diff --git a/p/ooevv/readme.md b/p/ooevv/readme.md index a25dc856..46b82efd 100644 --- a/p/ooevv/readme.md +++ b/p/ooevv/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as ooevvProfile} from 'hafas-client/p/ooevv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with OÖVV profile -const client = createClient(ooevvProfile, 'my-awesome-program') +const client = createClient(ooevvProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/pkp/readme.md b/p/pkp/readme.md index df0864e8..bd0092f1 100644 --- a/p/pkp/readme.md +++ b/p/pkp/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as pkpProfile} from 'hafas-client/p/pkp/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with PKP profile -const client = createClient(pkpProfile, 'my-awesome-program') +const client = createClient(pkpProfile, userAgent) ``` diff --git a/p/rejseplanen/readme.md b/p/rejseplanen/readme.md index a58b79b3..db109191 100644 --- a/p/rejseplanen/readme.md +++ b/p/rejseplanen/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as rejseplanenProfile} from 'hafas-client/p/rejseplanen/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with Rejseplanen profile -const client = createClient(rejseplanenProfile) +const client = createClient(rejseplanenProfile, userAgent) ``` diff --git a/p/rmv/readme.md b/p/rmv/readme.md index edc23ab1..c62a8a7a 100644 --- a/p/rmv/readme.md +++ b/p/rmv/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as rmvProfile} from 'hafas-client/p/rmv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with RMV profile -const client = createClient(rmvProfile, 'my-awesome-program') +const client = createClient(rmvProfile, userAgent) ``` diff --git a/p/rsag/readme.md b/p/rsag/readme.md index 29ae1b40..d4edc446 100644 --- a/p/rsag/readme.md +++ b/p/rsag/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as rsagProfile} from 'hafas-client/p/rsag/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with RSAG profile -const client = createClient(rsagProfile, 'my-awesome-program') +const client = createClient(rsagProfile, userAgent) ``` diff --git a/p/saarfahrplan/readme.md b/p/saarfahrplan/readme.md index 68b641f9..af901534 100644 --- a/p/saarfahrplan/readme.md +++ b/p/saarfahrplan/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as saarfahrplanProfile} from 'hafas-client/p/saarfahrplan/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with Saarfahrplan profile -const client = createClient(saarfahrplanProfile, 'my-awesome-program') +const client = createClient(saarfahrplanProfile, userAgent) ``` diff --git a/p/salzburg/readme.md b/p/salzburg/readme.md index 2e43a08d..8040b917 100644 --- a/p/salzburg/readme.md +++ b/p/salzburg/readme.md @@ -8,8 +8,10 @@ The government of [Salzburg](https://en.wikipedia.org/wiki/Salzburg) operates a import {createClient} from 'hafas-client' import {profile as salzburgProfile} from 'hafas-client/p/salzburg/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with Salzburg profile -const client = createClient(salzburgProfile, 'my-awesome-program') +const client = createClient(salzburgProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/sbahn-muenchen/readme.md b/p/sbahn-muenchen/readme.md index 53ada969..d7ae6c96 100644 --- a/p/sbahn-muenchen/readme.md +++ b/p/sbahn-muenchen/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as sMuenchenProfile} from 'hafas-client/p/sbahn-muenchen/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with S-Bahn München profile -const client = createClient(sMuenchenProfile, 'my-awesome-program') +const client = createClient(sMuenchenProfile, userAgent) ``` diff --git a/p/sncb/readme.md b/p/sncb/readme.md index 592e0561..72a765aa 100644 --- a/p/sncb/readme.md +++ b/p/sncb/readme.md @@ -10,8 +10,10 @@ import {createClient} from 'hafas-client' import {profile as sncbProfile} from 'hafas-client/p/sncb/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with SNCB profile -const client = createClient(sncbProfile, 'my-awesome-program') +const client = createClient(sncbProfile, userAgent) ``` diff --git a/p/stv/readme.md b/p/stv/readme.md index 77ee0dd9..4dabe161 100644 --- a/p/stv/readme.md +++ b/p/stv/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as stvProfile} from 'hafas-client/p/stv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with STV profile -const client = createClient(stvProfile, 'my-awesome-program') +const client = createClient(stvProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/svv/readme.md b/p/svv/readme.md index 92dba6c7..4d323f8f 100644 --- a/p/svv/readme.md +++ b/p/svv/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as svvProfile} from 'hafas-client/p/svv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with SVV profile -const client = createClient(svvProfile, 'my-awesome-program') +const client = createClient(svvProfile, userAgent) ``` diff --git a/p/tpg/readme.md b/p/tpg/readme.md index 67d8f0ab..c2775217 100644 --- a/p/tpg/readme.md +++ b/p/tpg/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as tpgProfile} from 'hafas-client/p/tpg/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with TPG profile -const client = createClient(tpgProfile, 'my-awesome-program') +const client = createClient(tpgProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/vbb/readme.md b/p/vbb/readme.md index 7c32b901..163bd249 100644 --- a/p/vbb/readme.md +++ b/p/vbb/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as vbbProfile} from 'hafas-client/p/vbb/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VBB profile -const client = createClient(vbbProfile, 'my-awesome-program') +const client = createClient(vbbProfile, userAgent) ``` diff --git a/p/vbn/readme.md b/p/vbn/readme.md index c99c25f4..897a11d6 100644 --- a/p/vbn/readme.md +++ b/p/vbn/readme.md @@ -8,8 +8,10 @@ The [*Verkehrsverbund Bremen/Niedersachsen (VBN)*](https://de.wikipedia.org/wiki import {createClient} from 'hafas-client' import {profile as vbnProfile} from 'hafas-client/p/vbn/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VBN profile -const client = createClient(vbnProfile, 'my-awesome-program') +const client = createClient(vbnProfile, userAgent) ``` diff --git a/p/vkg/readme.md b/p/vkg/readme.md index 967863cf..5e4be99c 100644 --- a/p/vkg/readme.md +++ b/p/vkg/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as vkgProfile} from 'hafas-client/p/vkg/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VKG profile -const client = createClient(vkgProfile, 'my-awesome-program') +const client = createClient(vkgProfile, userAgent) ``` diff --git a/p/vmt/readme.md b/p/vmt/readme.md index 15e31fee..05e48071 100644 --- a/p/vmt/readme.md +++ b/p/vmt/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as vmtProfile} from 'hafas-client/p/vmt/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VMT profile -const client = createClient(vmtProfile, 'my-awesome-program') +const client = createClient(vmtProfile, userAgent) ``` ## Customisations diff --git a/p/vor/readme.md b/p/vor/readme.md index 1b17ffcc..8602ee06 100644 --- a/p/vor/readme.md +++ b/p/vor/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as vorProfile} from 'hafas-client/p/vor/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VOR profile -const client = createClient(vorProfile, 'my-awesome-program') +const client = createClient(vorProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/vos/readme.md b/p/vos/readme.md index ebca3b41..d39a7057 100644 --- a/p/vos/readme.md +++ b/p/vos/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as vosProfile} from 'hafas-client/p/vos/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VOS profile -const client = createClient(vosProfile, 'my-awesome-program') +const client = createClient(vosProfile, userAgent) ``` diff --git a/p/vrn/readme.md b/p/vrn/readme.md index 1570bf4b..e5af7db9 100644 --- a/p/vrn/readme.md +++ b/p/vrn/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as vrnProfile} from 'hafas-client/p/vrn/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VRN profile -const client = createClient(vrnProfile, 'my-awesome-program') +const client = createClient(vrnProfile, userAgent) ``` diff --git a/p/vsn/readme.md b/p/vsn/readme.md index 27dedf72..08b7bdcf 100644 --- a/p/vsn/readme.md +++ b/p/vsn/readme.md @@ -6,8 +6,10 @@ import {createClient} from 'hafas-client' import {profile as vsnProfile} from 'hafas-client/p/vsn/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VSN profile -const client = createClient(vsnProfile, 'my-awesome-program') +const client = createClient(vsnProfile, userAgent) ``` ## Customisations diff --git a/p/vvt/readme.md b/p/vvt/readme.md index 7ce9a988..2b42fb36 100644 --- a/p/vvt/readme.md +++ b/p/vvt/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as vvtProfile} from 'hafas-client/p/vvt/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VVT profile -const client = createClient(vvtProfile, 'my-awesome-program') +const client = createClient(vvtProfile, userAgent) ``` diff --git a/p/vvv/readme.md b/p/vvv/readme.md index 11503248..42cf7648 100644 --- a/p/vvv/readme.md +++ b/p/vvv/readme.md @@ -8,8 +8,10 @@ import {createClient} from 'hafas-client' import {profile as vvvProfile} from 'hafas-client/p/vvv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with VVV profile -const client = createClient(vvvProfile, 'my-awesome-program') +const client = createClient(vvvProfile, userAgent) ``` Check out the [code examples](example.js). diff --git a/p/zvv/readme.md b/p/zvv/readme.md index c5cb45c1..75ddd31f 100644 --- a/p/zvv/readme.md +++ b/p/zvv/readme.md @@ -8,6 +8,8 @@ import {createClient} from 'hafas-client' import {profile as zvvProfile} from 'hafas-client/p/zvv/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with ZVV profile -const client = createClient(zvvProfile, 'my-awesome-program') +const client = createClient(zvvProfile, userAgent) ``` diff --git a/readme.md b/readme.md index 18a9a544..465d0473 100644 --- a/readme.md +++ b/readme.md @@ -45,14 +45,18 @@ npm install hafas-client ## Usage -Pick the [profile](p/readme.md) for the HAFAS endpoint covering the area you want to get data for. Pass the profile and a descriptive name for your program into the `createClient` function: +Pick the [profile](p/readme.md) for the HAFAS endpoint covering the area you want to get data for. + +Because the operatores of the HAFAS endpoint should be able to contact you about excessive traffic, please pass a link to your project/program (or an email address) into `createClient()`: ```js import {createClient} from 'hafas-client' import {profile as dbProfile} from 'hafas-client/p/db/index.js' +const userAgent = 'link-to-your-project-or-email' // adapt this to your project! + // create a client with the Deutsche Bahn profile -const client = createClient(dbProfile, 'my-awesome-program') +const client = createClient(dbProfile, userAgent) ``` You can now use `client` to query the HAFAS endpoint configured in the [`db` profile](p/db):