diff --git a/README.md b/README.md index 57e6412..6238296 100644 --- a/README.md +++ b/README.md @@ -4,46 +4,12 @@ The scraper scrapes this website: https://www.formula1.com -## Installation +# Installation ```bash npm i f1-api-node ``` -## Functions - -- **getConstructorStandings** - - Fetch Constructors standings from points table. - The function takes one argument: The year from which you want to extract points table for. - Default argument is the current year. - -- **getDriverStandings** - Fetch F1 driver standings from points table. - The function takes one argument: The year from which you want to extract points table for. - Default argument is the current year. - -- **getDriverData** - Fetch the current lineup of F1 drivers. - _No arguments_ - -- **getTeamsData** - Fetch the current list of F1 teams along with their information. - _No arguments_ +# Example snippet -- **getWorldChampions** - Fetch all the world champions - _No arguments_ - -- **getRaceResults** - Fetch race results for all the grand prix in a given year. - The function takes one argument: The year from which you want to extract race results. - -## Snapshots - -If you want to have a look at the output from the given functions check [this](https://github.com/yashkathe/F1-API/tree/master/__tests__/__snapshots__). - -## Example snippet - -Example on how to use one of the given functions. The following function will print the current lineup of F1 drivers. ```javascript @@ -57,10 +23,57 @@ const myFunction = async () => { myFunction() ``` -## Usage +# Functions + +### **1. getConstructorStandings** + +| Description | Needs Paramter ? | Paramter Description | Default Argument | +|:------------|------------------|----------------------|------------------| +| Fetch Constructors standings from points table | Yes - 1 | The year from which you want to extract points table for (1950 - current) | current year | + + +### **2. getDriverStandings** + +| Description | Needs Paramter ? | Paramter Description | Default Argument | +|:------------|------------------|----------------------|------------------| +| Fetch F1 driver standings from points table | Yes - 1 | The year from which you want to extract points table for (1950 - current) | current year | + + +### **3. getDriverLineup** + +| Description | Needs Paramter ? | Paramter Description | Default Argument | +|:------------|------------------|----------------------|------------------| +| Fetch the current lineup of F1 drivers | No | - | - | + + +### **4. getTeamLineup** +| Description | Needs Paramter ? | Paramter Description | Default Argument | +|:------------|------------------|----------------------|------------------| +| Fetch the current list of F1 teams | No | - | - | + + +### **5. getWorldChampions** +| Description | Needs Paramter ? | Paramter Description | Default Argument | +|:------------|------------------|----------------------|------------------| +| Fetch all the world champions | No | - | - | + + +### **6. getRaceResults** +| Description | Needs Paramter ? | Paramter Description | Default Argument | +|:------------|------------------|----------------------|------------------| +| Fetch race results of all the grand prix in a given year | Yes - 1 | The year from which you want to extract race results (1950 - current) | - | + + +# Snapshots + +If you want to have a look at the output from the given functions check [this](https://github.com/yashkathe/F1-API/tree/master/__tests__/__snapshots__). + + + +# Usage WARNING: Abusing this library may result in an IP ban from the host website. Please use with caution and try to limit the rate and amount of your requests if you value your access to formula1.com -## Report Problems +# Report Problems If you have any problems regarding this project, read the following [disclaimer](https://github.com/yashkathe/F1-API/blob/master/DISCLAIMER.md). \ No newline at end of file diff --git a/__tests__/driver-lineup.test.ts b/__tests__/driver-lineup.test.ts index 1820da7..bb6a44c 100644 --- a/__tests__/driver-lineup.test.ts +++ b/__tests__/driver-lineup.test.ts @@ -1,5 +1,5 @@ -import { getDriverLineups } from "../src/server"; +import { getDriverLineup } from "../src/server"; test("current driver lineup", async () => { - expect(await getDriverLineups()).toMatchSnapshot(); + expect(await getDriverLineup()).toMatchSnapshot(); }); diff --git a/__tests__/team-lineup.test.ts b/__tests__/team-lineup.test.ts index e6f829a..53dcac6 100644 --- a/__tests__/team-lineup.test.ts +++ b/__tests__/team-lineup.test.ts @@ -1,5 +1,5 @@ -import { getTeamLineups } from "../src/server"; +import { getTeamLineup } from "../src/server"; test("current teams data", async () => { - expect(await getTeamLineups()).toMatchSnapshot(); + expect(await getTeamLineup()).toMatchSnapshot(); }); diff --git a/package-lock.json b/package-lock.json index 7158c05..9ee2ca7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "f1-api-node", - "version": "0.3.1", + "version": "0.3.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "f1-api-node", - "version": "0.3.1", + "version": "0.3.2", "license": "GPL-3.0", "dependencies": { "axios": "^0.27.2", diff --git a/package.json b/package.json index 75417e3..db50174 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "f1-api-node", - "version": "0.3.1", + "version": "0.3.2", "description": "A simple library written in typescript to fetch Formula-1 data", "main": "dist/server.js", "types": "dist/server.d.ts", diff --git a/src/scraper/driver-lineup.ts b/src/scraper/driver-lineup.ts index ba29289..3f2b9d3 100644 --- a/src/scraper/driver-lineup.ts +++ b/src/scraper/driver-lineup.ts @@ -5,7 +5,7 @@ import { staticLinks } from "../endpoints/endpoints"; import { isDriver } from "../types/types"; -export const getDriverLineups = async (): Promise => { +export const getDriverLineup = async (): Promise => { try { let drivers: isDriver[] = []; diff --git a/src/scraper/team-lineup.ts b/src/scraper/team-lineup.ts index a37fbf8..79c3b9a 100644 --- a/src/scraper/team-lineup.ts +++ b/src/scraper/team-lineup.ts @@ -5,7 +5,7 @@ import { staticLinks } from "../endpoints/endpoints"; import { isTeam } from "../types/types"; -export const getTeamLineups = async (): Promise => { +export const getTeamLineup = async (): Promise => { try { let teams: isTeam[] = []; diff --git a/src/server.ts b/src/server.ts index e9415c8..74403d9 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,5 +1,5 @@ -export { getDriverLineups } from "./scraper/driver-lineup"; -export { getTeamLineups } from "./scraper/team-lineup"; +export { getDriverLineup } from "./scraper/driver-lineup"; +export { getTeamLineup } from "./scraper/team-lineup"; export { getDriverStandings } from "./scraper/driver-standings"; export { getConstructorStandings } from "./scraper/constructors-standings"; export { getWorldChampions } from "./scraper/world-champions";