Socket
Socket
Sign inDemoInstall

mbta-client

Package Overview
Dependencies
5
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.1

2

package.json
{
"name": "mbta-client",
"version": "0.4.0",
"version": "0.4.1",
"description": "MBTA API v3 Node.js Client Library",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -72,2 +72,20 @@ # MTBA API Client

#### Fetch Helpers
```js
// Returns basic info for all routes: name, ID, direction names.
// Useful when you need params for `fetchPredictions`, etc.
const allRouteInfo = await mbta.fetchAllRoutes();
console.log(allRouteInfo);
// Returns all stop IDs for the provided route. Also useful for params.
const redLineStops = await mbta.fetchStopsByRoute('Red');
console.log(redLineStops);
// Returns full MBTA response for stops with the provided string in the name.
// Optional param `{ exact: true }` returns only exact matches for the name.
const harvardStops = await mbta.fetchStopsByName('Harvard', { exact: true });
console.log(harvardStops);
```
#### Pagination

@@ -99,13 +117,14 @@

```js
mbta.fetchStops(options);
mbta.fetchTrips(options);
mbta.fetchRoutes(options);
mbta.fetchShapes(options);
mbta.fetchVehicles(options);
mbta.fetchServices(options);
mbta.fetchSchedules(options);
mbta.fetchFacilities(options);
mbta.fetchPredictions(options);
mbta.fetchStops(options): Promise<MBTAResponse>;
mbta.fetchTrips(options): Promise<MBTAResponse>;
mbta.fetchRoutes(options): Promise<MBTAResponse>;
mbta.fetchShapes(options): Promise<MBTAResponse>;
mbta.fetchVehicles(options): Promise<MBTAResponse>;
mbta.fetchServices(options): Promise<MBTAResponse>;
mbta.fetchSchedules(options): Promise<MBTAResponse>;
mbta.fetchFacilities(options): Promise<MBTAResponse>;
mbta.fetchPredictions(options): Promise<MBTAResponse>;
mbta.fetchLiveFacilities(options): Promise<MBTAResponse>;
mbta.fetchAlerts(options); // See note on alerts below
mbta.fetchAlerts(options): Promise<MBTAResponse>; // See note on alerts below
```

@@ -127,5 +146,17 @@

```ts
mbta.fetchAllRoutes(filters?: TypeOptions): Promise<BasicRouteResponse>;
mbta.fetchStopsByRoute(routeID: string|number): Promise<StopsByRouteResponse>;
mbta.fetchStopsByName(name: string, opts: NameOptions): Promise<MBTAResponse>;
mbta.selectIncluded(response: MBTAResponse, options?: TypeOptions);
type BasicRouteResponse = {
id: string,
long_name: string,
direction_names: string[],
short_name?: string
};
type StopsByRouteResponse = { name: string, id: string };
type TypeOptions = { type?: include_value | include_value[] };
type NameOptions = { exact: boolean };
```

@@ -132,0 +163,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc