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 1.0.9 to 1.0.10

335

dist/index.d.ts

@@ -1,102 +0,93 @@

export declare class FplApi {
/**
* Entry (Fpl manager team):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/history
* @param entryId Entry id
* @returns {Promise}
*/
static getEntry(entryId: number): Promise<IApiEntry>;
/**
* Entry event:
* Details of a particular event (or gameweek):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/event/${eventNumber}
* @param entryId Entry id
* @param eventNumber The event / gameweek number
* @returns {Promise}
*/
static getEntryEvent(entryId: number, eventNumber: number): Promise<IApiEntryEvent>;
/**
* Entry transfers:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/transfers
* @param entryId Entry id
* @returns {Promise}
*/
static getEntryTransfers(entryId: number): Promise<IApiEntryTransfers>;
/**
* All static game data:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/bootstrap-static
* @returns {Promise}
*/
static getAllStaticData(): Promise<IApiAllStaticData>;
/**
* Teams (Premier Leaugue clubs):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/teams
* @returns {Promise}
*/
static getTeams(): Promise<IApiTeam[]>;
/**
* Elements (players):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements
* @returns {Promise}
*/
static getElements(): Promise<IApiElement[]>;
/**
* Element types: A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements-types
* @returns {Promise}
*/
static getElementTypes(): Promise<IApiElementType[]>;
/**
* Game settings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/game-settings
* @returns {Promise}
*/
static getGameSettings(): Promise<IApiGameSettings>;
/**
* Event /gameweek details:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/event/${eventNumber}/live
* @returns {Promise}
*/
static getEvent(eventNumber: number): Promise<IApiEvent>;
/**
* Classic league standings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/leagues-classic-standings/${id}
* @param leagueId League id
* @returns {Promise}
*/
static getClassicLeagueStandings(leagueId: number): Promise<IApiLeague>;
/**
* Returns a promise that if fulfilled returns json object mapped to the given request
* @param path The path of the rest web api request
* @returns {Promise}
* @private
*/
private static fetchData(path);
}
/**
* Export interfaces
* Entry (Fpl manager team):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/history
* @param entryId Entry id
* @returns {Promise}
*/
export interface IApiAllStaticData {
phases: IApiGamePhase[];
elements: IApiElement[];
'game-settings': IApiGame;
export declare function fetchEntry(entryId: number): Promise<Entry>;
/**
* Entry event:
* Details of a particular event (or gameweek):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/event/${eventNumber}
* @param entryId Entry id
* @param eventNumber The event / gameweek number
* @returns {Promise}
*/
export declare function fetchEntryEvent(entryId: number, eventNumber: number): Promise<EntryEvent>;
/**
* Entry transfers:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/transfers
* @param entryId Entry id
* @returns {Promise}
*/
export declare function fetchEntryTransfers(entryId: number): Promise<EntryTransfers>;
/**
* All static game data:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/bootstrap-static
* @returns {Promise}
*/
export declare function fetchBootstrapStatic(): Promise<BootstrapStatic>;
/**
* Teams (Premier Leaugue clubs):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/teams
* @returns {Promise}
*/
export declare function fetchTeams(): Promise<Team[]>;
/**
* Elements (players):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements
* @returns {Promise}
*/
export declare function fetchElements(): Promise<Element[]>;
/**
* Element types: A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements-types
* @returns {Promise}
*/
export declare function fetchElementTypes(): Promise<ElementType[]>;
/**
* Game settings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/game-settings
* @returns {Promise}
*/
export declare function fetchGameSettings(): Promise<GameSettings>;
/**
* Event /gameweek details:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/event/${eventNumber}/live
* @returns {Promise}
*/
export declare function fetchEvent(eventNumber: number): Promise<Event>;
/**
* Classic league standings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/leagues-classic-standings/${id}
* @param leagueId League id
* @returns {Promise}
*/
export declare function fetchClassicLeagueStandings(leagueId: number): Promise<League>;
/**
* Interfaces
*/
export interface BootstrapStatic {
phases: GamePhase[];
elements: Element[];
'game-settings': Game;
'total-players': number;
teams: IApiTeam[];
element_types: IApiElementType[];
events: IApiGameEvent[];
teams: Team[];
element_types: ElementType[];
events: GameEvent[];
}
export interface IApiGameSettings {
game: IApiGame;
element_type: IApiGameElement;
export interface GameSettings {
game: Game;
element_type: GameElement;
}
export interface IApiGameEvent {
export interface GameEvent {
id: number;

@@ -117,3 +108,3 @@ name: string;

}
export interface IApiGame {
export interface Game {
scoring_ea_index: number;

@@ -191,3 +182,3 @@ league_prefix_public: string;

league_join_public_max: number;
formations: IApiGameFormations;
formations: GameFormations;
league_points_h2h_lose: number;

@@ -213,3 +204,3 @@ currency_decimal_places: number;

}
export interface IApiGameElement {
export interface GameElement {
scoring_clean_sheets: number;

@@ -224,3 +215,3 @@ squad_min_play: number;

}
export interface IApiGamePhase {
export interface GamePhase {
id: number;

@@ -231,3 +222,3 @@ name: string;

}
export interface IApiGameFormations {
export interface GameFormations {
'1-5-2-3': number[][];

@@ -243,3 +234,3 @@ '1-5-3-2': number[][];

}
export interface IApiElement {
export interface Element {
id: number;

@@ -303,3 +294,3 @@ photo: string;

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

@@ -311,6 +302,6 @@ singular_name: string;

}
export interface IApiTeam {
export interface Team {
id: number;
current_event_fixture: IApiTeamFixture[];
next_event_fixture: IApiTeamFixture[];
current_event_fixture: TeamFixture[];
next_event_fixture: TeamFixture[];
name: string;

@@ -337,3 +328,3 @@ code: number;

}
export interface IApiTeamFixture {
export interface TeamFixture {
is_home: boolean;

@@ -346,9 +337,9 @@ month: number;

}
export interface IApiLeague {
new_entries: IApiLeagueStandings;
league: IApiLeagueDetails;
standings: IApiLeagueStandings;
export interface League {
new_entries: LeagueStandings;
league: LeagueDetails;
standings: LeagueStandings;
update_status: number;
}
export interface IApiLeagueDetails {
export interface LeagueDetails {
id: number;

@@ -370,3 +361,3 @@ leagueban_set: any[];

}
export interface IApiLeagueStandings {
export interface LeagueStandings {
has_next: boolean;

@@ -392,25 +383,25 @@ number: number;

}
export interface IApiEntry {
chips: IApiEntryChip[];
entry: IApiEntryDetails;
leagues: IApiEntryLeagues;
season: IApiEntrySeason[];
history: IApiEntryHistory[];
export interface Entry {
chips: EntryChip[];
entry: EntryDetails;
leagues: EntryLeagues;
season: EntrySeason[];
history: EntryHistory[];
}
export interface IApiEntryEvent {
leagues: IApiEntryLeagues;
entry_history: IApiEntryHistory;
export interface EntryEvent {
leagues: EntryLeagues;
entry_history: EntryHistory;
ce: number;
automatic_subs: IApiEntryAutomaticSub[];
fixtures: IApiFixture[];
automatic_subs: EntryAutomaticSub[];
fixtures: Fixture[];
can_change_captain: boolean;
manager_subs: any[];
picks: IApiEntryPick[];
picks: EntryPick[];
own_entry: boolean;
state: IApiEntryState;
state: EntryState;
points: number;
entry: IApiEntryDetails;
entry: EntryDetails;
active_chip: string;
}
export interface IApiEntryState {
export interface EntryState {
event: number;

@@ -422,3 +413,3 @@ sub_state: string;

}
export interface IApiEntryPick {
export interface EntryPick {
element: number;

@@ -435,6 +426,6 @@ position: number;

element_type: number;
stats: IApiStats;
stats: Stats;
multiplier: number;
}
export interface IApiEntryAutomaticSub {
export interface EntryAutomaticSub {
id: number;

@@ -446,3 +437,3 @@ element_in: number;

}
export interface IApiEntryDetails {
export interface EntryDetails {
id: number;

@@ -479,3 +470,3 @@ player_first_name: string;

}
export interface IApiEntryLeague {
export interface EntryLeague {
id: number;

@@ -505,8 +496,8 @@ entry_rank: number;

}
export interface IApiEntryLeagues {
cup: IApiEntryLeague[];
h2h: IApiEntryLeague[];
classic: IApiEntryLeague[];
export interface EntryLeagues {
cup: EntryLeague[];
h2h: EntryLeague[];
classic: EntryLeague[];
}
export interface IApiEntryChip {
export interface EntryChip {
played_time_formatted: string;

@@ -520,3 +511,3 @@ status: string;

}
export interface IApiEntrySeason {
export interface EntrySeason {
id: number;

@@ -529,3 +520,3 @@ season_name: string;

}
export interface IApiEntryHistory {
export interface EntryHistory {
id: number;

@@ -547,9 +538,9 @@ movement: string;

}
export interface IApiEntryTransfers {
wildcards: IApiEntryWildcard[];
entry: IApiEntry;
leagues: IApiEntryLeagues;
history: IApiEntryTransferHistory[];
export interface EntryTransfers {
wildcards: EntryWildcard[];
entry: Entry;
leagues: EntryLeagues;
history: EntryTransferHistory[];
}
export interface IApiEntryWildcard {
export interface EntryWildcard {
played_time_formatted: string;

@@ -563,3 +554,3 @@ status: string;

}
export interface IApiEntryTransferHistory {
export interface EntryTransferHistory {
id: number;

@@ -575,3 +566,3 @@ time_formatted: string;

}
export interface IApiStats {
export interface Stats {
yellow_cards: number;

@@ -597,3 +588,3 @@ own_goals: number;

}
export interface IApiFixture {
export interface Fixture {
id: number;

@@ -605,3 +596,3 @@ kickoff_time_formatted: string;

deadline_time_formatted: string;
stats: IApiFixtureStats;
stats: FixtureStats;
code: number;

@@ -619,33 +610,33 @@ kickoff_time: Date;

}
export interface IApiFixtureStats {
goals_scored: IApiFixtureStatHomeAndAway;
assists: IApiFixtureStatHomeAndAway;
own_goals: IApiFixtureStatHomeAndAway;
penalties_saved: IApiFixtureStatHomeAndAway;
penalties_missed: IApiFixtureStatHomeAndAway;
yellow_cards: IApiFixtureStatHomeAndAway;
red_cards: IApiFixtureStatHomeAndAway;
saves: IApiFixtureStatHomeAndAway;
bonus: IApiFixtureStatHomeAndAway;
bps: IApiFixtureStatHomeAndAway;
export interface FixtureStats {
goals_scored: FixtureStatHomeAndAway;
assists: FixtureStatHomeAndAway;
own_goals: FixtureStatHomeAndAway;
penalties_saved: FixtureStatHomeAndAway;
penalties_missed: FixtureStatHomeAndAway;
yellow_cards: FixtureStatHomeAndAway;
red_cards: FixtureStatHomeAndAway;
saves: FixtureStatHomeAndAway;
bonus: FixtureStatHomeAndAway;
bps: FixtureStatHomeAndAway;
}
export interface IApiFixtureStatHomeAndAway {
a: IApiFixtureStatValue[];
h: IApiFixtureStatValue[];
export interface FixtureStatHomeAndAway {
a: FixtureStatValue[];
h: FixtureStatValue[];
}
export interface IApiFixtureStatValue {
export interface FixtureStatValue {
value: number;
element: number;
}
export interface IApiEvent {
fixtures: IApiFixture[];
elements: IApiEventElements;
export interface Event {
fixtures: Fixture[];
elements: EventElements;
}
export interface IApiEventElements {
export interface EventElements {
[key: number]: {
explain: IApiEventElementsExplain[];
stats: IApiStats;
explain: EventElementsExplain[];
stats: Stats;
};
}
export interface IApiEventElementsExplain {
export interface EventElementsExplain {
[key: string]: {

@@ -652,0 +643,0 @@ points: number;

'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Available end-points
* https://fantasy.premierleague.com/drf/bootstrap-static
* https://fantasy.premierleague.com/drf/entry/${id}/history
* https://fantasy.premierleague.com/drf/entry/${id}/event/${eventNumber}
* https://fantasy.premierleague.com/drf/entry/${id}/transfers
* https://fantasy.premierleague.com/drf/teams
* https://fantasy.premierleague.com/drf/elements
* https://fantasy.premierleague.com/drf/elements-types
* https://fantasy.premierleague.com/drf/game-settings
* https://fantasy.premierleague.com/drf/event/${eventNumber}/live
* https://fantasy.premierleague.com/drf/leagues-classic-standings/${id}
*/
var node_fetch_1 = require("node-fetch");
var FplApi = (function () {
function FplApi() {
}
/**
* Entry (Fpl manager team):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/history
* @param entryId Entry id
* @returns {Promise}
*/
FplApi.getEntry = function (entryId) {
return this.fetchData("/entry/" + entryId + "/history");
};
/**
* Entry event:
* Details of a particular event (or gameweek):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/event/${eventNumber}
* @param entryId Entry id
* @param eventNumber The event / gameweek number
* @returns {Promise}
*/
FplApi.getEntryEvent = function (entryId, eventNumber) {
return this.fetchData("/entry/" + entryId + "/event/" + eventNumber);
};
/**
* Entry transfers:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/transfers
* @param entryId Entry id
* @returns {Promise}
*/
FplApi.getEntryTransfers = function (entryId) {
return this.fetchData("/entry/" + entryId + "/transfers");
};
/**
* All static game data:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/bootstrap-static
* @returns {Promise}
*/
FplApi.getAllStaticData = function () {
return this.fetchData('/bootstrap-static');
};
/**
* Teams (Premier Leaugue clubs):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/teams
* @returns {Promise}
*/
FplApi.getTeams = function () {
return this.fetchData('/teams');
};
/**
* Elements (players):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements
* @returns {Promise}
*/
FplApi.getElements = function () {
return this.fetchData('/elements');
};
/**
* Element types: A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements-types
* @returns {Promise}
*/
FplApi.getElementTypes = function () {
return this.fetchData('/element-types');
};
/**
* Game settings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/game-settings
* @returns {Promise}
*/
FplApi.getGameSettings = function () {
return this.fetchData('game-settings');
};
/**
* Event /gameweek details:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/event/${eventNumber}/live
* @returns {Promise}
*/
FplApi.getEvent = function (eventNumber) {
return this.fetchData("/event/" + eventNumber + "/live");
};
/**
* Classic league standings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/leagues-classic-standings/${id}
* @param leagueId League id
* @returns {Promise}
*/
FplApi.getClassicLeagueStandings = function (leagueId) {
return this.fetchData("/leagues-classic-standings/" + leagueId);
};
/**
* Returns a promise that if fulfilled returns json object mapped to the given request
* @param path The path of the rest web api request
* @returns {Promise}
* @private
*/
FplApi.fetchData = function (path) {
return new Promise(function (resolve, reject) {
node_fetch_1.default("https://fantasy.premierleague.com/drf/" + path).then(function (res) {
return res.json();
}).then(function (json) {
resolve(json);
}).catch(function (err) {
reject(err);
});
/**
* Entry (Fpl manager team):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/history
* @param entryId Entry id
* @returns {Promise}
*/
function fetchEntry(entryId) {
return fetchData("/entry/" + entryId + "/history");
}
exports.fetchEntry = fetchEntry;
/**
* Entry event:
* Details of a particular event (or gameweek):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/event/${eventNumber}
* @param entryId Entry id
* @param eventNumber The event / gameweek number
* @returns {Promise}
*/
function fetchEntryEvent(entryId, eventNumber) {
return fetchData("/entry/" + entryId + "/event/" + eventNumber);
}
exports.fetchEntryEvent = fetchEntryEvent;
/**
* Entry transfers:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/entry/${id}/transfers
* @param entryId Entry id
* @returns {Promise}
*/
function fetchEntryTransfers(entryId) {
return fetchData("/entry/" + entryId + "/transfers");
}
exports.fetchEntryTransfers = fetchEntryTransfers;
/**
* All static game data:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/bootstrap-static
* @returns {Promise}
*/
function fetchBootstrapStatic() {
return fetchData('/bootstrap-static');
}
exports.fetchBootstrapStatic = fetchBootstrapStatic;
/**
* Teams (Premier Leaugue clubs):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/teams
* @returns {Promise}
*/
function fetchTeams() {
return fetchData('/teams');
}
exports.fetchTeams = fetchTeams;
/**
* Elements (players):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements
* @returns {Promise}
*/
function fetchElements() {
return fetchData('/elements');
}
exports.fetchElements = fetchElements;
/**
* Element types: A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements-types
* @returns {Promise}
*/
function fetchElementTypes() {
return fetchData('/element-types');
}
exports.fetchElementTypes = fetchElementTypes;
/**
* Game settings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/game-settings
* @returns {Promise}
*/
function fetchGameSettings() {
return fetchData('game-settings');
}
exports.fetchGameSettings = fetchGameSettings;
/**
* Event /gameweek details:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/event/${eventNumber}/live
* @returns {Promise}
*/
function fetchEvent(eventNumber) {
return fetchData("/event/" + eventNumber + "/live");
}
exports.fetchEvent = fetchEvent;
/**
* Classic league standings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/leagues-classic-standings/${id}
* @param leagueId League id
* @returns {Promise}
*/
function fetchClassicLeagueStandings(leagueId) {
return fetchData("/leagues-classic-standings/" + leagueId);
}
exports.fetchClassicLeagueStandings = fetchClassicLeagueStandings;
/**
* Returns a promise that if fulfilled returns json object mapped to the given request
* @param path The path of the rest web api request
* @returns {Promise}
* @private
*/
function fetchData(path) {
return new Promise(function (resolve, reject) {
node_fetch_1.default("https://fantasy.premierleague.com/drf/" + path).then(function (res) {
return res.json();
}).then(function (json) {
resolve(json);
}).catch(function (err) {
reject(err);
});
};
return FplApi;
}());
exports.FplApi = FplApi;
});
}
//# sourceMappingURL=index.js.map
{
"name": "fpl-api-node",
"version": "1.0.9",
"version": "1.0.10",
"description": "A simple node wrapper for the Fantasy Premier League (fantasy.premierleague.com) restful web api",

@@ -11,5 +11,6 @@ "main": "dist/index.js",

"scripts": {
"docs": "typedoc --out docs --mode file --excludePrivate --readme none --hideGenerator",
"lint": "tslint --project tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1",
"docs": "typedoc --out docs --mode file --excludePrivate --readme none --hideGenerator",
"lint": "tslint --project tsconfig.json"
"prepublish": "rm -rf dist && tsc"
},

@@ -32,10 +33,10 @@ "repository": {

"dependencies": {
"node-fetch": "^1.6.3"
"@types/node-fetch": "1.6.7",
"node-fetch": "1.7.1"
},
"devDependencies": {
"@types/node-fetch": "^1.6.7",
"tslint": "^5.1.0",
"typedoc": "^0.5.10",
"typescript": "^2.2.2"
"tslint": "5.4.2",
"typedoc": "0.7.1",
"typescript": "2.3.4"
}
}

@@ -16,16 +16,24 @@ # fpl-api-node

### Javascript
```js
const { FplApi } = require('fpl-api-node');
const fplapi = require('fpl-api-node');
```
### Typescript / ES2105
```js
import * as fplapi from 'fpl-api-node';
```
### Example
```js
FplApi.getEntry(123456).then((data) => {
fplapi.getEntry(123456).then((data) => {
// do something with our data
console.log(data);
// do something with our data
console.log(data);
}).catch((err) => {
// something went wrong
// something went wrong
});

@@ -32,0 +40,0 @@ ```

Sorry, the diff of this file is not supported yet

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