tfl-api-wrapper
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -5,5 +5,32 @@ import TfLAPI from './tfl'; | ||
constructor(config: interfaces.config); | ||
searchStopPoint(name: string, modes: string): Promise<any>; | ||
/** Get all service arrivals and departures */ | ||
/** | ||
* Search StopPoints by their common name. Will not return a valid NaPTAN for HUB | ||
* @param name Name of station | ||
* @param modes Eg. tfl, dlr | ||
*/ | ||
search(name: string, modes: string): Promise<any>; | ||
/** | ||
* Get all service arrivals and departures | ||
* @param id | ||
*/ | ||
listStationArrivals(id: string): Promise<any>; | ||
/** | ||
* Gets all disruptions for the specified StopPointId, plus disruptions for any child Naptan records it may have. | ||
* @param NaPTAN | ||
* @param getFamily Specify true to return disruptions for entire family, or false to return disruptions for just this stop point. Defaults to false. | ||
* @param flattenResponse Specify true to associate all disruptions with parent stop point. (Only applicable when getFamily is true). | ||
*/ | ||
getDisruptionsByNaPTAN(NaPTAN: string, getFamily: boolean, flattenResponse: boolean): Promise<any>; | ||
/** | ||
* Gets a distinct list of disrupted stop points for the given modes | ||
* @param modes An array of modes e.g. ['tube', 'dlr'] | ||
*/ | ||
getDisruptionsByMode(modes: Array<string>): Promise<any>; | ||
/** | ||
* Gets Stop points that are reachable from a station/line combination | ||
* @param NaPTAN | ||
* @param lineID Line id of the line to filter by (e.g. victoria) | ||
* @param serviceType Supported values: Regular, Night. Defaulted to 'Regular' if not specified | ||
*/ | ||
getReachableStationsByNaPTAN(NaPTAN: string, lineID: string, serviceType?: Array<string>): Promise<any>; | ||
} |
@@ -32,11 +32,54 @@ 'use strict'; | ||
} | ||
StopPoint.prototype.searchStopPoint = function (name, modes) { | ||
/** | ||
* Search StopPoints by their common name. Will not return a valid NaPTAN for HUB | ||
* @param name Name of station | ||
* @param modes Eg. tfl, dlr | ||
*/ | ||
StopPoint.prototype.search = function (name, modes) { | ||
return this.sendRequest('/StopPoint/Search/' + name, {}, 'GET'); | ||
}; | ||
/** Get all service arrivals and departures */ | ||
/** | ||
* Get all service arrivals and departures | ||
* @param id | ||
*/ | ||
StopPoint.prototype.listStationArrivals = function (id) { | ||
return this.sendRequest('/StopPoint/' + id + '/Arrivals', {}, 'GET'); | ||
}; | ||
/** | ||
* Gets all disruptions for the specified StopPointId, plus disruptions for any child Naptan records it may have. | ||
* @param NaPTAN | ||
* @param getFamily Specify true to return disruptions for entire family, or false to return disruptions for just this stop point. Defaults to false. | ||
* @param flattenResponse Specify true to associate all disruptions with parent stop point. (Only applicable when getFamily is true). | ||
*/ | ||
StopPoint.prototype.getDisruptionsByNaPTAN = function (NaPTAN, getFamily, flattenResponse) { | ||
return this.sendRequest( | ||
'/StopPoint/' + NaPTAN + '/Disruption', | ||
{ | ||
getFamily: getFamily, | ||
flattenResponse: flattenResponse, | ||
}, | ||
'GET' | ||
); | ||
}; | ||
/** | ||
* Gets a distinct list of disrupted stop points for the given modes | ||
* @param modes An array of modes e.g. ['tube', 'dlr'] | ||
*/ | ||
StopPoint.prototype.getDisruptionsByMode = function (modes) { | ||
return this.sendRequest('/StopPoint/' + this.arrayToCSV(modes) + '/Disruption', {}, 'GET'); | ||
}; | ||
/** | ||
* Gets Stop points that are reachable from a station/line combination | ||
* @param NaPTAN | ||
* @param lineID Line id of the line to filter by (e.g. victoria) | ||
* @param serviceType Supported values: Regular, Night. Defaulted to 'Regular' if not specified | ||
*/ | ||
StopPoint.prototype.getReachableStationsByNaPTAN = function (NaPTAN, lineID, serviceType) { | ||
if (serviceType === void 0) { | ||
serviceType = ['Regular']; | ||
} | ||
return this.sendRequest('/StopPoint/' + NaPTAN + '/CanReachOnLine/' + lineID, { serviceTypes: serviceType }, 'GET'); | ||
}; | ||
return StopPoint; | ||
})(tfl_1.default); | ||
exports.default = StopPoint; |
@@ -7,5 +7,14 @@ import * as interfaces from './interfaces'; | ||
constructor(config: interfaces.config); | ||
/** | ||
* @ignore | ||
*/ | ||
sendRequest(uri: string, params: any, method: string): Promise<any>; | ||
/** | ||
* @ignore | ||
*/ | ||
objectToQuery(params: any): string; | ||
/** | ||
* @ignore | ||
*/ | ||
arrayToCSV(arr: Array<string | number>): string; | ||
} |
@@ -128,2 +128,5 @@ 'use strict'; | ||
} | ||
/** | ||
* @ignore | ||
*/ | ||
TfLAPI.prototype.sendRequest = function (uri, params, method) { | ||
@@ -156,2 +159,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* @ignore | ||
*/ | ||
TfLAPI.prototype.objectToQuery = function (params) { | ||
@@ -166,2 +172,5 @@ var x = Object.keys(params) | ||
}; | ||
/** | ||
* @ignore | ||
*/ | ||
TfLAPI.prototype.arrayToCSV = function (arr) { | ||
@@ -168,0 +177,0 @@ return arr.join(','); |
@@ -6,8 +6,8 @@ 'use strict'; | ||
var line = new line_1.default({ | ||
apiKey: '', | ||
appID: 'd', | ||
app_key: '', | ||
app_id: 'd', | ||
}); | ||
var stopPoint = new stopPoint_1.default({ | ||
apiKey: '', | ||
appID: 'd', | ||
app_key: '', | ||
app_id: 'd', | ||
}); | ||
@@ -14,0 +14,0 @@ stopPoint.listStationArrivals('940GZZLUHSC').then(function (res) { |
{ | ||
"name": "tfl-api-wrapper", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A Node JS wrapper for the Transport for London API", | ||
@@ -14,3 +14,3 @@ "main": "dist/index.js", | ||
"build-docs": "typedoc --options", | ||
"watch": "nodemon dist/lib/index.js" | ||
"watch": "nodemon dist/index.js" | ||
}, | ||
@@ -17,0 +17,0 @@ "keywords": [ |
@@ -7,2 +7,4 @@ <p align="center"> | ||
`npm install tfl-api-wrapper` | ||
## Documentation | ||
@@ -9,0 +11,0 @@ [Click here](https://tfldoc.dparture.cc/) |
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
36
33048
18
1172