Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/the-orange-alliance/the-orange-alliance-nodejs

🛠 A Node.js wrapper for The Orange Alliance API
https://github.com/the-orange-alliance/the-orange-alliance-nodejs

first first-tech-challenge ftc node the-orange-alliance toa typescript

Last synced: about 1 month ago
JSON representation

🛠 A Node.js wrapper for The Orange Alliance API

Awesome Lists containing this project

README

        

# The Orange Alliance Node.js

A Node.js wrapper for The Orange Alliance API

[![Travis](https://img.shields.io/travis/com/orange-alliance/the-orange-alliance-nodejs)](https://travis-ci.com/github/orange-alliance/the-orange-alliance-nodejs)
[![Version](https://img.shields.io/npm/v/@the-orange-alliance/api?label=Version)](https://www.npmjs.com/package/@the-orange-alliance/api)
[![GitHub issues](https://img.shields.io/github/issues/orange-alliance/the-orange-alliance-nodejs)](https://github.com/orange-alliance/the-orange-alliance-nodejs/issues)

> Note: Only supports the GET API currently.

## Install
```
$ npm install @the-orange-alliance/api
```

## Usage

Using the API is simple. Just create an instance of the API class, passing in your auth key and the name of your app.
From there, call any of the methods to retrieve the data from the API.

All the requests will return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) of the model.

```ts
import { API } from "@the-orange-alliance/api";
// OR const { API } = require("@the-orange-alliance/api")

const toa = new API("YOUR_AUTH_KEY_HERE", "Name your app");

const event = await toa.getEvent("1920-FIM-KFQ");
console.log(event.eventName);

// OR

toa.getEvent("1920-FIM-KFQ").then(event => {
console.log(event.eventName);
});
```

#### API Key
Generate your API Key on your [myTOA Account Dashboard](https://theorangealliance.org/account).

Use that key in the initialization for your API object.

## API

#### toa.getAPI(): ``Promise``
#### toa.getSeasons(): ``Promise``
#### toa.getRegions(): ``Promise``
#### toa.getStreams(): ``Promise``

#### toa.getEvents({league_key?, region_key?, season_key?, type?}): ``Promise``
#### toa.getEventCount(): ``Promise``
#### toa.getEvent(eventKey): ``Promise``
#### toa.getEventMatches(eventKey): ``Promise``
#### toa.getEventMatchDetails(eventKey): ``Promise``
#### toa.getEventMatchParticipants(eventKey): ``Promise``
#### toa.getEventRankings(eventKey): ``Promise``
#### toa.getEventInsights(eventKey, type?): ``Promise``
#### toa.getEventAlliances(eventKey): ``Promise``
#### toa.getEventStreams(eventKey): ``Promise``
#### toa.getEventTeams(eventKey): ``Promise``
#### toa.getEventAwards(eventKey): ``Promise``
#### toa.getEventMedia(eventKey): ``Promise``

#### toa.getSeasonMatches(seasonKey, start?, count?): ``Promise``
#### toa.getSeasonMatchCount(): ``Promise``
#### toa.getHighScoreMatch(type: quals|elims|all): ``Promise``
#### toa.getMatch(matchKey): ``Promise``
#### toa.getMatchDetails(matchKey): ``Promise``
#### toa.getMatchParticipants(matchKey): ``Promise``

#### toa.getTeams(): ``Promise``
#### toa.getSeasonTeams(seasonKey): ``Promise``
#### toa.getTeamCount(): ``Promise``
#### toa.getTeam(teamKey): ``Promise``
#### toa.getSeasonTeam(teamKey, seasonKey): ``Promise``
#### toa.getTeamWLT(teamKey): ``Promise``
#### toa.getTeamEvents(teamKey, seasonKey): ``Promise``
#### toa.getTeamMatches(teamKey, seasonKey): ``Promise``
#### toa.getTeamAwards(teamKey, seasonKey): ``Promise``
#### toa.getTeamRankings(teamKey, seasonKey): ``Promise``
#### toa.getTeamMedia(teamKey, seasonKey): ``Promise``

#### toa.getLeagues(region_key?, season_key?): ``Promise``
#### toa.getLeague(getLeague): ``Promise``
#### toa.getLeagueDivisions(): ``Promise``