Reseplaneraren - JavaScript client for reseplaneraren Provides access to Västtrafik journey planner This SDK is automatically generated by the Swagger Codegen project:
- API version: 1.10.1
- Package version: 1.10.1
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen For more information, please visit [email protected]
For Node.js
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install reseplaneraren --save
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
Finally, switch to the directory you want to use your reseplaneraren from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('reseplaneraren')
in javascript files from the directory you ran the last
command above from.
If the library is hosted at a git repository, e.g. https://github.com/YOUR_USERNAME/reseplaneraren then install it via:
npm install YOUR_USERNAME/reseplaneraren --save
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually
use this library):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Please follow the installation instruction and execute the following JS code:
var Reseplaneraren = require('reseplaneraren');
var api = new Reseplaneraren.ArrivalBoardApi()
var id = 789; // {Number} stop id
var _date = new Date("2013-10-20"); // {Date} the date
var time = "time_example"; // {String} the time in format HH:MM
var direction = 789; // {Number} stop id in order to get only departures of vehicles with a specified direction
var opts = {
'useVas': "useVas_example", // {String} to exclude trips with Västtågen, set this parameter to 0.
'useLDTrain': "useLDTrain_example", // {String} to exclude trips with long distance trains, set this parameter to 0.
'useRegTrain': "useRegTrain_example", // {String} to exclude trips with regional trains, set this parameter to 0.
'useBus': "useBus_example", // {String} to exclude trips with buses, set this parameter to 0.
'useBoat': "useBoat_example", // {String} to exclude trips with boats, set this parameter to 0.
'useTram': "useTram_example", // {String} to exclude trips with trams, set this parameter to 0.
'excludeDR': "excludeDR_example", // {String} to exclude journeys which require tel. registration, set this parameter to 0.
'timeSpan': 56, // {Number} to get the next departures in a specified timespan of up to 24 hours (unit: minutes). If this parameter is not set, the result will contain the next 20 departures.
'maxDeparturesPerLine': 56, // {Number} if timeSpan is set you can further reduce the number of returned journeys by adding this parameter, which will cause only the given number of journeys for every combination of line and direction.
'needJourneyDetail': "needJourneyDetail_example", // {String} if the reference URL for the journey detail service is not needed in the result, set this parameter to 0
'format': "format_example", // {String} the required response format
'jsonpCallback': "jsonpCallback_example" // {String} If JSONP response format is needed, you can append an additional parameter to specify the name of a callback function, and the JSON object will be wrapped by a function call with this name.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getArrivalBoard(id, _date, time, direction, opts, callback);
All URIs are relative to https://api.vasttrafik.se/bin/rest.exe/v2
Class | Method | HTTP request | Description |
---|---|---|---|
Reseplaneraren.ArrivalBoardApi | getArrivalBoard | GET /arrivalBoard | Return the next 20 arrivals (or less if not existing) from a given point in time or the next arrivals in a given timespan. |
Reseplaneraren.DepartureBoardApi | getDepartureBoard | GET /departureBoard | Return the next 20 departures (or less if not existing) from a given point in time or the next departures in a given timespan. |
Reseplaneraren.GeometryApi | getGeometry | GET /geometry | Returns the polyline for a leg. |
Reseplaneraren.JourneyDetailApi | getJourneyDetail | GET /journeyDetail | Returns information about the complete route of a trip. |
Reseplaneraren.LivemapApi | livemap | GET /livemap | Returns the positions of all vehicles in a given bounding box |
Reseplaneraren.LocationApi | getAllStops | GET /location.allstops | Returns a list of all stops available in the journey planner. |
Reseplaneraren.LocationApi | getLocationByName | GET /location.name | Returns a list of possible matches in the journey planner database |
Reseplaneraren.LocationApi | getNearbyAddress | GET /location.nearbyaddress | Returns the address nearest a given coordinate. |
Reseplaneraren.LocationApi | getNearbyStops | GET /location.nearbystops | Returns a list of stops around a given center coordinate. |
Reseplaneraren.SysteminfoApi | getSystemInfo | GET /systeminfo | Provides information about the journey planner and the underlying data |
Reseplaneraren.TripApi | getTrip | GET /trip | Calculates a trip from a specified origin to a specified destination. |
- Reseplaneraren.Arrival
- Reseplaneraren.ArrivalBoard
- Reseplaneraren.Color
- Reseplaneraren.CoordLocation
- Reseplaneraren.CreationDate
- Reseplaneraren.DateBegin
- Reseplaneraren.DateEnd
- Reseplaneraren.Departure
- Reseplaneraren.DepartureBoard
- Reseplaneraren.Destination
- Reseplaneraren.Direction
- Reseplaneraren.Geometry
- Reseplaneraren.GeometryRef
- Reseplaneraren.JourneyDetail
- Reseplaneraren.JourneyDetailRef
- Reseplaneraren.JourneyId
- Reseplaneraren.JourneyName
- Reseplaneraren.JourneyType
- Reseplaneraren.Leg
- Reseplaneraren.LiveMap
- Reseplaneraren.LocationList
- Reseplaneraren.Note
- Reseplaneraren.Notes
- Reseplaneraren.Origin
- Reseplaneraren.Point
- Reseplaneraren.Points
- Reseplaneraren.Stop
- Reseplaneraren.StopLocation
- Reseplaneraren.SystemInfo
- Reseplaneraren.TimeTableData
- Reseplaneraren.TimeTablePeriod
- Reseplaneraren.TimetableInfo
- Reseplaneraren.Trip
- Reseplaneraren.TripList
- Reseplaneraren.Vehicle
All endpoints do not require authorization.