Skip to content

roboflank/fpl-ts

Repository files navigation

A JS/TS wrapper for FPL API.

Installing fpl-ts

npm i fpl-ts

Docs

1. Classes & Methods

2. Types

3. Guides & Examples

Example

import { User, Player, Fixture, Team } from 'fpl-ts'

//  Get Fixture
const getFixtureDetails = async () => {
  const fixture = new Fixture(167)
  try {
    const details = await fixture.getDetails()
    console.log(details)
  } catch (err) {
    console.error(err)
  }
}

//  Get a player
const getPlayerDetails = async () => {
  const player = new Player([302])
  try {
    const bruno = await player.getDetails()
    console.log(bruno)
  } catch (err) {
    console.error(err)
  }
}

// Get user's details
const getUser = async () => {
  const user = new User(91928)
  try {
    const details = await user.getDetails()
    console.log(details)
  } catch (err) {
    console.error(err)
  }
}

Inspired by FPL