UNPKG

tfl-api-wrapper

Version:

A Node JS wrapper for the Transport for London API

60 lines (59 loc) 2.43 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 Occupancy = /** @class */ (function (_super) { __extends(Occupancy, _super); function Occupancy(config) { return _super.call(this, config) || this; } /** * Get the occupancy for bike points. * @param id Bike Point ID */ Occupancy.prototype.getBikePointByIDs = function (ids) { return this.sendRequest("/Occupancy/BikePoints/".concat(tfl_1.default.arrayToCSV(ids)), {}); }; /** * Gets the occupancy for a charge connectors with a given id * @param id Charge Connector ID (Eg. ChargePointESB-UT06NW-1) */ Occupancy.prototype.getCarkParkByID = function (id) { return this.sendRequest("/Occupancy/CarPark/".concat(id), {}); }; /** * Gets the occupancy for a charge connectors with a given id * @param id Charge Connector ID (Eg. ChargePointCM-24119-49940) */ Occupancy.prototype.getChargeConnectorByID = function (id) { return this.sendRequest("/Occupancy/ChargeConnector/".concat(id), {}); }; /** * Gets the occupancy for all car parks that have occupancy data */ Occupancy.prototype.getAllCarParks = function () { return this.sendRequest("/Occupancy/CarPark", {}); }; /** * Gets the occupancy for all charge connectors */ Occupancy.prototype.getAllChargeConnectors = function () { return this.sendRequest("/Occupancy/ChargeConnector", {}); }; return Occupancy; }(tfl_1.default)); exports.default = Occupancy;