tfl-api-wrapper
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -8,2 +8,6 @@ import AirQuality from './lib/airQuality'; | ||
import StopPoint from './lib/stopPoint'; | ||
export { AirQuality, BikePoint, Disruptions, Line, Mode, Road, StopPoint }; | ||
import TrackerNet from './lib/trackerNet'; | ||
import TrackerNetLines from './lib/enums/lines'; | ||
import TrackerNetStations from './lib/enums/stationCodes'; | ||
export { AirQuality, BikePoint, Disruptions, Line, Mode, Road, StopPoint, TrackerNet, TrackerNetLines, TrackerNetStations }; | ||
import './tests/test'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StopPoint = exports.Road = exports.Mode = exports.Line = exports.Disruptions = exports.BikePoint = exports.AirQuality = void 0; | ||
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"); | ||
@@ -18,1 +18,8 @@ exports.AirQuality = airQuality_1.default; | ||
exports.StopPoint = stopPoint_1.default; | ||
var trackerNet_1 = require("./lib/trackerNet"); | ||
exports.TrackerNet = trackerNet_1.default; | ||
var lines_1 = require("./lib/enums/lines"); | ||
exports.TrackerNetLines = lines_1.default; | ||
var stationCodes_1 = require("./lib/enums/stationCodes"); | ||
exports.TrackerNetStations = stationCodes_1.default; | ||
require("./tests/test"); |
import TfLAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class AirQuality extends TfLAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
import TfLAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class BikePoint extends TfLAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
import TfLAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class Disruptions extends TfLAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
import TfLAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class Line extends TfLAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
import TfLAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class Mode extends TfLAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
import tflAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class Road extends tflAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
import TfLAPI from './tfl'; | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class StopPoint extends TfLAPI { | ||
@@ -4,0 +4,0 @@ constructor(config: interfaces.config); |
@@ -6,3 +6,3 @@ "use strict"; | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -9,0 +9,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import * as interfaces from './interfaces'; | ||
import * as interfaces from './interfaces/config'; | ||
export default class TfLAPI { | ||
@@ -14,2 +14,6 @@ config: interfaces.config | any; | ||
*/ | ||
sendRequestTrackerNet(uri: string, params: any, method: string): Promise<any>; | ||
/** | ||
* @ignore | ||
*/ | ||
objectToQuery(params: any): string; | ||
@@ -16,0 +20,0 @@ /** |
@@ -41,2 +41,3 @@ "use strict"; | ||
var qs = require("querystring"); | ||
var xml2js = require("xml2js"); | ||
var TfLAPI = /** @class */ (function () { | ||
@@ -80,2 +81,33 @@ function TfLAPI(config) { | ||
*/ | ||
TfLAPI.prototype.sendRequestTrackerNet = function (uri, params, method) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var FullURL, options, fetchReq, xml, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
FullURL = "http://cloud.tfl.gov.uk/TrackerNet" + uri; | ||
options = { | ||
method: method, | ||
headers: { | ||
Accept: 'application/xml', | ||
'cache-control': 'no-cache', | ||
}, | ||
}; | ||
return [4 /*yield*/, node_fetch_1.default(FullURL, options)]; | ||
case 1: | ||
fetchReq = _c.sent(); | ||
_b = (_a = xml2js).parseStringPromise; | ||
return [4 /*yield*/, fetchReq.text()]; | ||
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 3: | ||
xml = _c.sent(); | ||
console.log(fetchReq.url); | ||
return [2 /*return*/, xml]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* @ignore | ||
*/ | ||
TfLAPI.prototype.objectToQuery = function (params) { | ||
@@ -82,0 +114,0 @@ var x = Object.keys(params) |
{ | ||
"name": "tfl-api-wrapper", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "A Node JS wrapper for the Transport for London API", | ||
@@ -26,2 +26,3 @@ "main": "dist/index.js", | ||
"@types/node-fetch": "^2.5.7", | ||
"@types/xml2js": "^0.4.8", | ||
"typedoc": "^0.20.14", | ||
@@ -32,3 +33,4 @@ "typedoc-theme-dark": "0.0.5", | ||
"dependencies": { | ||
"node-fetch": "^2.6.1" | ||
"node-fetch": "^2.6.1", | ||
"xml2js": "^0.4.23" | ||
}, | ||
@@ -35,0 +37,0 @@ "directories": { |
@@ -9,5 +9,7 @@ <p align="center"> | ||
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/ZackaryH8/tfl-api-wrapper.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ZackaryH8/tfl-api-wrapper/context:javascript) | ||
![NPM Version](https://img.shields.io/npm/v/tfl-api-wrapper) | ||
![Issues](https://img.shields.io/github/issues/ZackaryH8/tfl-api-wrapper) | ||
![CI](https://img.shields.io/github/workflow/status/zackaryh8/tfl-api-wrapper/CI/master?label=tfldoc) | ||
[![NPM Version](https://img.shields.io/npm/v/tfl-api-wrapper)](https://www.npmjs.com/package/tfl-api-wrapper) | ||
[![Issues](https://img.shields.io/github/issues/ZackaryH8/tfl-api-wrapper)](https://github.com/ZackaryH8/tfl-api-wrapper/issues) | ||
## Installation | ||
@@ -14,0 +16,0 @@ ``` |
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
78203
35
2017
51
2
5
1
+ Addedxml2js@^0.4.23
+ Addedsax@1.4.1(transitive)
+ Addedxml2js@0.4.23(transitive)
+ Addedxmlbuilder@11.0.1(transitive)