Git Product home page Git Product logo

goemt's Introduction

GoEMT library

Go Doc Go Doc Go Report Card Releases LICENSE

Image of GoEMT

This project aims to implement the Go bindings for the EMT Rest API.
The EMT is the public transportation company from Madrid city. Using this API can be useful for getting live information from the service (waiting times, stop locations, etc). For full Rest API referece, please reffer to HERE.

IMPORTANT - So far it implements the Block 1 (User identity for login) and Block 3 (Transport BusEMTMad). If this project makes sense for somebody, we can continue implementing the rest of the API.

To start using it, we have to create a APIClient struct. To do so, first a ClientConfig struct needs to be created with your credentials:

config := goemt.ClientConfig{
		Enpoint:   "https://openapi.emtmadrid.es/v2",
		XClientID: "YOUR_XCLIENTID",
		PassKey:   "YOUR_PASSKEY",

*There are three kind of autentication. Basic, advanced and protected. The one used in the example is protected. Depending on which values from the ClientConfig struct are set, one or another will be used. Please reffer to HERE to check which values your need to set for each login method.

Once a config struct is created, the Connect() function must be used to log in:

api, err := goemt.Connect(config)
	if err != nil {
		panic(err)
	}
	defer api.Logout()

    //Do your thing

Once you're logged in the platform, you can use the different functions from busemtmad package (I.E. GetTimeArrivalBus() (Check the examples folder for some example of using the API), which returns waiting times). When you are done, use the Logout() method from the APIClient to close the session agains the EMT server.

Pull requests more than welcome!

Known issues:

  • GetTimeTableStartStop function doesn't work because platform returns Error code 90: Error managing internal services

Miguel Sama 2020 ([email protected])
GoEMT logo by Marta Recio ([email protected])

goemt's People

Contributors

mikeletux avatar

Stargazers

 avatar  avatar

Watchers

 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.