# translinkjs

> A typed Javascript Translink RTTI and GTFS API wrapper

Latest version **1.1.3** (published 2022-06-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install translinkjs
pnpm add translinkjs
yarn add translinkjs
bun add translinkjs
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2022-06-07 |
| First published | 2022-05-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 54.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jivison |
| Maintainers | jivison |
| Keywords | Transit, Translink |

## Links

- npm: https://www.npmjs.com/package/translinkjs
- npm.io page: https://npm.io/package/translinkjs

## Dependencies (5)

- [date-fns](https://npm.io/package/date-fns.md) ^2.28.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.7
- [parse2-kmz](https://npm.io/package/parse2-kmz.md) ^1.0.7
- [query-string](https://npm.io/package/query-string.md) ^7.1.1
- [gtfs-realtime-bindings](https://npm.io/package/gtfs-realtime-bindings.md) ^0.0.6

## Recent versions

- 1.1.3 (latest) — 2022-06-07
- 1.1.2 — 2022-05-28
- 1.1.1 — 2022-05-27
- 1.1.0 — 2022-05-25
- 1.0.2 — 2022-05-25
- 1.0.1 — 2022-05-25

## README

# TranslinkJS

A typed Javascript Translink RTTI and GTFS API wrapper

## Installation

```
yarn add translinkjs
```

or

```
npm install translinkjs
```

## Usage

`translinkjs` currently supports both the Translink RTTI and GTFS (realtime) APIs, documentation for which can be found [here](https://www.translink.ca/about-us/doing-business-with-translink/app-developer-resources).

To use the RTTI API:

```ts
import { RTTI } from "translinkjs";

const rtti = new RTTI("API_KEY");

const buses = await rtti.buses({ routeNumber: 99 });
const routes = await rtti.routesThroughStop(54877);
// etc...
```

To use the GTFS API:

```ts
import { TranslinkGTFS } from "translinkjs";

const gtfs = new TranslinkGTFS("API_KEY");

// There are three endpoints available through realtime GTFS:

// Trip updates (how on schedule each bus is)
const tripUpdates = await gtfs.tripUpdates();

// Vehicle positions (where each bus is)
const vehiclePositions = await gtfs.vehiclePositions();

// and Alerts
const alerts = await gtfs.alerts();
```

_You can get an API key [on Translink's website](https://www.translink.ca/about-us/doing-business-with-translink/app-developer-resources/register)_

## Structure

Each API endpoint response is turned into a typed object, which has JS-conventional and understandable property names. Some confusing values are also converted to more intuitive ones.

## Feedback

Found a bug? Want a feature? Feel free to create an issue, or contact me on Discord john!#2527.

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