UNPKG

tfl-api-wrapper

Version:

A Node JS wrapper for the Transport for London API

42 lines (41 loc) 1.74 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var tfl_1 = require("./tfl"); var Mode = /** @class */ (function (_super) { __extends(Mode, _super); function Mode(config) { return _super.call(this, config) || this; } /** * Returns the service type active for a mode. Currently only supports tube */ Mode.prototype.getActiveServiceTypes = function () { return this.sendRequest("/Mode/ActiveServiceTypes", {}); }; /** * * @param mode A mode name e.g. tube, dlr * @param count Number of arrivals to return for each stop, -1 to return all available (default). */ Mode.prototype.getAllArrivalPredictions = function (mode, count) { if (count === void 0) { count = -1; } return this.sendRequest("/Mode/".concat(mode, "/Arrivals"), { count: count }); }; return Mode; }(tfl_1.default)); exports.default = Mode;