tfl-api-wrapper
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -1,24 +0,24 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.TrackerNetStations = exports.TrackerNetLines = exports.TrackerNet = exports.StopPoint = exports.Road = exports.Mode = exports.Line = exports.Disruptions = exports.BikePoint = exports.AirQuality = void 0; | ||
var airQuality_1 = require("./lib/airQuality"); | ||
var airQuality_1 = require('./lib/airQuality'); | ||
exports.AirQuality = airQuality_1.default; | ||
var bikePoint_1 = require("./lib/bikePoint"); | ||
var bikePoint_1 = require('./lib/bikePoint'); | ||
exports.BikePoint = bikePoint_1.default; | ||
var disruptions_1 = require("./lib/disruptions"); | ||
var disruptions_1 = require('./lib/disruptions'); | ||
exports.Disruptions = disruptions_1.default; | ||
var line_1 = require("./lib/line"); | ||
var line_1 = require('./lib/line'); | ||
exports.Line = line_1.default; | ||
var mode_1 = require("./lib/mode"); | ||
var mode_1 = require('./lib/mode'); | ||
exports.Mode = mode_1.default; | ||
var road_1 = require("./lib/road"); | ||
var road_1 = require('./lib/road'); | ||
exports.Road = road_1.default; | ||
var stopPoint_1 = require("./lib/stopPoint"); | ||
var stopPoint_1 = require('./lib/stopPoint'); | ||
exports.StopPoint = stopPoint_1.default; | ||
var trackerNet_1 = require("./lib/trackerNet"); | ||
var trackerNet_1 = require('./lib/trackerNet'); | ||
exports.TrackerNet = trackerNet_1.default; | ||
var lines_1 = require("./lib/enums/lines"); | ||
var lines_1 = require('./lib/enums/lines'); | ||
exports.TrackerNetLines = lines_1.default; | ||
var stationCodes_1 = require("./lib/enums/stationCodes"); | ||
var stationCodes_1 = require('./lib/enums/stationCodes'); | ||
exports.TrackerNetStations = stationCodes_1.default; | ||
require("./tests/test"); | ||
require('./tests/test'); |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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 AirQuality = /** @class */ (function (_super) { | ||
@@ -27,3 +37,3 @@ __extends(AirQuality, _super); | ||
return AirQuality; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = AirQuality; |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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 BikePoint = /** @class */ (function (_super) { | ||
@@ -23,12 +33,12 @@ __extends(BikePoint, _super); | ||
BikePoint.prototype.getAll = function () { | ||
return this.sendRequest("/BikePoint/", {}, 'GET'); | ||
return this.sendRequest('/BikePoint/', {}, 'GET'); | ||
}; | ||
BikePoint.prototype.getByID = function (id) { | ||
return this.sendRequest("/BikePoint/" + id, {}, 'GET'); | ||
return this.sendRequest('/BikePoint/' + id, {}, 'GET'); | ||
}; | ||
BikePoint.prototype.getByName = function (query) { | ||
return this.sendRequest("/BikePoint/Search", { query: query }, 'GET'); | ||
return this.sendRequest('/BikePoint/Search', { query: query }, 'GET'); | ||
}; | ||
return BikePoint; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = BikePoint; |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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 Disruptions = /** @class */ (function (_super) { | ||
@@ -26,6 +36,6 @@ __extends(Disruptions, _super); | ||
Disruptions.prototype.getAllLifts = function () { | ||
return this.sendRequest("/Disruptions/Lifts", {}, 'GET'); | ||
return this.sendRequest('/Disruptions/Lifts', {}, 'GET'); | ||
}; | ||
return Disruptions; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = Disruptions; |
@@ -1,16 +0,16 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var TrackerNetLines; | ||
(function (TrackerNetLines) { | ||
TrackerNetLines["Bakerloo"] = "B"; | ||
TrackerNetLines["Central"] = "C"; | ||
TrackerNetLines["District"] = "D"; | ||
TrackerNetLines["HammersmithCity"] = "H"; | ||
TrackerNetLines["Jubilee"] = "J"; | ||
TrackerNetLines["Metropolitan"] = "M"; | ||
TrackerNetLines["Northern"] = "N"; | ||
TrackerNetLines["Piccadilly"] = "P"; | ||
TrackerNetLines["Victoria"] = "V"; | ||
TrackerNetLines["WaterlooCity"] = "W"; | ||
TrackerNetLines['Bakerloo'] = 'B'; | ||
TrackerNetLines['Central'] = 'C'; | ||
TrackerNetLines['District'] = 'D'; | ||
TrackerNetLines['HammersmithCity'] = 'H'; | ||
TrackerNetLines['Jubilee'] = 'J'; | ||
TrackerNetLines['Metropolitan'] = 'M'; | ||
TrackerNetLines['Northern'] = 'N'; | ||
TrackerNetLines['Piccadilly'] = 'P'; | ||
TrackerNetLines['Victoria'] = 'V'; | ||
TrackerNetLines['WaterlooCity'] = 'W'; | ||
})(TrackerNetLines || (TrackerNetLines = {})); | ||
exports.default = TrackerNetLines; |
@@ -1,41 +0,41 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var TrackerNetStations; | ||
(function (TrackerNetStations) { | ||
TrackerNetStations["BakerStreet"] = "BST"; | ||
TrackerNetStations["CharingCross"] = "CHX"; | ||
TrackerNetStations["EdwareRoadBakerloo"] = "ERB"; | ||
TrackerNetStations["ElephantCastle"] = "ELE"; | ||
TrackerNetStations["KensalGreen"] = "KGN"; | ||
TrackerNetStations["Kenton"] = "KNT"; | ||
TrackerNetStations["KilburnPark"] = "KPK"; | ||
TrackerNetStations["LambethNorth"] = "LAM"; | ||
TrackerNetStations["MaidaVale"] = "MDV"; | ||
TrackerNetStations["Marylebone"] = "MYB"; | ||
TrackerNetStations["NorthWembley"] = "NWM"; | ||
TrackerNetStations["OxfordCircus"] = "OXC"; | ||
TrackerNetStations["Paddington"] = "PAD"; | ||
TrackerNetStations["PiccadillyCircus"] = "PIC"; | ||
TrackerNetStations["QueensPark"] = "QPK"; | ||
TrackerNetStations["RegentsPark"] = "RPK"; | ||
TrackerNetStations["SouthKenton"] = "SKT"; | ||
TrackerNetStations["StonebridgePark"] = "SPK"; | ||
TrackerNetStations["WarwickAvenue"] = "WAR"; | ||
TrackerNetStations["Waterloo"] = "WLO"; | ||
TrackerNetStations["WembleyCentral"] = "WEM"; | ||
TrackerNetStations["WillesdenJunction"] = "WJN"; | ||
TrackerNetStations["Bank"] = "BNK"; | ||
TrackerNetStations["Barkingside"] = "BDE"; | ||
TrackerNetStations["BethnalGreen"] = "BNG"; | ||
TrackerNetStations["BondStreet"] = "BDS"; | ||
TrackerNetStations["BuckhurstHill"] = "BHL"; | ||
TrackerNetStations["ChanceryLane"] = "CYL"; | ||
TrackerNetStations["Chigwell"] = "CHG"; | ||
TrackerNetStations["Debden"] = "DEB"; | ||
TrackerNetStations["EalingBroadway"] = "EBY"; | ||
TrackerNetStations["EastActon"] = "EAC"; | ||
TrackerNetStations["Epping"] = "EPP"; | ||
TrackerNetStations["Fairlop"] = "FLP"; | ||
TrackerNetStations["GantsHill"] = "GHL"; | ||
TrackerNetStations['BakerStreet'] = 'BST'; | ||
TrackerNetStations['CharingCross'] = 'CHX'; | ||
TrackerNetStations['EdwareRoadBakerloo'] = 'ERB'; | ||
TrackerNetStations['ElephantCastle'] = 'ELE'; | ||
TrackerNetStations['KensalGreen'] = 'KGN'; | ||
TrackerNetStations['Kenton'] = 'KNT'; | ||
TrackerNetStations['KilburnPark'] = 'KPK'; | ||
TrackerNetStations['LambethNorth'] = 'LAM'; | ||
TrackerNetStations['MaidaVale'] = 'MDV'; | ||
TrackerNetStations['Marylebone'] = 'MYB'; | ||
TrackerNetStations['NorthWembley'] = 'NWM'; | ||
TrackerNetStations['OxfordCircus'] = 'OXC'; | ||
TrackerNetStations['Paddington'] = 'PAD'; | ||
TrackerNetStations['PiccadillyCircus'] = 'PIC'; | ||
TrackerNetStations['QueensPark'] = 'QPK'; | ||
TrackerNetStations['RegentsPark'] = 'RPK'; | ||
TrackerNetStations['SouthKenton'] = 'SKT'; | ||
TrackerNetStations['StonebridgePark'] = 'SPK'; | ||
TrackerNetStations['WarwickAvenue'] = 'WAR'; | ||
TrackerNetStations['Waterloo'] = 'WLO'; | ||
TrackerNetStations['WembleyCentral'] = 'WEM'; | ||
TrackerNetStations['WillesdenJunction'] = 'WJN'; | ||
TrackerNetStations['Bank'] = 'BNK'; | ||
TrackerNetStations['Barkingside'] = 'BDE'; | ||
TrackerNetStations['BethnalGreen'] = 'BNG'; | ||
TrackerNetStations['BondStreet'] = 'BDS'; | ||
TrackerNetStations['BuckhurstHill'] = 'BHL'; | ||
TrackerNetStations['ChanceryLane'] = 'CYL'; | ||
TrackerNetStations['Chigwell'] = 'CHG'; | ||
TrackerNetStations['Debden'] = 'DEB'; | ||
TrackerNetStations['EalingBroadway'] = 'EBY'; | ||
TrackerNetStations['EastActon'] = 'EAC'; | ||
TrackerNetStations['Epping'] = 'EPP'; | ||
TrackerNetStations['Fairlop'] = 'FLP'; | ||
TrackerNetStations['GantsHill'] = 'GHL'; | ||
})(TrackerNetStations || (TrackerNetStations = {})); | ||
exports.default = TrackerNetStations; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -85,3 +85,3 @@ export declare module getPredictionSummary { | ||
stationID: string; | ||
statusDetails: string; | ||
statusDetails: Array<string>; | ||
stationName: string; | ||
@@ -88,0 +88,0 @@ description: string; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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 Line = /** @class */ (function (_super) { | ||
@@ -40,7 +50,7 @@ __extends(Line, _super); | ||
Line.prototype.getAllStopPoints = function (line) { | ||
return this.sendRequest("/Line/" + line + "/StopPoints", {}, 'GET'); | ||
return this.sendRequest('/Line/' + line + '/StopPoints', {}, 'GET'); | ||
}; | ||
/** Gets all lines that serve the given modes. */ | ||
Line.prototype.getAllFromMode = function (modes) { | ||
return this.sendRequest("/Line/Mode/" + this.arrayToCSV(modes), {}, 'GET'); | ||
return this.sendRequest('/Line/Mode/' + this.arrayToCSV(modes), {}, 'GET'); | ||
}; | ||
@@ -56,19 +66,18 @@ /** | ||
if (!startDate || !endDate) { | ||
return this.sendRequest("/Line/" + this.arrayToCSV(lines) + "/Status", { detail: detail }, 'GET'); | ||
return this.sendRequest('/Line/' + this.arrayToCSV(lines) + '/Status', { detail: detail }, 'GET'); | ||
} else { | ||
return this.sendRequest('/Line/' + this.arrayToCSV(lines) + '/Status/' + this.convertDate(startDate) + '/to/' + this.convertDate(endDate), { detail: detail }, 'GET'); | ||
} | ||
else { | ||
return this.sendRequest("/Line/" + this.arrayToCSV(lines) + "/Status/" + this.convertDate(startDate) + "/to/" + this.convertDate(endDate), { detail: detail }, 'GET'); | ||
} | ||
}; | ||
/** Gets the timetable for a specified station on the give line with specified destination */ | ||
Line.prototype.getTimetableFromTo = function (line, from, to) { | ||
return this.sendRequest("/Line/" + line + "/Timetable/" + from + "/to/" + to, {}, 'GET'); | ||
return this.sendRequest('/Line/' + line + '/Timetable/' + from + '/to/' + to, {}, 'GET'); | ||
}; | ||
/** Gets the inbound timetable for a specified station on the give line */ | ||
Line.prototype.getTimetableFromStationIn = function (line, NaPTANID) { | ||
return this.sendRequest("/Line/" + line + "/Timetable/" + NaPTANID, { direction: 'inbound' }, 'GET'); | ||
return this.sendRequest('/Line/' + line + '/Timetable/' + NaPTANID, { direction: 'inbound' }, 'GET'); | ||
}; | ||
/** Gets the outbound timetable for a specified station on the give line */ | ||
Line.prototype.getTimetableFromStationOut = function (line, NaPTANID) { | ||
return this.sendRequest("/Line/" + line + "/Timetable/" + NaPTANID, {}, 'GET'); | ||
return this.sendRequest('/Line/' + line + '/Timetable/' + NaPTANID, {}, 'GET'); | ||
}; | ||
@@ -82,7 +91,9 @@ /** Get the list of arrival predictions for given line ids based at the given stop | ||
Line.prototype.getArrivalsByNaptan = function (ids, NaptanID, direction, destinationStationId) { | ||
if (direction === void 0) { direction = 'all'; } | ||
return this.sendRequest("/Line/" + this.arrayToCSV(ids) + "/Arrivals/" + NaptanID, { direction: direction, destinationStationId: destinationStationId }, 'GET'); | ||
if (direction === void 0) { | ||
direction = 'all'; | ||
} | ||
return this.sendRequest('/Line/' + this.arrayToCSV(ids) + '/Arrivals/' + NaptanID, { direction: direction, destinationStationId: destinationStationId }, 'GET'); | ||
}; | ||
return Line; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = Line; |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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) { | ||
@@ -26,3 +36,3 @@ __extends(Mode, _super); | ||
Mode.prototype.getActiveServiceTypes = function () { | ||
return this.sendRequest("/Mode/ActiveServiceTypes", {}, 'GET'); | ||
return this.sendRequest('/Mode/ActiveServiceTypes', {}, 'GET'); | ||
}; | ||
@@ -35,6 +45,6 @@ /** | ||
Mode.prototype.getArrivalPredictionsAllStops = function (mode, count) { | ||
return this.sendRequest("/Mode/" + mode + "/Arrivals", { count: count }, 'GET'); | ||
return this.sendRequest('/Mode/' + mode + '/Arrivals', { count: count }, 'GET'); | ||
}; | ||
return Mode; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = Mode; |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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 Road = /** @class */ (function (_super) { | ||
@@ -33,3 +43,3 @@ __extends(Road, _super); | ||
Road.prototype.getByID = function (ids) { | ||
return this.sendRequest("/Road/" + this.arrayToCSV(ids), {}, 'GET'); | ||
return this.sendRequest('/Road/' + this.arrayToCSV(ids), {}, 'GET'); | ||
}; | ||
@@ -43,6 +53,10 @@ /** | ||
Road.prototype.getStatusByID = function (ids, startDate, endDate) { | ||
return this.sendRequest("/Road/" + this.arrayToCSV(ids) + "/Status", { | ||
startDate: this.convertDate(startDate), | ||
endDate: this.convertDate(endDate) | ||
}, 'GET'); | ||
return this.sendRequest( | ||
'/Road/' + this.arrayToCSV(ids) + '/Status', | ||
{ | ||
startDate: this.convertDate(startDate), | ||
endDate: this.convertDate(endDate), | ||
}, | ||
'GET' | ||
); | ||
}; | ||
@@ -55,6 +69,10 @@ /** | ||
Road.prototype.getAllStreetDisruption = function (startDate, endDate) { | ||
return this.sendRequest("/Road/all/Street/Disruption", { | ||
startDate: this.convertDate(startDate), | ||
endDate: this.convertDate(endDate) | ||
}, 'GET'); | ||
return this.sendRequest( | ||
'/Road/all/Street/Disruption', | ||
{ | ||
startDate: this.convertDate(startDate), | ||
endDate: this.convertDate(endDate), | ||
}, | ||
'GET' | ||
); | ||
}; | ||
@@ -69,5 +87,9 @@ /** | ||
Road.prototype.getAllDisruptionsByID = function (ids, stripContent) { | ||
return this.sendRequest("/Road/all/Disruption/" + this.arrayToCSV(ids), { | ||
stripContent: stripContent | ||
}, 'GET'); | ||
return this.sendRequest( | ||
'/Road/all/Disruption/' + this.arrayToCSV(ids), | ||
{ | ||
stripContent: stripContent, | ||
}, | ||
'GET' | ||
); | ||
}; | ||
@@ -87,3 +109,3 @@ /** | ||
return Road; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = Road; |
@@ -1,17 +0,27 @@ | ||
"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) { | ||
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"); | ||
'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) { | ||
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 StopPoint = /** @class */ (function (_super) { | ||
@@ -26,3 +36,3 @@ __extends(StopPoint, _super); | ||
StopPoint.prototype.getCategories = function () { | ||
return this.sendRequest("/StopPoint/Meta/Categories", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/Meta/Categories', {}, 'GET'); | ||
}; | ||
@@ -33,3 +43,3 @@ /** | ||
StopPoint.prototype.getTypes = function () { | ||
return this.sendRequest("/StopPoint/Meta/StopTypes", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/Meta/StopTypes', {}, 'GET'); | ||
}; | ||
@@ -40,3 +50,3 @@ /** | ||
StopPoint.prototype.getModes = function () { | ||
return this.sendRequest("/StopPoint/Meta/Modes", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/Meta/Modes', {}, 'GET'); | ||
}; | ||
@@ -49,3 +59,3 @@ /** | ||
StopPoint.prototype.getByIDs = function (ids, includeCrowding) { | ||
return this.sendRequest("/StopPoint/" + this.arrayToCSV(ids), { includeCrowding: includeCrowding }, 'GET'); | ||
return this.sendRequest('/StopPoint/' + this.arrayToCSV(ids), { includeCrowding: includeCrowding }, 'GET'); | ||
}; | ||
@@ -57,3 +67,3 @@ /** | ||
StopPoint.prototype.getAllByStopType = function (types) { | ||
return this.sendRequest("/StopPoint/" + this.arrayToCSV(types), {}, 'GET'); | ||
return this.sendRequest('/StopPoint/' + this.arrayToCSV(types), {}, 'GET'); | ||
}; | ||
@@ -67,3 +77,3 @@ /** | ||
StopPoint.prototype.getServiceTypesByID = function (id, lineIds, modes) { | ||
return this.sendRequest("/StopPoint/ServiceTypes", { id: id, lineIds: lineIds, modes: modes }, 'GET'); | ||
return this.sendRequest('/StopPoint/ServiceTypes', { id: id, lineIds: lineIds, modes: modes }, 'GET'); | ||
}; | ||
@@ -76,3 +86,3 @@ /** | ||
StopPoint.prototype.search = function (name, modes) { | ||
return this.sendRequest("/StopPoint/Search/" + name, {}, 'GET'); | ||
return this.sendRequest('/StopPoint/Search/' + name, {}, 'GET'); | ||
}; | ||
@@ -84,3 +94,3 @@ /** | ||
StopPoint.prototype.getStationArrivals = function (id) { | ||
return this.sendRequest("/StopPoint/" + id + "/Arrivals", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/' + id + '/Arrivals', {}, 'GET'); | ||
}; | ||
@@ -93,3 +103,3 @@ /** | ||
StopPoint.prototype.getArrivalDepartures = function (id, lineIds) { | ||
return this.sendRequest("/StopPoint/" + id + "/ArrivalsDepartures", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/' + id + '/ArrivalsDepartures', {}, 'GET'); | ||
}; | ||
@@ -104,7 +114,11 @@ /** | ||
StopPoint.prototype.getDisruptionsByID = function (ids, getFamily, includeRouteBlockedStops, flattenResponse) { | ||
return this.sendRequest("/StopPoint/" + this.arrayToCSV(ids) + "/Disruption", { | ||
getFamily: getFamily, | ||
includeRouteBlockedStops: includeRouteBlockedStops, | ||
flattenResponse: flattenResponse, | ||
}, 'GET'); | ||
return this.sendRequest( | ||
'/StopPoint/' + this.arrayToCSV(ids) + '/Disruption', | ||
{ | ||
getFamily: getFamily, | ||
includeRouteBlockedStops: includeRouteBlockedStops, | ||
flattenResponse: flattenResponse, | ||
}, | ||
'GET' | ||
); | ||
}; | ||
@@ -117,3 +131,3 @@ /** | ||
StopPoint.prototype.getDisruptionsByMode = function (modes, includeRouteBlockedStops) { | ||
return this.sendRequest("/StopPoint/Mode/" + this.arrayToCSV(modes) + "/Disruption", { includeRouteBlockedStops: includeRouteBlockedStops }, 'GET'); | ||
return this.sendRequest('/StopPoint/Mode/' + this.arrayToCSV(modes) + '/Disruption', { includeRouteBlockedStops: includeRouteBlockedStops }, 'GET'); | ||
}; | ||
@@ -127,4 +141,6 @@ /** | ||
StopPoint.prototype.getReachableStationsByID = function (id, lineID, serviceTypes) { | ||
if (serviceTypes === void 0) { serviceTypes = ['Regular']; } | ||
return this.sendRequest("/StopPoint/" + id + "/CanReachOnLine/" + lineID, { serviceTypes: this.arrayToCSV(serviceTypes) }, 'GET'); | ||
if (serviceTypes === void 0) { | ||
serviceTypes = ['Regular']; | ||
} | ||
return this.sendRequest('/StopPoint/' + id + '/CanReachOnLine/' + lineID, { serviceTypes: this.arrayToCSV(serviceTypes) }, 'GET'); | ||
}; | ||
@@ -137,4 +153,6 @@ /** | ||
StopPoint.prototype.getRouteSectionByID = function (id, serviceTypes) { | ||
if (serviceTypes === void 0) { serviceTypes = ['Regular']; } | ||
return this.sendRequest("/StopPoint/" + id + "/Route", { serviceTypes: this.arrayToCSV(serviceTypes) }, 'GET'); | ||
if (serviceTypes === void 0) { | ||
serviceTypes = ['Regular']; | ||
} | ||
return this.sendRequest('/StopPoint/' + id + '/Route', { serviceTypes: this.arrayToCSV(serviceTypes) }, 'GET'); | ||
}; | ||
@@ -153,4 +171,19 @@ /** | ||
StopPoint.prototype.getInRadius = function (stopTypes, radius, useStopPointHierarchy, modes, categories, returnLines, latitude, longitude) { | ||
if (radius === void 0) { radius = 200; } | ||
return this.sendRequest("/StopPoint", { stopTypes: this.arrayToCSV(stopTypes), radius: radius, useStopPointHierarchy: useStopPointHierarchy, modes: this.arrayToCSV(modes), categories: this.arrayToCSV(categories), returnLines: returnLines, latitude: latitude, longitude: longitude }, 'GET'); | ||
if (radius === void 0) { | ||
radius = 200; | ||
} | ||
return this.sendRequest( | ||
'/StopPoint', | ||
{ | ||
stopTypes: this.arrayToCSV(stopTypes), | ||
radius: radius, | ||
useStopPointHierarchy: useStopPointHierarchy, | ||
modes: this.arrayToCSV(modes), | ||
categories: this.arrayToCSV(categories), | ||
returnLines: returnLines, | ||
latitude: latitude, | ||
longitude: longitude, | ||
}, | ||
'GET' | ||
); | ||
}; | ||
@@ -163,3 +196,3 @@ /** | ||
StopPoint.prototype.getBySMSCode = function (smsID, output) { | ||
return this.sendRequest("/StopPoint/Sms/" + smsID, { output: output }, 'GET'); | ||
return this.sendRequest('/StopPoint/Sms/' + smsID, { output: output }, 'GET'); | ||
}; | ||
@@ -171,3 +204,3 @@ /** | ||
StopPoint.prototype.getTaxiRanksByID = function (id) { | ||
return this.sendRequest("/StopPoint/" + id + "/TaxiRanks", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/' + id + '/TaxiRanks', {}, 'GET'); | ||
}; | ||
@@ -179,6 +212,6 @@ /** | ||
StopPoint.prototype.getCarParksByID = function (id) { | ||
return this.sendRequest("/StopPoint/" + id + "/CarParks", {}, 'GET'); | ||
return this.sendRequest('/StopPoint/' + id + '/CarParks', {}, 'GET'); | ||
}; | ||
return StopPoint; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = StopPoint; |
@@ -1,42 +0,123 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
'use strict'; | ||
var __awaiter = | ||
(this && this.__awaiter) || | ||
function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { | ||
return value instanceof P | ||
? value | ||
: new P(function (resolve) { | ||
resolve(value); | ||
}); | ||
} | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var node_fetch_1 = require("node-fetch"); | ||
var qs = require("querystring"); | ||
var xml2js = require("xml2js"); | ||
function rejected(value) { | ||
try { | ||
step(generator['throw'](value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function step(result) { | ||
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); | ||
} | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = | ||
(this && this.__generator) || | ||
function (thisArg, body) { | ||
var _ = { | ||
label: 0, | ||
sent: function () { | ||
if (t[0] & 1) throw t[1]; | ||
return t[1]; | ||
}, | ||
trys: [], | ||
ops: [], | ||
}, | ||
f, | ||
y, | ||
t, | ||
g; | ||
return ( | ||
(g = { next: verb(0), throw: verb(1), return: verb(2) }), | ||
typeof Symbol === 'function' && | ||
(g[Symbol.iterator] = function () { | ||
return this; | ||
}), | ||
g | ||
); | ||
function verb(n) { | ||
return function (v) { | ||
return step([n, v]); | ||
}; | ||
} | ||
function step(op) { | ||
if (f) throw new TypeError('Generator is already executing.'); | ||
while (_) | ||
try { | ||
if (((f = 1), y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)) return t; | ||
if (((y = 0), t)) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: | ||
case 1: | ||
t = op; | ||
break; | ||
case 4: | ||
_.label++; | ||
return { value: op[1], done: false }; | ||
case 5: | ||
_.label++; | ||
y = op[1]; | ||
op = [0]; | ||
continue; | ||
case 7: | ||
op = _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
default: | ||
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) { | ||
_ = 0; | ||
continue; | ||
} | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { | ||
_.label = op[1]; | ||
break; | ||
} | ||
if (op[0] === 6 && _.label < t[1]) { | ||
_.label = t[1]; | ||
t = op; | ||
break; | ||
} | ||
if (t && _.label < t[2]) { | ||
_.label = t[2]; | ||
_.ops.push(op); | ||
break; | ||
} | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { | ||
op = [6, e]; | ||
y = 0; | ||
} finally { | ||
f = t = 0; | ||
} | ||
if (op[0] & 5) throw op[1]; | ||
return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var node_fetch_1 = require('node-fetch'); | ||
var qs = require('querystring'); | ||
var xml2js = require('xml2js'); | ||
var TfLAPI = /** @class */ (function () { | ||
@@ -57,3 +138,3 @@ function TfLAPI(config) { | ||
case 0: | ||
FullURL = "https://" + this.host + ":" + this.port + uri + "?" + qs.stringify(this.config); | ||
FullURL = 'https://' + this.host + ':' + this.port + uri + '?' + qs.stringify(this.config); | ||
options = { | ||
@@ -67,3 +148,3 @@ method: method, | ||
if (params) { | ||
FullURL = FullURL + "&" + qs.stringify(params); | ||
FullURL = FullURL + '&' + qs.stringify(params); | ||
} | ||
@@ -74,3 +155,4 @@ return [4 /*yield*/, node_fetch_1.default(FullURL, options)]; | ||
return [4 /*yield*/, fetchReq.json()]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
return [2 /*return*/, _a.sent()]; | ||
} | ||
@@ -85,7 +167,7 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var FullURL, options, fetchReq, xml, _a, _b; | ||
var FullURL, options, fetchReq, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
FullURL = "http://cloud.tfl.gov.uk/TrackerNet" + uri; | ||
FullURL = 'http://cloud.tfl.gov.uk/TrackerNet' + uri; | ||
options = { | ||
@@ -103,7 +185,6 @@ method: method, | ||
return [4 /*yield*/, fetchReq.text()]; | ||
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 2: | ||
return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 3: | ||
xml = _c.sent(); | ||
console.log(fetchReq.url); | ||
return [2 /*return*/, xml]; | ||
return [2 /*return*/, _c.sent()]; | ||
} | ||
@@ -117,7 +198,7 @@ }); | ||
TfLAPI.prototype.objectToQuery = function (params) { | ||
var x = Object.keys(params) | ||
.map(function (key) { return key + '=' + params[key]; }) | ||
return Object.keys(params) | ||
.map(function (key) { | ||
return key + '=' + params[key]; | ||
}) | ||
.join('&'); | ||
console.log(x); | ||
return x; | ||
}; | ||
@@ -137,3 +218,3 @@ /** | ||
return TfLAPI; | ||
}()); | ||
})(); | ||
exports.default = TfLAPI; |
@@ -1,53 +0,144 @@ | ||
"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); | ||
'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) { | ||
extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __()); | ||
}; | ||
})(); | ||
var __awaiter = | ||
(this && this.__awaiter) || | ||
function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { | ||
return value instanceof P | ||
? value | ||
: new P(function (resolve) { | ||
resolve(value); | ||
}); | ||
} | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function rejected(value) { | ||
try { | ||
step(generator['throw'](value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function step(result) { | ||
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); | ||
} | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
var __generator = | ||
(this && this.__generator) || | ||
function (thisArg, body) { | ||
var _ = { | ||
label: 0, | ||
sent: function () { | ||
if (t[0] & 1) throw t[1]; | ||
return t[1]; | ||
}, | ||
trys: [], | ||
ops: [], | ||
}, | ||
f, | ||
y, | ||
t, | ||
g; | ||
return ( | ||
(g = { next: verb(0), throw: verb(1), return: verb(2) }), | ||
typeof Symbol === 'function' && | ||
(g[Symbol.iterator] = function () { | ||
return this; | ||
}), | ||
g | ||
); | ||
function verb(n) { | ||
return function (v) { | ||
return step([n, v]); | ||
}; | ||
} | ||
function step(op) { | ||
if (f) throw new TypeError('Generator is already executing.'); | ||
while (_) | ||
try { | ||
if (((f = 1), y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)) return t; | ||
if (((y = 0), t)) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: | ||
case 1: | ||
t = op; | ||
break; | ||
case 4: | ||
_.label++; | ||
return { value: op[1], done: false }; | ||
case 5: | ||
_.label++; | ||
y = op[1]; | ||
op = [0]; | ||
continue; | ||
case 7: | ||
op = _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
default: | ||
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) { | ||
_ = 0; | ||
continue; | ||
} | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { | ||
_.label = op[1]; | ||
break; | ||
} | ||
if (op[0] === 6 && _.label < t[1]) { | ||
_.label = t[1]; | ||
t = op; | ||
break; | ||
} | ||
if (t && _.label < t[2]) { | ||
_.label = t[2]; | ||
_.ops.push(op); | ||
break; | ||
} | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { | ||
op = [6, e]; | ||
y = 0; | ||
} finally { | ||
f = t = 0; | ||
} | ||
if (op[0] & 5) throw op[1]; | ||
return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
})(); | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tfl_1 = require("./tfl"); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var tfl_1 = require('./tfl'); | ||
var TrackerNet = /** @class */ (function (_super) { | ||
@@ -63,7 +154,10 @@ __extends(TrackerNet, _super); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.sendRequestTrackerNet("/PredictionSummary/" + line, {}, 'GET')]; | ||
case 0: | ||
return [4 /*yield*/, this.sendRequestTrackerNet('/PredictionSummary/' + line, {}, 'GET')]; | ||
case 1: | ||
request = _a.sent(); | ||
root = request.ROOT; | ||
return [2 /*return*/, { | ||
return [ | ||
2 /*return*/, | ||
{ | ||
currentTime: root.Time[0].$.TimeStamp, | ||
@@ -80,12 +174,15 @@ stations: root.S.map(function (station) { | ||
next: platform.$.Next, | ||
trains: (_a = platform === null || platform === void 0 ? void 0 : platform.T) === null || _a === void 0 ? void 0 : _a.map(function (train) { | ||
return { | ||
setNumber: train.$.S, | ||
tripNumber: train.$.T, | ||
destinationCode: train.$.D, | ||
timeToStation: train.$.C, | ||
currentLocation: train.$.L, | ||
destination: train.$.D, | ||
}; | ||
}), | ||
trains: | ||
(_a = platform === null || platform === void 0 ? void 0 : platform.T) === null || _a === void 0 | ||
? void 0 | ||
: _a.map(function (train) { | ||
return { | ||
setNumber: train.$.S, | ||
tripNumber: train.$.T, | ||
destinationCode: train.$.D, | ||
timeToStation: train.$.C, | ||
currentLocation: train.$.L, | ||
destination: train.$.D, | ||
}; | ||
}), | ||
}; | ||
@@ -95,3 +192,4 @@ }), | ||
}), | ||
}]; | ||
}, | ||
]; | ||
} | ||
@@ -112,7 +210,10 @@ }); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.sendRequestTrackerNet("/PredictionDetailed/" + line + "/" + stationCode, {}, 'GET')]; | ||
case 0: | ||
return [4 /*yield*/, this.sendRequestTrackerNet('/PredictionDetailed/' + line + '/' + stationCode, {}, 'GET')]; | ||
case 1: | ||
request = _a.sent(); | ||
root = request.ROOT; | ||
return [2 /*return*/, { | ||
return [ | ||
2 /*return*/, | ||
{ | ||
information: { | ||
@@ -130,25 +231,29 @@ code: root.S[0].$.Code, | ||
nextTrain: platform.$.NextTrain, | ||
trains: (_a = platform === null || platform === void 0 ? void 0 : platform.T) === null || _a === void 0 ? void 0 : _a.map(function (train) { | ||
return { | ||
trainID: train.$.TrainId, | ||
LCID: train.$.LCID, | ||
setNumber: train.$.SetNo, | ||
tripNumber: train.$.TripNo, | ||
secondsToStation: train.$.SecondsTo, | ||
timeToStation: train.$.TimeTo, | ||
currentLocation: train.$.Location, | ||
destination: train.$.Destination, | ||
destinationCode: train.$.DestCode, | ||
departedTime: train.$.DepartTime, | ||
departureInterval: train.$.DepartInterval, | ||
hasDeparted: !!train.$.Departed, | ||
direction: train.$.Direction, | ||
trackCode: train.$.TrackCode, | ||
line: train.$.LN, | ||
leadingCarNumber: train.$.LeadingCarNo, | ||
}; | ||
}), | ||
trains: | ||
(_a = platform === null || platform === void 0 ? void 0 : platform.T) === null || _a === void 0 | ||
? void 0 | ||
: _a.map(function (train) { | ||
return { | ||
trainID: train.$.TrainId, | ||
LCID: train.$.LCID, | ||
setNumber: train.$.SetNo, | ||
tripNumber: train.$.TripNo, | ||
secondsToStation: train.$.SecondsTo, | ||
timeToStation: train.$.TimeTo, | ||
currentLocation: train.$.Location, | ||
destination: train.$.Destination, | ||
destinationCode: train.$.DestCode, | ||
departedTime: train.$.DepartTime, | ||
departureInterval: train.$.DepartInterval, | ||
hasDeparted: !!train.$.Departed, | ||
direction: train.$.Direction, | ||
trackCode: train.$.TrackCode, | ||
line: train.$.LN, | ||
leadingCarNumber: train.$.LeadingCarNo, | ||
}; | ||
}), | ||
}; | ||
}), | ||
}]; | ||
}, | ||
]; | ||
} | ||
@@ -169,6 +274,8 @@ }); | ||
incidentsOnlyCheck = incidentsOnly ? '/IncidentsOnly' : ''; | ||
return [4 /*yield*/, this.sendRequestTrackerNet("/LineStatus" + incidentsOnlyCheck, {}, 'GET')]; | ||
return [4 /*yield*/, this.sendRequestTrackerNet('/LineStatus' + incidentsOnlyCheck, {}, 'GET')]; | ||
case 1: | ||
request = _a.sent(); | ||
return [2 /*return*/, request.ArrayOfLineStatus.LineStatus.map(function (line) { | ||
return [ | ||
2 /*return*/, | ||
request.ArrayOfLineStatus.LineStatus.map(function (line) { | ||
return { | ||
@@ -187,3 +294,4 @@ id: line.$.ID, | ||
}; | ||
})]; | ||
}), | ||
]; | ||
} | ||
@@ -204,6 +312,8 @@ }); | ||
incidentsOnlyCheck = incidentsOnly ? '/IncidentsOnly' : ''; | ||
return [4 /*yield*/, this.sendRequestTrackerNet("/StationStatus" + incidentsOnlyCheck, {}, 'GET')]; | ||
return [4 /*yield*/, this.sendRequestTrackerNet('/StationStatus' + incidentsOnlyCheck, {}, 'GET')]; | ||
case 1: | ||
request = _a.sent(); | ||
return [2 /*return*/, request.ArrayOfStationStatus.StationStatus.map(function (station) { | ||
return [ | ||
2 /*return*/, | ||
request.ArrayOfStationStatus.StationStatus.map(function (station) { | ||
return { | ||
@@ -217,3 +327,4 @@ stationID: station.$.ID, | ||
}; | ||
})]; | ||
}), | ||
]; | ||
} | ||
@@ -224,3 +335,3 @@ }); | ||
return TrackerNet; | ||
}(tfl_1.default)); | ||
})(tfl_1.default); | ||
exports.default = TrackerNet; |
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.default = { | ||
@@ -4,0 +4,0 @@ bakerloo: { |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "tfl-api-wrapper", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A Node JS wrapper for the Transport for London API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83701
37
2319