Coder Social home page Coder Social logo

reseplanerare's Introduction

reseplaneraren

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]

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install reseplaneraren --save
Local development

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.

git

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

For browser

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.

Webpack Configuration

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
      }
    }
  ]
}

Getting Started

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);

Documentation for API Endpoints

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.

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

reseplanerare's People

Contributors

joaqim avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.