# sncf-api-wrapper

> Fully typed wrapper for the SNCF API

Latest version **0.0.11** (published 2023-06-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install sncf-api-wrapper
pnpm add sncf-api-wrapper
yarn add sncf-api-wrapper
bun add sncf-api-wrapper
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2023-06-05 |
| First published | 2023-05-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vasseur Pierre-Adrien |
| Maintainers | pierrad |
| Keywords | sncf, api, wrapper, typescript |

## Links

- npm: https://www.npmjs.com/package/sncf-api-wrapper
- Repository: https://github.com/Pierrad/sncf-api-wrapper
- Homepage: https://github.com/Pierrad/sncf-api-wrapper#readme
- Issues: https://github.com/Pierrad/sncf-api-wrapper/issues
- npm.io page: https://npm.io/package/sncf-api-wrapper

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.11

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.11 (latest) — 2023-06-05
- 0.0.10 — 2023-06-02
- 0.0.9 — 2023-05-23
- 0.0.8 — 2023-05-23
- 0.0.7 — 2023-05-22
- 0.0.6 — 2023-05-22
- 0.0.5 — 2023-05-22
- 0.0.4 — 2023-05-22
- 0.0.3 — 2023-05-21
- 0.0.2 — 2023-05-21
- 0.0.1 — 2023-05-21

## README

# sncf-api-wrapper

Fully typed wrapper for the SNCF API.

## Installation

```bash
npm install sncf-api-wrapper
```

## Description

This project propose a wrapper for the SNCF API. It is fully typed and provides a simplified version of the API for the journeys.

Currently, the wrapper only supports the ```journeys``` and ```places``` endpoints.

## Requirements

- API key from SNCF (https://www.digital.sncf.com/startup/api)

## Journeys

The wrapper provides 2 ways to get journeys between two places :  
- Default version that returns the full object without any transformation.
- Simplified version that returns a simplified object containing only the information you might need (departure time, arrival time, duration, delays, train number...).

You can find more details about the API here : https://doc.navitia.io/#journeys

### Default version

```typescript
import { journeys } from 'sncf-api-wrapper';

const res = await journeys('YOUR API KEY', {
  // any parameters from the API documentation (https://doc.navitia.io/#journeys)
})
```

### Simplified version

```typescript
import { simplifyJourneys } from 'sncf-api-wrapper';

const res = await simplifiedJourneys('YOUR API KEY', {
  // any parameters from the API documentation (https://doc.navitia.io/#journeys)
})
```

## Places

You can find more details about the API here : https://doc.navitia.io/#places

```typescript
import { places } from 'sncf-api-wrapper';

const res = await places('YOUR API KEY', {
  // any parameters from the API documentation (https://doc.navitia.io/#places)
})
```

## Check API key

You can check if your API key is valid by using the ```checkApiKey``` function.

```typescript
import { checkApiKey } from 'sncf-api-wrapper';

const isValid: boolean = await checkApiKey('YOUR API KEY')
```

---
_Source: https://npm.io/package/sncf-api-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
