New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-aaf-api

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-aaf-api

NodeJS wrapper for the AAF API.

  • 0.0.30
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

node-aaf-api

(Simple) NodeJS wrapper for the AAF GraphQL API.

Install

npm i node-aaf-api

Examples

You can find several examples in the examples directory. To run them, use (for example):

node examples/getFullSeasonStatsByTeam.js

Use

Require node-aaf-api:

const nodeAafApi = require('node-aaf-api');

Custom queries

If you want to send your custom GraphQL queries, use the query function:

// Get all Quarterbacks, grouped by team
let requestPayload = {
    query: `{
              teams: teamsConnection {
                nodes {
                  __typename
                  id
                  name
                  abbreviation
                  quarterbacks: playersConnection(position: QUARTERBACK) {
                    nodes {
                      id
                      name {
                        givenName
                        familyName
                      }
                    }
                  }
                }
              }
            }`
};

nodeAafApi.query(requestPayload, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Predefined queries

For convenience, some common GraphQL queries - like getting game, team or player stats - are already wrapped:

Get all teams
nodeAafApi.getTeams((response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get all scheduled season games
nodeAafApi.getSeasonScheduleGames((response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get games (by date range)
let dateRange = {
    from: '2019-02-10T14:26:28.507Z',
    to: '2019-02-11T02:26:28.507Z'
};

nodeAafApi.getGamesByDateRange(dateRange, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get live games (by date range)
let dateRange = {
    from: '2019-02-10T14:26:28.507Z',
    to: '2019-02-11T02:26:28.507Z'
};

nodeAafApi.getLiveGamesByDateRange(dateRange, (response) => {
    console.log(response.data);
});
Get live game data (by gameId)
let gameId = 'GjoCxWXQfvKpZuFlqeOgB5I-ceJn';

nodeAafApi.getLiveGameData(gameId, (response) => {
    console.log(response.data);
});
Get feed of game plays a.k.a. live ticker (by gameId)
let gameId = 'GjoCxWXQfvKpZuFlqeOgB5I-ceJn';

nodeAafApi.getPlayFeedByGame(gameId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get game stats by player (by gameId)
let gameId = 'GjoCxWXQfvKpZuFlqeOgB5I-ceJn';

nodeAafApi.getFullGameStatsByPlayer(gameId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get game stats by team (by gameId)
let gameId = 'GjoCxWXQfvKpZuFlqeOgB5I-ceJn';

nodeAafApi.getFullGameStatsByTeam(gameId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get full season team stats (by teamId)
let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getFullSeasonStatsByTeam(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get full season player stats by team (by teamId)
let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getFullSeasonStatsByTeamByPlayer(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get basic team info (by teamId)

No season stats, players & games infos included. Use getTeamInfo for complete team details.

let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getTeamInfoBasic(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get full team info (by teamId)

Incl. complete season stats, players & games details/infos

let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getTeamInfo(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get all games by team (by teamId)
let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getGamesByTeam(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get roster by team (by teamId)

Grouped by offense, defense, special teams & coaches

let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getRosterByTeam(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Get all players by team (by teamId)

Not grouped (unlike getRosterByTeam) + no coaching stuff included. Just a simple list of all team players with basic info.

let teamId = 'DKY1420EnDNa1FwBlyC8sAV_1ft6';

nodeAafApi.getPlayersByTeam(teamId, (response) => {
    console.log(response.data);
});

See query/result in AAF API explorer

Keywords

FAQs

Package last updated on 20 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc