Skip to content
This repository has been archived by the owner on May 29, 2021. It is now read-only.

Javascript & Typescript client for the Los Angeles Metro Realtime API.

License

Notifications You must be signed in to change notification settings

cmcahoon/metro-realtime-client

Repository files navigation

metro-realtime-client

CircleCI   codecov  

Los Angeles Metro provides a RESTful API to retrieve realtime positions of their bus fleet. This is a low level client that does very little transformation on the responses from the API.

Metro Realtime API Overview

Installation

yarn install metro-realtime-client

Usage

All functions export a Promise that can be used then .then or async/await.

var client = require("metro-realtime-client");

// All functions return a Promise...
client
  .listAgencies()
  .then(agencies => {
    // all calls to the client return a promise...
  })
  .catch(err => {
    // ...
  });

// ...so async/await works as well
const agencies = await client.listAgencies();
// Multiple entity getters
client.listAgencies();
client.listRoutes("lametro");
client.listStops("lametro");
client.listVehicles("lametro"); // All vehicles for the entire agency
client.listVehicles("lametro", "901"); // All vehicles for a specific route

// Single entity getters
client.getAgency("lametro");
client.getRoute("lametro", "901");
client.getStop("lametro", "15436");

About

Javascript & Typescript client for the Los Angeles Metro Realtime API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published