Socket
Socket
Sign inDemoInstall

@stockholm-transit/service-alerts

Package Overview
Dependencies
9
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @stockholm-transit/service-alerts

API for Storstockholms Lokaltrafiks' service alerts


Version published
Maintainers
1
Created

Readme

Source

🇸🇪 Storstockholms Lokaltrafiks (SL) Service alerts API 🚆

  • With this API, you can get information about current and planned disturbances in SL traffic. With the API, you can ask questions about disturbances on, for example, a certain line or a certain type of traffic. The answer consists of disturbance messages with certain meta-information.
  • Trafiklab documentation is available here.

Usage

import * as serviceAlerts from '@stockholm-transit/service-alerts';
import { ServiceAlertParameters } from '@stockholm-transit/service-alerts';

serviceAlerts.init({ apiKey: process.env.STOCKHOLM_SERVICE_ALERTS_API_KEY });

const params: ServiceAlertParameters = { siteId: '9001' };
serviceAlerts.query(params).then((data) => res.send(data.ResponseData));

Functions

init

(config: StockholmBaseConfig) => void

query

(params: ServiceAlertParameters) => Promise<ServiceAlertResponse | undefined>

Types

StockholmBaseConfig

ParameterTypeRequiredDescription
apiKeystringtrueTrafiklab API key.
  • Read how to generate Trafiklab API keys here.

ServiceAlertParameters

ParameterTypeRequiredDescriptionDefault
transportModeTransportModefalseCurrent traffic types. Comma-separated string.
lineNumberstringfalseMax 10 lines. Comma-separated string.
siteIdstringtrueUnique identification number for the place.
fromDatestringfalseStart date for the current validity period.
toDatestringfalseEnd date for the current validity period.

TransportMode

  • "BUS"
  • "METRO" (Tunnelbana)
  • "TRAIN" (Pendeltåg)
  • "TRAM"
  • "SHIP"

Building

Run npx nx build @stockholm-transit/service-alerts to build the library.

Running unit tests

Run npx nx test @stockholm-transit/service-alerts to execute the unit tests via Jest.

Keywords

FAQs

Last updated on 28 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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