JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q43217F
  • License MIT

This library is clean and tested wrapper for the FantasyData.com api.

Package Exports

  • fantasydata-api

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fantasydata-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fantasydata-api

This library is a wrapper for the FantasyData.com's api. Fully tested using mocha.

v0.2.4 Build Status

NPM

##Intro This wrapper provides a simple way of interacting with the exposed methods of FantasyData's api. It can be used both on the client(1) and the server. Both are generated from the same code base and are validated via the same mocha tests.

(1) Please note that most modern browsers will not allow cross origin requests, so unfortunately the client library will not function as expected in these cases. There is currently an open issue regarding this restriction.

##Installation ###Server This can easily be installed via npm

npm install fantasydata-api

###Client

<script src="./client/fantasydata-api.js"></script>

##Options

var options = {
  protocol: 'http',
  url: 'api.nfldata.apiphany.com',
  level: 'developer',
  timeout: 10000,
  key: '' // <-- Pass in your key here
};

##Example Usage

Server

var fantasyData = require('fantasydata-api')(options);

var season = '2014REG';
fantasyData.Byes(season, function(err, results){
  console.log(JSON.stringify(results, null, 2));
});

Client

<script>
  fantasyData.Options(options);

  var season = '2014REG';
  fantasyData.Byes(season, function(err, results){
    console.log(JSON.stringify(results, null, 2));
  });
</script>

##Parameters

  • season

    • Year of the season and the season type. If no season type is provided, then the default is regular season.
    • e.g., 2013REG, 2013PRE, 2013POST, 2013, etc
  • week

    • Integer representing a given week
    • Valid values are: Preseason 0 to 4, Regular Season 1 to 17, Postseason 1 to 4.
  • team

    • The unique abbreviation for a given team
    • e.g., IND, ARI, NO, GB, etc
  • statColumn

    • Any given numerical stat column on a PlayerGame object
    • PassingYards, ReceivingTargets, RushingTouchdowns, etc
  • position

    • A given player's position
    • Valid values are QB, RB, WR, TE, K, P, DL, LB, DB and in Match Player cases DE, DT, C, G, CB, OLB, S as well
  • timeFrameType

    • The type of timeframes to return.
    • Valid types are current, upcoming, completed, recent, all. Visit the timeframe documentation for more info.
  • playerId

    • The integer identifier for a given player
    • e.g., 732
  • minutes

    • Currently only used by the RecentlyUpdatedBoxScores method
    • The integer representing the time in minutes to look back for updates
    • e.g., 1,2,5,10
  • searchCriteria

    • Currently only used by the MatchPlayer method
    var searchCriteria = {
      team: 'IND',
      firstName: 'Andrew',
      lastName: 'Luck',
      fullName: null,
      number: null,
      dob: null,
      position: 'QB',
      college: null
    };

##Methods

For more information as to what each method returns, take a look at the official documentation.

###Helpers

  • Options() - Get the current options
  • Options(options) - Set the options

###API All methods are asynchronous and require the last parameter to be a callback function function(err, results) {}.

  • ActiveBoxScores(callback)
  • AreAnyGamesInProgress(callback)
  • BoxScore(season, week, homeTeam, callback)
  • BoxScores(season, week, callback)
  • Byes(season)(callback)
  • CurrentSeason(callback)
  • CurrentWeek(callback)
  • FantasyDefenseByGame(season, week, callback)
  • FantasyDefenseBySeason(season, callback)
  • FantasyDefenseProjectionsByGame(season, week, callback)
  • FantasyPlayers(callback)
  • FinalBoxScores(callback)
  • FreeAgents(callback)
  • GameLeagueLeaders(season, week, position, statColumn, callback)
  • GameStats(season, callback)
  • GameStatsByWeek(season, week, callback)
  • GetErrorSample(callback)
  • InjuriesByTeam(season, week, team, callback)
  • InjuriesByWeek(season, week, callback)
  • LastCompletedSeason(callback)
  • LastCompletedWeek(callback)
  • LiveBoxScores(callback)
  • MatchPlayer(searchCriteria, callback)
  • News(callback)
  • NewsByPlayerId(playerId, callback)
  • NewsByTeam(team, callback)
  • Player(playerId, callback)
  • PlayerGameProjectionStatsByTeam(season, week, team, callback)
  • PlayerGameStatsByPlayerId(season, week, playerId, callback)
  • PlayerGameStatsByTeam(season, week, team, callback)
  • PlayerGameStatsByWeek(season, week, callback)
  • PlayerSeasonStatsByPlayerId(season, playerId, callback)
  • PlayerSeasonStatsByTeam(season, team, callback)
  • RecentlyUpdatedBoxScores(minutes, callback)
  • Schedules(season, callback)
  • Scores(season,callback)
  • ScoresByWeek(season, week, callback)
  • SeasonLeagueLeaders(season, position, statColumn, callback)
  • Stadiums(callback)
  • Standings(season, callback)
  • TeamGameStats(season, week, callback)
  • TeamRoster(team, callback)
  • TeamSeasonStats(season, callback)
  • Teams(callback)
  • TeamsBySeason(season, callback)
  • Timeframes(timeFrameType, callback)
  • UpcomingSeason(callback)
  • UpcomingWeek(callback)

The MIT License (MIT)

Copyright (c) 2014 Nate Clark

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.