Skip to content

Commit 24d04d0

Browse files
fix types on index.d.ts
1 parent ec7c652 commit 24d04d0

2 files changed

Lines changed: 30 additions & 15 deletions

File tree

‎nodejs/FlightRadar24/index.d.ts‎

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// Type definitions for FlightRadar24 API
2+
3+
/**
4+
* Zone boundary coordinates
5+
*/
6+
export interface Zone {
7+
tl_y: number;
8+
br_y: number;
9+
tl_x: number;
10+
br_x: number;
11+
}
12+
113
/**
214
* Main class of the FlightRadarAPI
315
*/
@@ -7,8 +19,12 @@ export class FlightRadar24API {
719

820
/**
921
* Constructor of FlightRadar24API class
22+
*
23+
* @param {string} [user] - Your email (optional)
24+
* @param {string} [password] - Your password (optional)
25+
* @param {number} [timeout=10] - Request timeout in seconds
1026
*/
11-
constructor();
27+
constructor(user?: string, password?: string, timeout?: number);
1228

1329
/**
1430
* Return a list with all airlines.
@@ -53,9 +69,11 @@ export class FlightRadar24API {
5369
getAirportDisruptions(): Promise<object>;
5470

5571
/**
56-
* Return a list with all airports.
72+
* Return a list with all airports for specified countries.
73+
*
74+
* @param {string[]} countries - Array of country names
5775
*/
58-
getAirports(): Promise<Airport[]>;
76+
getAirports(countries: string[]): Promise<Airport[]>;
5977

6078
/**
6179
* Return the bookmarks from the FlightRadar24 account.
@@ -65,14 +83,9 @@ export class FlightRadar24API {
6583
/**
6684
* Convert coordinate dictionary to a string "y1, y2, x1, x2".
6785
*
68-
* @param {object} zone - Dictionary containing the following keys: tl_y, tl_x, br_y, br_x
86+
* @param {Zone} zone - Dictionary containing the following keys: tl_y, tl_x, br_y, br_x
6987
*/
70-
getBounds(zone: {
71-
tl_y: number;
72-
br_y: number;
73-
tl_x: number;
74-
br_x: number;
75-
}): string;
88+
getBounds(zone: Zone): string;
7689

7790
/**
7891
* Convert a point coordinate and a radius to a string "y1, y2, x1, x2".
@@ -132,7 +145,7 @@ export class FlightRadar24API {
132145
*/
133146
getHistoryData(
134147
flight: Flight,
135-
fileType: string,
148+
fileType: "CSV" | "KML",
136149
timestamp: number,
137150
): Promise<any>;
138151

@@ -213,11 +226,11 @@ export class FlightTrackerConfig {
213226
limit: string;
214227

215228
/**
216-
* Constructor of FlighTrackerConfig class.
229+
* Constructor of FlightTrackerConfig class.
217230
*
218-
* @param {object} data
231+
* @param {object} [data] - Optional data to initialize the config
219232
*/
220-
constructor(data: object);
233+
constructor(data?: object);
221234
}
222235

223236
/**
@@ -257,7 +270,7 @@ export class Entity {
257270
export class Airport extends Entity {
258271
latitude: number;
259272
longitude: number;
260-
altitude: number;
273+
altitude: number | null;
261274
name: string;
262275
icao: string;
263276
iata: string;

‎python/FlightRadar24/api.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ def get_airport_disruptions(self) -> Dict:
232232
def get_airports(self, countries: List[Countries]) -> List[Airport]:
233233
"""
234234
Return a list with all airports for specified countries.
235+
236+
:param countries: List of country names from Countries enum.
235237
"""
236238
airports = []
237239

0 commit comments

Comments
 (0)