diff --git a/docs/nsr/getFareZone.mdx b/docs/nsr/getFareZone.mdx new file mode 100644 index 00000000..4a1b8a06 --- /dev/null +++ b/docs/nsr/getFareZone.mdx @@ -0,0 +1,42 @@ +--- +name: getFareZone +menu: NSR +route: /nsr/getFareZone +--- + +# getFareZone + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getFareZone` finds a FareZone by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const fareZone = await service.nsr.getFareZone('MOR:FareZone:411') + console.log(fareZone) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getGroupOfStopPlaces.mdx b/docs/nsr/getGroupOfStopPlaces.mdx new file mode 100644 index 00000000..1539f077 --- /dev/null +++ b/docs/nsr/getGroupOfStopPlaces.mdx @@ -0,0 +1,44 @@ +--- +name: getGroupOfStopPlaces +menu: NSR +route: /nsr/getGroupOfStopPlaces +--- + +# getGroupOfStopPlaces + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getGroupOfStopPlaces` finds a GroupOfStopPlaces by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const groupOfStopPlaces = await service.nsr.getGroupOfStopPlaces( + 'NSR:GroupOfStopPlaces:1', + ) + console.log(groupOfStopPlaces) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getParking.mdx b/docs/nsr/getParking.mdx new file mode 100644 index 00000000..2fdad152 --- /dev/null +++ b/docs/nsr/getParking.mdx @@ -0,0 +1,42 @@ +--- +name: getParking +menu: NSR +route: /nsr/getParking +--- + +# getParking + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getParking` finds a Parking by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const parking = await service.nsr.getParking('NSR:Parking:41') + console.log(parking) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getQuay.mdx b/docs/nsr/getQuay.mdx new file mode 100644 index 00000000..48d2f780 --- /dev/null +++ b/docs/nsr/getQuay.mdx @@ -0,0 +1,42 @@ +--- +name: getQuay +menu: NSR +route: /nsr/getQuay +--- + +# getQuay + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getQuay` finds a Quay by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const quay = await service.nsr.getQuay('NSR:Quay:1') + console.log(quay) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getStopPlace.mdx b/docs/nsr/getStopPlace.mdx new file mode 100644 index 00000000..e9e792fe --- /dev/null +++ b/docs/nsr/getStopPlace.mdx @@ -0,0 +1,42 @@ +--- +name: getStopPlace +menu: NSR +route: /nsr/getStopPlace +--- + +# getStopPlace + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getStopPlace` finds a StopPlace by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const stopPlace = await service.nsr.getStopPlace('NSR:StopPlace:337') + console.log(stopPlace) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getStopPlaceForQuay.mdx b/docs/nsr/getStopPlaceForQuay.mdx new file mode 100644 index 00000000..5ae102f1 --- /dev/null +++ b/docs/nsr/getStopPlaceForQuay.mdx @@ -0,0 +1,42 @@ +--- +name: getStopPlaceForQuay +menu: NSR +route: /nsr/getStopPlaceForQuay +--- + +# getStopPlaceForQuay + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getStopPlaceForQuay` finds the StopPlace that a Quay belongs to by the quay's ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const stopPlace = await service.nsr.getStopPlaceForQuay('NSR:Quay:1') + console.log(stopPlace) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getTariffZone.mdx b/docs/nsr/getTariffZone.mdx new file mode 100644 index 00000000..512083b1 --- /dev/null +++ b/docs/nsr/getTariffZone.mdx @@ -0,0 +1,44 @@ +--- +name: getTariffZone +menu: NSR +route: /nsr/getTariffZone +--- + +# getTariffZone + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getTariffZone` finds a TariffZone by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const tariffZone = await service.nsr.getTariffZone( + 'NOR:TariffZone:4020', + ) + console.log(tariffZone) + } catch (error) { + console.error(error) + } +} +``` diff --git a/docs/nsr/getTopographicPlace.mdx b/docs/nsr/getTopographicPlace.mdx new file mode 100644 index 00000000..d28cd34d --- /dev/null +++ b/docs/nsr/getTopographicPlace.mdx @@ -0,0 +1,44 @@ +--- +name: getTopographicPlace +menu: NSR +route: /nsr/getTopographicPlace +--- + +# getTopographicPlace + +```typescript +(id: string, options?: RequestOptions) => Promise +``` + +`getTopographicPlace` finds a TopographicPlace by its ID. Throws an error if no match. + +### options (`RequestOptions`) [Optional] + +An object containing a subset of `RequestInit` options that's applied to the request. + +| Key | Type | Description | +| :-------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signal` | `AbortSignal` | Allows you to communicate with a fetch request and abort it if desired. [Read more](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | +| `headers` | `HeadersInit` | Add custom HTTP headers to the fetch request if desired. | + +## Example + +```javascript +import createEnturService from '@entur/sdk' +// or: const createEnturService = require('@entur/sdk').default + +const service = createEnturService({ + clientName: 'awesomecompany-awesomeapp', +}) + +async function example() { + try { + const topographicPlace = await service.nsr.getTopographicPlace( + 'KVE:TopographicPlace:5402', + ) + console.log(topographicPlace) + } catch (error) { + console.error(error) + } +} +``` diff --git a/doczrc.js b/doczrc.js index 93353bfc..845a7d13 100644 --- a/doczrc.js +++ b/doczrc.js @@ -6,6 +6,7 @@ export default { 'Entur SDK', 'Getting Started', 'Geocoder', + 'NSR', 'Travel', 'Departures', 'Places',