Code Monkey home page Code Monkey logo

transport-api-client's Introduction

Transport API Client

This is a non-official client library providing some objects and functions for the Opendata Transport API. The API offers information about the public transport in Switzerland for free (there's still a request limit...). Read their docs and examples for more details about the API itself. The API is open source, too.

Getting Started

Just import the TransportApiClient class. It provides some methods for getting data from the API. requestSomething methods return a Request object, which provides methods for request parameterization. getSomething methods return the result of a predefined request. You always end up getting a promise after sending the request.

In the following NodeJS example, both requests respond the same result.

const { TransportApiClient } = require('transport-api-client');
const tac = new TransportApiClient();

tac.getStationsIn('Basel')
    .then(response => console.log(response))
    .catch(error => console.error(error));

tac.requestLocationsByName('Basel')
    .send()
    .then(response => console.log(response))
    .catch(error => console.error(error));

Develop

Sources are written in TypeScript, Gulp is used as task runner and Mocha with Chai is used for unit testing.

Build

gulp build

Test

npm test

transport-api-client's People

Contributors

robingoeppert avatar

Stargazers

 avatar

Watchers

 avatar

transport-api-client's Issues

URL build

save request params in map and build url completely in send()

Base URL persistence

Currently, the base URL for the API is hard coded. But there is the possibility to host an own API Server, so it would be a nice feature to set the API URL as parameter.

  • Config file, which will be loaded on instantiating the TransportApiClient class

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.