All Projects → chrispanag → oasa-telematics-api

chrispanag / oasa-telematics-api

Licence: MIT License
The Athens' bus telematics API, complete with types and helper methods 🚌 🚌 🚌

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to oasa-telematics-api

adyen-dotnet-api-library
Adyen API Library for .NET
Stars: ✭ 69 (+263.16%)
Mutual labels:  api-client
start hacktoberfest2020
This repository is an initiative for beginners in Open source, the objective is to practice the first contribute a project, today the open-source projects are a great contribution to the world. Join the global community for the yearly celebration of open source software!
Stars: ✭ 14 (-26.32%)
Mutual labels:  hacktoberfest2020
siteleaf-node
Node library for Siteleaf v2 API
Stars: ✭ 14 (-26.32%)
Mutual labels:  api-client
youtube-deno
A Deno client library of the YouTube Data API.
Stars: ✭ 30 (+57.89%)
Mutual labels:  api-client
ContextIO-node
[DEPRECATED] - Official Node.js client library for the Context.IO Email API
Stars: ✭ 86 (+352.63%)
Mutual labels:  api-client
Fake Terminal Resume Website
A fake terminal website for coders
Stars: ✭ 57 (+200%)
Mutual labels:  hacktoberfest2020
legaldb
CC Legal Database: curated repository of Case Law and Scholarship data from around the world in a Django based website.
Stars: ✭ 22 (+15.79%)
Mutual labels:  hacktoberfest2020
c3
𝗖𝟯 provides compliant AWS CDK components to various security standards.
Stars: ✭ 24 (+26.32%)
Mutual labels:  hacktoberfest2020
go-kkbox
KKBOX Open API SDK for Golang.
Stars: ✭ 16 (-15.79%)
Mutual labels:  api-client
DeveloperFolio
A DevFolio/Developer Portfolio built using ReactJs and Animation libraries.
Stars: ✭ 51 (+168.42%)
Mutual labels:  hacktoberfest2020
thetvdb2
Thetvdb.com API v2 Client
Stars: ✭ 33 (+73.68%)
Mutual labels:  api-client
fusionauth-typescript-client
A TypeScript client for FusionAuth
Stars: ✭ 37 (+94.74%)
Mutual labels:  api-client
starcli
✨ Browse trending GitHub projects from your command line
Stars: ✭ 436 (+2194.74%)
Mutual labels:  hacktoberfest2020
vsphere-automation-sdk-rest
REST (Postman and JavaScript) samples and API reference documentation for vSphere using the VMware REST API
Stars: ✭ 194 (+921.05%)
Mutual labels:  api-client
hacktoberfest2020
Make your first PR. A beginner friendly repository made specifically for open source beginners. Add any program under any language (it can be anything from a simple program to a complex data structure algorithm). Happy coding...
Stars: ✭ 63 (+231.58%)
Mutual labels:  hacktoberfest2020
cbj app
📱 CyBear Jinni App is the app to control CyBear Jinni Hub 💡 remotely from your Android, IOS and Web Browser. If you have ever wondered "Is there an open-source project to make my own smart home?", This is part of one.
Stars: ✭ 68 (+257.89%)
Mutual labels:  hacktoberfest2020
GenomicDataCommons
Provide R access to the NCI Genomic Data Commons portal.
Stars: ✭ 64 (+236.84%)
Mutual labels:  api-client
purescript-swerve
Swerve is a library that offers a type-level DSL for describing server and client web applications. Inspired by Haskell's Servant library.
Stars: ✭ 20 (+5.26%)
Mutual labels:  api-client
solution-leedcode-codechef-codeforces-gfg-interviewbits-hackerEarth-HackerRank
This repo contain the solution of leetcode problem and divide into category like dynamic programming, linkedlist,recursion, graph and some other section
Stars: ✭ 18 (-5.26%)
Mutual labels:  hacktoberfest2020
poloniex-api
ARCHIVED --- A Go wrapper to the Poloniex API
Stars: ✭ 15 (-21.05%)
Mutual labels:  api-client

OASA Telematics API

npm npm GitHub Workflow Status

The (unofficial) Telematics API of Athens' public buses, complete with types and helper methods 🚌🚌🚌

This is the package that powers the popular greek messenger bot "Πότε έρχεται το λεωφορείο μου 🚌".

Getting Started

Install the package: $ npm i oasa-telematics-api

import { APIRequests, APIHelpers } from 'oasa-telematics-api';

const api = new APIRequests();
const b = new APIHelpers();

(async () => {
    // You can fetch all the lines:
    console.log("You can fetch all the lines...");
    console.log(await api.webGetLines());

    // You can fetch a single line:
    console.log("You can fetch a single line...");
    console.log(await b.findLine('140'));

    // You can fetch a stop of a line:
    console.log("You can fetch a stop of a line...");
    const line = await b.findLine('140');
    if (line) {
        const { directions } = await b.getDirectionsOfLine(line.LineCode)
        const [come, go ] = directions;
        console.log(await b.findStop('LAMIAS', come.RouteCodes));

        // Or in greek
        console.log("Or by searching in Greek...");
        console.log(await b.findStop('ΛΑΜΙΑΣ', come.RouteCodes));

        // Or by searching with a typo
        console.log("Or by searching with a typo...");
        console.log(await b.findStop('ΛΑΜΙΑ', come.RouteCodes));

        // And then you can check which buses are passing through that stop:
        console.log("And then you can check which buses are passing through that stop...");
        const stops = await b.findStop('ΛΑΜΙΑ', come.RouteCodes);
        if (stops.length > 0) {
            console.log(await api.getStopArrivals(stops[0].StopCode));
        }
    }
})();

You can explore more by visiting the (mostly auto-generated) docs here:

https://chrispanag.github.io/oasa-telematics-api/

Also, feel free to open an issue if you want to ask or suggest anything :)

Can I use my own request method?

Yes. The constructors APIRequests and APIHelpers can get a request function as an argument.

The request function will need to have the form:

export type RequestFunction = <T>(url: string, query: string, ...params: any[]) => Promise<T>;

You can see a reference request function here.

Why would I want to use my own request method?

Caching.

Also, see below...

Can I use this for frontend development?

Yes. But you'll need to create a custom request function using the browser fetch method instead of the default one installed (node-fetch). You can see the above question for more details.

Next Steps

  • Add tests
  • Add some more helper methods for schedule management
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].