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.15 to 2.0.0-alpha.0

dist/api-service/index.d.ts

80

dist/index.d.ts

@@ -1,77 +0,3 @@

import * as types from './interfaces';
/**
* 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 getBootstrappedData(): Promise<types.BootstrappedData>;
/**
* Entry History:
* 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 declare function getEntry(entryId: number): Promise<types.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 getEntryEvent(entryId: number, eventNumber: number): Promise<types.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 getEntryTransfers(entryId: number): Promise<types.EntryTransfers>;
/**
* 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 getTeams(): Promise<types.Team[]>;
/**
* Elements (players):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements
* @returns {Promise}
*/
export declare function getElements(): Promise<types.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 getElementTypes(): Promise<types.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 getGameSettings(): Promise<types.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 getEvent(eventNumber: number): Promise<types.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 getClassicLeagueStandings(leagueId: number): Promise<types.League>;
export { types };
import * as players from './players';
import * as teams from './teams';
export { players, teams };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var axios_1 = require("axios");
var types = require("./interfaces");
exports.types = types;
// set axios defaults
axios_1.default.defaults.baseURL = 'https://fantasy.premierleague.com/drf';
/**
* All static game data:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/bootstrap-static
* @returns {Promise}
*/
function getBootstrappedData() {
return getData('/bootstrap-static');
}
exports.getBootstrappedData = getBootstrappedData;
/**
* Entry History:
* 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 getEntry(entryId) {
return getData("/entry/" + entryId + "/history");
}
exports.getEntry = getEntry;
/**
* 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 getEntryEvent(entryId, eventNumber) {
return getData("/entry/" + entryId + "/event/" + eventNumber);
}
exports.getEntryEvent = getEntryEvent;
/**
* 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 getEntryTransfers(entryId) {
return getData("/entry/" + entryId + "/transfers");
}
exports.getEntryTransfers = getEntryTransfers;
/**
* Teams (Premier Leaugue clubs):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/teams
* @returns {Promise}
*/
function getTeams() {
return getData('/teams');
}
exports.getTeams = getTeams;
/**
* Elements (players):
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements
* @returns {Promise}
*/
function getElements() {
return getData('/elements');
}
exports.getElements = getElements;
/**
* Element types: A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/elements-types
* @returns {Promise}
*/
function getElementTypes() {
return getData('/element-types');
}
exports.getElementTypes = getElementTypes;
/**
* Game settings:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/game-settings
* @returns {Promise}
*/
function getGameSettings() {
return getData('game-settings');
}
exports.getGameSettings = getGameSettings;
/**
* Event /gameweek details:
* A promise that if fulfilled returns an object
* mapped to https://fantasy.premierleague.com/drf/event/${eventNumber}/live
* @returns {Promise}
*/
function getEvent(eventNumber) {
return getData("/event/" + eventNumber + "/live");
}
exports.getEvent = getEvent;
/**
* 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 getClassicLeagueStandings(leagueId) {
return getData("/leagues-classic-standings/" + leagueId);
}
exports.getClassicLeagueStandings = getClassicLeagueStandings;
/**
* 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 getData(path) {
return axios_1.default.get(path).then(function (response) {
return response.data;
}).catch(function (error) {
return error;
});
}
var players = require("./players");
exports.players = players;
var teams = require("./teams");
exports.teams = teams;
//# sourceMappingURL=index.js.map
{
"name": "fpl-api-node",
"version": "1.0.15",
"version": "2.0.0-alpha.0",
"description": "A simple node wrapper for the Fantasy Premier League (fantasy.premierleague.com) restful web api",

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

"scripts": {
"docs": "typedoc --out docs --name 'Fpl-api-node API' --mode file --readme none --mdHideIndexes --excludePrivate --theme markdown --mdOutFile API.md",
"docs": "typedoc --out docs --name 'Fpl-api-node API' --readme none --mdHideIndexes --excludePrivate -excludeExternals --exclude '**/*+(index|data-types).ts' --theme markdown",
"lint": "tslint --project tsconfig.json",
"test": "mocha -r ts-node/register src/**/tests.ts --timeout 5000",
"prepublish": "rm -rf dist && tsc"
"test": "mocha -r ts-node/register test/specs.ts --timeout 15000 --slow 0",
"prepublish": "rm -rf dist && tsc -p src/tsconfig.json"
},

@@ -33,15 +33,20 @@ "repository": {

"dependencies": {
"axios": "^0.16.2"
"axios": "^0.16.2",
"lodash": "^4.17.4",
"node-cache": "^4.1.1"
},
"devDependencies": {
"@types/chai": "^4.0.1",
"@types/lodash": "^4.14.71",
"@types/mocha": "^2.2.41",
"@types/node-cache": "^4.1.0",
"async": "^2.5.0",
"chai": "^4.1.0",
"mocha": "^3.4.2",
"ts-node": "^3.2.0",
"ts-node": "^3.2.1",
"tslint": "^5.5.0",
"typedoc": "^0.7.1",
"typedoc-plugin-markdown": "^1.0.2",
"typescript": "2.4.1"
"typedoc-plugin-markdown": "^1.0.4",
"typescript": "2.3.4"
}
}

@@ -6,8 +6,6 @@ # fpl-api-node (Season 2017-18)

A strongly typed node wrapper for the Fantasy Premier League (fantasy.premierleague.com) restful web api.
It's job is a simple one - to fetch and return data that maps to the available end-points.
**Please note this library is currently being re-written in anticipation for the 2017-2018 season.**
*To avoid topics such as Cross-Origin and Content Security Policy this wrapper should be consumed in a node server-side context.*
A node API wrapper for the Fantasy Premier League (fantasy.premierleague.com) web apis.
## Getting Started

@@ -30,37 +28,4 @@

## Example
```js
fplapi.getEntry(123456).then((data) => {
// do something with our data
console.log(data);
}).catch((err) => {
// something went wrong
});
```
## API
[Read the API documentation](https://github.com/tgreyuk/fpl-api-node/blob/master/docs/API.md) for available methods.
## Usage
You can use the package in a number of ways for example to create a restful api on a web app using expressjs.
The package uses axios under the hood. If using outside of typescript and don't care about types you may prefer to fetch the endpoints directly rather than use this wrapper.
The Available end-points are:
* https://fantasy.premierleague.com/drf/bootstrap-static
* https://fantasy.premierleague.com/drf/entry/${id}
* 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}
Documentation is being updated for 2017-2018 season.

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