Skip to content

Commit ccf1253

Browse files
committed
update readme
1 parent acbca4c commit ccf1253

File tree

8 files changed

+62
-49
lines changed

8 files changed

+62
-49
lines changed

README.md

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,12 @@
44

55
The scraper scrapes this website: https://www.formula1.com
66

7-
## Installation
7+
# Installation
88
```bash
99
npm i f1-api-node
1010
```
11-
## Functions
12-
13-
- **getConstructorStandings**
14-
15-
Fetch Constructors standings from points table.
16-
The function takes one argument: The year from which you want to extract points table for.
17-
Default argument is the current year.
18-
19-
- **getDriverStandings**
20-
Fetch F1 driver standings from points table.
21-
The function takes one argument: The year from which you want to extract points table for.
22-
Default argument is the current year.
23-
24-
- **getDriverData**
25-
Fetch the current lineup of F1 drivers.
26-
_No arguments_
27-
28-
- **getTeamsData**
29-
Fetch the current list of F1 teams along with their information.
30-
_No arguments_
11+
# Example snippet
3112

32-
- **getWorldChampions**
33-
Fetch all the world champions
34-
_No arguments_
35-
36-
- **getRaceResults**
37-
Fetch race results for all the grand prix in a given year.
38-
The function takes one argument: The year from which you want to extract race results.
39-
40-
## Snapshots
41-
42-
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__).
43-
44-
## Example snippet
45-
46-
Example on how to use one of the given functions.
4713
The following function will print the current lineup of F1 drivers.
4814

4915
```javascript
@@ -57,10 +23,57 @@ const myFunction = async () => {
5723
myFunction()
5824
```
5925

60-
## Usage
26+
# Functions
27+
28+
### **1. getConstructorStandings**
29+
30+
| Description | Needs Paramter ? | Paramter Description | Default Argument |
31+
|:------------|------------------|----------------------|------------------|
32+
| Fetch Constructors standings from points table | Yes - 1 | The year from which you want to extract points table for (1950 - current) | current year |
33+
34+
35+
### **2. getDriverStandings**
36+
37+
| Description | Needs Paramter ? | Paramter Description | Default Argument |
38+
|:------------|------------------|----------------------|------------------|
39+
| Fetch F1 driver standings from points table | Yes - 1 | The year from which you want to extract points table for (1950 - current) | current year |
40+
41+
42+
### **3. getDriverLineup**
43+
44+
| Description | Needs Paramter ? | Paramter Description | Default Argument |
45+
|:------------|------------------|----------------------|------------------|
46+
| Fetch the current lineup of F1 drivers | No | - | - |
47+
48+
49+
### **4. getTeamLineup**
50+
| Description | Needs Paramter ? | Paramter Description | Default Argument |
51+
|:------------|------------------|----------------------|------------------|
52+
| Fetch the current list of F1 teams | No | - | - |
53+
54+
55+
### **5. getWorldChampions**
56+
| Description | Needs Paramter ? | Paramter Description | Default Argument |
57+
|:------------|------------------|----------------------|------------------|
58+
| Fetch all the world champions | No | - | - |
59+
60+
61+
### **6. getRaceResults**
62+
| Description | Needs Paramter ? | Paramter Description | Default Argument |
63+
|:------------|------------------|----------------------|------------------|
64+
| 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) | - |
65+
66+
67+
# Snapshots
68+
69+
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__).
70+
71+
72+
73+
# Usage
6174
WARNING: Abusing this library may result in an IP ban from the host website.
6275
Please use with caution and try to limit the rate and amount of your requests if you value your access to formula1.com
6376

64-
## Report Problems
77+
# Report Problems
6578

6679
If you have any problems regarding this project, read the following [disclaimer](https://github.com/yashkathe/F1-API/blob/master/DISCLAIMER.md).

__tests__/driver-lineup.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getDriverLineups } from "../src/server";
1+
import { getDriverLineup } from "../src/server";
22

33
test("current driver lineup", async () => {
4-
expect(await getDriverLineups()).toMatchSnapshot();
4+
expect(await getDriverLineup()).toMatchSnapshot();
55
});

__tests__/team-lineup.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getTeamLineups } from "../src/server";
1+
import { getTeamLineup } from "../src/server";
22

33
test("current teams data", async () => {
4-
expect(await getTeamLineups()).toMatchSnapshot();
4+
expect(await getTeamLineup()).toMatchSnapshot();
55
});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "f1-api-node",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "A simple library written in typescript to fetch Formula-1 data",
55
"main": "dist/server.js",
66
"types": "dist/server.d.ts",

src/scraper/driver-lineup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { staticLinks } from "../endpoints/endpoints";
55

66
import { isDriver } from "../types/types";
77

8-
export const getDriverLineups = async (): Promise<isDriver[]> => {
8+
export const getDriverLineup = async (): Promise<isDriver[]> => {
99
try {
1010
let drivers: isDriver[] = [];
1111

src/scraper/team-lineup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { staticLinks } from "../endpoints/endpoints";
55

66
import { isTeam } from "../types/types";
77

8-
export const getTeamLineups = async (): Promise<isTeam[]> => {
8+
export const getTeamLineup = async (): Promise<isTeam[]> => {
99
try {
1010
let teams: isTeam[] = [];
1111

src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export { getDriverLineups } from "./scraper/driver-lineup";
2-
export { getTeamLineups } from "./scraper/team-lineup";
1+
export { getDriverLineup } from "./scraper/driver-lineup";
2+
export { getTeamLineup } from "./scraper/team-lineup";
33
export { getDriverStandings } from "./scraper/driver-standings";
44
export { getConstructorStandings } from "./scraper/constructors-standings";
55
export { getWorldChampions } from "./scraper/world-champions";

0 commit comments

Comments
 (0)