Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fpl-api-node

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fpl-api-node - npm Package Compare versions

Comparing version 2.0.0-alpha.6 to 2.0.0-alpha.7

7

dist/data-service.d.ts

@@ -5,9 +5,8 @@ import * as types from './types';

export declare function getEntryTransfers(entryId: number): Promise<types.EntryTransfers>;
export declare function getTotalEntries(): Promise<number>;
export declare function getElements(): Promise<types.Player[]>;
export declare function getElementTypes(): Promise<types.ElementType[]>;
export declare function getElementTypes(): Promise<types.PlayerType[]>;
export declare function getEvents(): Promise<types.Gameweek[]>;
export declare function getTeams(): Promise<types.Team[]>;
export declare function getEventLive(eventNumber: number): Promise<types.LiveEvent>;
export declare function getClassicLeagueStandings(leagueId: number): Promise<types.League>;
export declare function getEventLive(eventNumber: number): Promise<types.LiveGameweek>;
export declare function getClassicLeagueStandings(leagueId: number): Promise<types.LeagueRoot>;
export declare function getBootstrapData(): Promise<types.BootstrappedData>;

@@ -18,10 +18,2 @@ "use strict";

exports.getEntryTransfers = getEntryTransfers;
function getTotalEntries() {
return new Promise(function (resolve, reject) {
getBootstrapData().then(function (data) {
resolve(data['total-players']);
});
});
}
exports.getTotalEntries = getTotalEntries;
function getElements() {

@@ -28,0 +20,0 @@ return getData('/elements');

@@ -11,4 +11,9 @@ import * as types from './types';

export declare function findGameweek(gameweek: number): Promise<types.Gameweek>;
export declare function findGameweekPlayerStats(gameweek: number): Promise<types.PlayerStatsMap>;
export declare function findTeams(): Promise<types.Team[]>;
export declare function findTeam(teamId: number): Promise<types.Team>;
export declare function findLeague(leagueId: number): Promise<types.League>;
export declare function findLeagueResults(leagueId: number): Promise<types.LeagueResult[]>;
export declare function getTotalNumberOfEntries(): Promise<number>;
export declare function getPlayerTypes(): Promise<types.PlayerType[]>;
export declare function getPlayerType(typeId: number): Promise<types.PlayerType>;

@@ -38,4 +38,4 @@ "use strict";

return new Promise(function (resolve, reject) {
dataService.getElements().then(function (data) {
resolve(data);
dataService.getBootstrapData().then(function (data) {
resolve(data.elements);
});

@@ -47,3 +47,3 @@ });

return new Promise(function (resolve, reject) {
dataService.getElements().then(function (elements) {
findPlayers().then(function (elements) {
var match = elements.find(function (element) {

@@ -67,4 +67,4 @@ return element.id === playerId;

return new Promise(function (resolve, reject) {
dataService.getEvents().then(function (data) {
resolve(data);
dataService.getBootstrapData().then(function (data) {
resolve(data.events);
});

@@ -76,3 +76,3 @@ });

return new Promise(function (resolve, reject) {
dataService.getEvents().then(function (events) {
findGameweeks().then(function (events) {
var match = events.find(function (event) {

@@ -86,6 +86,17 @@ return event.id === gameweek;

exports.findGameweek = findGameweek;
function findGameweekPlayerStats(gameweek) {
return new Promise(function (resolve, reject) {
dataService.getEventLive(gameweek).then(function (data) {
var playerStatsMap = Object.keys(data.elements).map(function (key) {
return data.elements[key].stats;
});
resolve(playerStatsMap);
});
});
}
exports.findGameweekPlayerStats = findGameweekPlayerStats;
function findTeams() {
return new Promise(function (resolve, reject) {
dataService.getTeams().then(function (data) {
resolve(data);
dataService.getBootstrapData().then(function (data) {
resolve(data.teams);
});

@@ -97,3 +108,3 @@ });

return new Promise(function (resolve, reject) {
dataService.getTeams().then(function (teams) {
findTeams().then(function (teams) {
var match = teams.find(function (team) {

@@ -107,2 +118,18 @@ return team.id === teamId;

exports.findTeam = findTeam;
function findLeague(leagueId) {
return new Promise(function (resolve, reject) {
dataService.getClassicLeagueStandings(leagueId).then(function (data) {
resolve(data.league);
});
});
}
exports.findLeague = findLeague;
function findLeagueResults(leagueId) {
return new Promise(function (resolve, reject) {
dataService.getClassicLeagueStandings(leagueId).then(function (data) {
resolve(data.standings.results);
});
});
}
exports.findLeagueResults = findLeagueResults;
function getTotalNumberOfEntries() {

@@ -116,1 +143,20 @@ return new Promise(function (resolve, reject) {

exports.getTotalNumberOfEntries = getTotalNumberOfEntries;
function getPlayerTypes() {
return new Promise(function (resolve, reject) {
dataService.getBootstrapData().then(function (data) {
resolve(data.element_types);
});
});
}
exports.getPlayerTypes = getPlayerTypes;
function getPlayerType(typeId) {
return new Promise(function (resolve, reject) {
getPlayerTypes().then(function (playerTypes) {
var match = playerTypes.find(function (playerType) {
return playerType.id === typeId;
});
resolve(match);
});
});
}
exports.getPlayerType = getPlayerType;

@@ -6,3 +6,3 @@ export interface BootstrappedData {

teams: Team[];
element_types: ElementType[];
element_types: PlayerType[];
events: Gameweek[];

@@ -102,3 +102,3 @@ }

}
export interface ElementType {
export interface PlayerType {
id: number;

@@ -143,9 +143,9 @@ singular_name: string;

}
export interface League {
export interface LeagueRoot {
new_entries: LeagueStandings;
league: LeagueDetails;
league: League;
standings: LeagueStandings;
update_status: number;
}
export interface LeagueDetails {
export interface League {
id: number;

@@ -422,16 +422,20 @@ leagueban_set: any[];

}
export interface LiveEvent {
export interface LiveGameweek {
fixtures: Fixture[];
elements: {
[key: number]: {
explain: Array<{
[key: string]: {
points: number;
name: string;
value: number;
};
}>;
stats: PlayerStats;
};
elements: GameweekPlayers;
}
export interface GameweekPlayers {
[key: number]: {
explain: Array<{
[key: string]: {
points: number;
name: string;
value: number;
};
}>;
stats: PlayerStats;
};
}
export interface PlayerStatsMap {
[key: number]: PlayerStats;
}
{
"name": "fpl-api-node",
"version": "2.0.0-alpha.6",
"version": "2.0.0-alpha.7",
"description": "A node wrapper for the Fantasy Premier League (fantasy.premierleague.com) restful web api",

@@ -47,3 +47,3 @@ "main": "dist/index.js",

"ts-node": "^3.3.0",
"ts-simple-ast": "^0.48.2",
"ts-simple-ast": "^0.49.0",
"tslint": "^5.5.0",

@@ -50,0 +50,0 @@ "typescript": "^2.4.2"

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