tbav3

1.1.2 • Public • Published

tbav3

Node.js wrapper for The Blue Alliance api.


Another one?!

This API was inspired by frc7308's bluealliance bindings, and uses many of their concepts and naming conventions, but as I looked through their code, I decided that I needed a rewrite based more on node.js, using built-in libraries (namely https rather than 3rd-party XMLHttpRequest), removing class-like function calls (ex:)

var team;
tba.getTeam(4418).then((team) => {
    tba.getEventsForTeam(team).then((events) => {
        doSomething(events);
    });
});

(translates to java as:)

new EventsForTeam(new Team(4418));

which makes it much simpler for someone with background in java to pick it up. You should definitely check theirs out though, if you are more java-minded and want things to work like your robot code with less of a learning curve. This api attempts to rewrite the one from frc7308 to conform to Node.js coding practices.

Documentation

Declaration

var tba = new (require("tbav3"))("api_key");
//or
var BlueAlliance = require("tbav3");
var tba = new BlueAlliance("api_key");

Methods (Better descriptions coming soon)

tba.callTBA(request).then((data) => {
    doStuff(data);
});
tba.getTeam(teamNumber).then((team) => {
    doStuff(team);
});
tba.getTeamAtEvent(teamNumber,eventCode,/*optional*/ year).then((rankings) => {
    doStuff(rankings);
});
tba.getMatchesForTeam(teamNumber,eventCode,/*optional*/ year).then((matches) => {
    doStuff(matches); //Pre-sorted in chronological order
});
tba.getNextMatch(teamNumber,eventCode).then((match) => {
    doStuff(match);
});

Package Sidebar

Install

npm i tbav3

Weekly Downloads

1

Version

1.1.2

License

Unlicense

Unpacked Size

6.6 kB

Total Files

4

Last publish

Collaborators

  • sploders101