Skip to content

Commit

Permalink
Add docs for NSR client
Browse files Browse the repository at this point in the history
  • Loading branch information
draperunner committed Jun 22, 2021
1 parent a265f65 commit b074714
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/nsr/getFareZone.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: getFareZone
menu: NSR
route: /nsr/getFareZone
---

# getFareZone

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.FareZone>
```

`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)
}
}
```
44 changes: 44 additions & 0 deletions docs/nsr/getGroupOfStopPlaces.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: getGroupOfStopPlaces
menu: NSR
route: /nsr/getGroupOfStopPlaces
---

# getGroupOfStopPlaces

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.GroupOfStopPlace>
```

`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)
}
}
```
42 changes: 42 additions & 0 deletions docs/nsr/getParking.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: getParking
menu: NSR
route: /nsr/getParking
---

# getParking

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.Parking>
```

`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)
}
}
```
42 changes: 42 additions & 0 deletions docs/nsr/getQuay.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: getQuay
menu: NSR
route: /nsr/getQuay
---

# getQuay

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.Quay>
```

`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)
}
}
```
42 changes: 42 additions & 0 deletions docs/nsr/getStopPlace.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: getStopPlace
menu: NSR
route: /nsr/getStopPlace
---

# getStopPlace

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.StopPlace>
```

`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)
}
}
```
42 changes: 42 additions & 0 deletions docs/nsr/getStopPlaceForQuay.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: getStopPlaceForQuay
menu: NSR
route: /nsr/getStopPlaceForQuay
---

# getStopPlaceForQuay

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.StopPlaceForQuay>
```

`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)
}
}
```
44 changes: 44 additions & 0 deletions docs/nsr/getTariffZone.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: getTariffZone
menu: NSR
route: /nsr/getTariffZone
---

# getTariffZone

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.TariffZone>
```

`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)
}
}
```
44 changes: 44 additions & 0 deletions docs/nsr/getTopographicPlace.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: getTopographicPlace
menu: NSR
route: /nsr/getTopographicPlace
---

# getTopographicPlace

```typescript
(id: string, options?: RequestOptions) => Promise<NsrTypes.TopographicPlace>
```

`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)
}
}
```
1 change: 1 addition & 0 deletions doczrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default {
'Entur SDK',
'Getting Started',
'Geocoder',
'NSR',
'Travel',
'Departures',
'Places',
Expand Down

0 comments on commit b074714

Please sign in to comment.