fshub-api 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/api/airline/Airline_getPilotStats.d.ts +2 -2
  2. package/dist/api/airline/Airline_getPilotStats.d.ts.map +1 -1
  3. package/dist/api/airline/Airline_getPilotStats.js.map +1 -1
  4. package/dist/api/airport/Airport_findByICAO.d.ts +3 -0
  5. package/dist/api/airport/Airport_findByICAO.d.ts.map +1 -0
  6. package/dist/api/airport/Airport_findByICAO.js +57 -0
  7. package/dist/api/airport/Airport_findByICAO.js.map +1 -0
  8. package/dist/api/airport/Airport_findMETAR.d.ts +3 -0
  9. package/dist/api/airport/Airport_findMETAR.d.ts.map +1 -0
  10. package/dist/api/airport/Airport_findMETAR.js +57 -0
  11. package/dist/api/airport/Airport_findMETAR.js.map +1 -0
  12. package/dist/api/airport/index.d.ts +7 -0
  13. package/dist/api/airport/index.d.ts.map +1 -0
  14. package/dist/api/airport/index.js +13 -0
  15. package/dist/api/airport/index.js.map +1 -0
  16. package/dist/api/index.d.ts +4 -0
  17. package/dist/api/index.d.ts.map +1 -1
  18. package/dist/api/index.js +3 -1
  19. package/dist/api/index.js.map +1 -1
  20. package/dist/index.d.ts +33 -31
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +22 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/types/Airline.d.ts +25 -0
  25. package/dist/types/Airline.d.ts.map +1 -0
  26. package/dist/types/Airline.js +3 -0
  27. package/dist/types/Airline.js.map +1 -0
  28. package/dist/types/Airport.d.ts +50 -0
  29. package/dist/types/Airport.d.ts.map +1 -0
  30. package/dist/types/Airport.js +3 -0
  31. package/dist/types/Airport.js.map +1 -0
  32. package/dist/types/AirportMETARReport.d.ts +13 -0
  33. package/dist/types/AirportMETARReport.d.ts.map +1 -0
  34. package/dist/types/AirportMETARReport.js +3 -0
  35. package/dist/types/AirportMETARReport.js.map +1 -0
  36. package/dist/types/Common.d.ts +16 -0
  37. package/dist/types/Common.d.ts.map +1 -0
  38. package/dist/types/Common.js +3 -0
  39. package/dist/types/Common.js.map +1 -0
  40. package/dist/types/Config.d.ts +7 -0
  41. package/dist/types/Config.d.ts.map +1 -0
  42. package/dist/types/Config.js +3 -0
  43. package/dist/types/Config.js.map +1 -0
  44. package/dist/types/FSHubAirline.d.ts +65 -0
  45. package/dist/types/FSHubAirline.d.ts.map +1 -0
  46. package/dist/types/FSHubAirline.js +3 -0
  47. package/dist/types/FSHubAirline.js.map +1 -0
  48. package/dist/types/FSHubApi.d.ts +54 -0
  49. package/dist/types/FSHubApi.d.ts.map +1 -0
  50. package/dist/types/FSHubApi.js +3 -0
  51. package/dist/types/FSHubApi.js.map +1 -0
  52. package/dist/types/FSHubApplication.d.ts +8 -0
  53. package/dist/types/FSHubApplication.d.ts.map +1 -0
  54. package/dist/types/FSHubApplication.js +3 -0
  55. package/dist/types/FSHubApplication.js.map +1 -0
  56. package/dist/types/FSHubError.d.ts +9 -0
  57. package/dist/types/FSHubError.d.ts.map +1 -0
  58. package/dist/types/FSHubError.js +3 -0
  59. package/dist/types/FSHubError.js.map +1 -0
  60. package/dist/types/FSHubPilotPointPurchase.d.ts +10 -0
  61. package/dist/types/FSHubPilotPointPurchase.d.ts.map +1 -0
  62. package/dist/types/FSHubPilotPointPurchase.js +3 -0
  63. package/dist/types/FSHubPilotPointPurchase.js.map +1 -0
  64. package/dist/types/FSHubRequestOptions.d.ts +5 -0
  65. package/dist/types/FSHubRequestOptions.d.ts.map +1 -0
  66. package/dist/types/FSHubRequestOptions.js +3 -0
  67. package/dist/types/FSHubRequestOptions.js.map +1 -0
  68. package/dist/types/FSHubResponse.d.ts +12 -0
  69. package/dist/types/FSHubResponse.d.ts.map +1 -0
  70. package/dist/types/FSHubResponse.js +3 -0
  71. package/dist/types/FSHubResponse.js.map +1 -0
  72. package/dist/types/Flight.d.ts +77 -0
  73. package/dist/types/Flight.d.ts.map +1 -0
  74. package/dist/types/Flight.js +3 -0
  75. package/dist/types/Flight.js.map +1 -0
  76. package/dist/types/Pilot.d.ts +20 -0
  77. package/dist/types/Pilot.d.ts.map +1 -0
  78. package/dist/types/Pilot.js +3 -0
  79. package/dist/types/Pilot.js.map +1 -0
  80. package/dist/types/Screenshot.d.ts +14 -0
  81. package/dist/types/Screenshot.d.ts.map +1 -0
  82. package/dist/types/Screenshot.js +3 -0
  83. package/dist/types/Screenshot.js.map +1 -0
  84. package/dist/types/Stats.d.ts +21 -0
  85. package/dist/types/Stats.d.ts.map +1 -0
  86. package/dist/types/Stats.js +3 -0
  87. package/dist/types/Stats.js.map +1 -0
  88. package/dist/types/index.d.ts +19 -255
  89. package/dist/types/index.d.ts.map +1 -1
  90. package/dist/types/index.js +5 -0
  91. package/dist/types/index.js.map +1 -1
  92. package/package.json +56 -56
  93. package/src/api/airline/Airline_getPilotStats.ts +3 -3
  94. package/src/api/airport/Airport_findByICAO.ts +9 -0
  95. package/src/api/airport/Airport_findMETAR.ts +9 -0
  96. package/src/api/airport/index.ts +7 -0
  97. package/src/api/index.ts +3 -1
  98. package/src/index.spec.ts +25 -2
  99. package/src/index.ts +12 -1
  100. package/src/types/Airline.ts +26 -0
  101. package/src/types/Airport.ts +56 -0
  102. package/src/types/AirportMETARReport.ts +14 -0
  103. package/src/types/Common.ts +17 -0
  104. package/src/types/Config.ts +6 -0
  105. package/src/types/FSHubAirline.ts +73 -0
  106. package/src/types/FSHubApi.ts +54 -0
  107. package/src/types/FSHubApplication.ts +8 -0
  108. package/src/types/FSHubError.ts +8 -0
  109. package/src/types/FSHubPilotPointPurchase.ts +10 -0
  110. package/src/types/FSHubRequestOptions.ts +4 -0
  111. package/src/types/FSHubResponse.ts +11 -0
  112. package/src/types/Flight.ts +88 -0
  113. package/src/types/Pilot.ts +21 -0
  114. package/src/types/Screenshot.ts +15 -0
  115. package/src/types/Stats.ts +23 -0
  116. package/src/types/index.ts +63 -290
  117. package/workspace.code-workspace +10 -0
@@ -1,258 +1,22 @@
1
- import { AxiosInstance } from 'axios';
2
1
  /**
3
- * FSHub API Types and type= s
2
+ * FSHub API Types and types
3
+ *
4
+ * All types are exported from individual files for better organization.
4
5
  */
5
- export type Config = {
6
- baseURL?: string;
7
- apiKey?: string;
8
- timeout?: number;
9
- headers?: Record<string, string>;
10
- };
11
- export type CurrentPilot = Pilot & {
12
- discord_id?: number;
13
- };
14
- export type Pilot = {
15
- id: number;
16
- name: string;
17
- base: string;
18
- locale: string;
19
- gps: Gps;
20
- is_online: boolean;
21
- online_at: string;
22
- bio?: string;
23
- handles?: Handles;
24
- timezone?: string;
25
- country?: string;
26
- created_at?: string;
27
- links?: Link[];
28
- };
29
- export type Handles = {
30
- facebook: any;
31
- twitter: string;
32
- website: any;
33
- vatsim: string;
34
- ivao: string;
35
- };
36
- export type Link = {
37
- rel: string;
38
- uri: string;
39
- };
40
- export type Gps = {
41
- lat: number;
42
- lng: number;
43
- };
44
- export type Flight = {
45
- id: number;
46
- user: User;
47
- airline: Airline;
48
- schedule_status: any;
49
- aircraft: Aircraft;
50
- plan: any;
51
- fuel_used: number;
52
- landing_rate: number;
53
- distance: Distance;
54
- average: Average;
55
- max: Max;
56
- time: number;
57
- tags: any[];
58
- flags: any[];
59
- points: number;
60
- departure: Airport;
61
- arrival: Airport;
62
- links: Link[];
63
- };
64
- export type Airline = {
65
- id: number;
66
- name: string;
67
- abbr: string;
68
- owner: Owner;
69
- handles: Handles;
70
- links: Link[];
71
- };
72
- export type Owner = {
73
- id: number;
74
- name: string;
75
- bio: any;
76
- handles: Handles;
77
- base: string;
78
- locale: string;
79
- gps: Gps;
80
- timezone: string;
81
- country: string;
82
- is_online: boolean;
83
- online_at: string;
84
- created_at: string;
85
- links: Link[];
86
- };
87
- export type User = {
88
- id: number;
89
- name: string;
90
- };
91
- export type Aircraft = {
92
- icao: string;
93
- icao_name: string;
94
- name: string;
95
- type: string;
96
- user_conf: UserConf;
97
- };
98
- export type UserConf = {
99
- tail: string;
100
- icao: string;
101
- };
102
- export type Distance = {
103
- nm: number;
104
- km: number;
105
- };
106
- export type Average = {
107
- spd: number;
108
- };
109
- export type Max = {
110
- alt: number;
111
- spd: number;
112
- };
113
- export type Geo = {
114
- lat: number;
115
- lng: number;
116
- };
117
- export type Hdg = {
118
- mag: number;
119
- true: number;
120
- };
121
- export type Spd = {
122
- tas: number;
123
- };
124
- export type Wind = {
125
- spd: number;
126
- dir: number;
127
- };
128
- export type Airport = {
129
- icao: string;
130
- iata: string;
131
- name: string;
132
- time: string;
133
- geo: Geo;
134
- hdg: Hdg;
135
- spd: Spd;
136
- fuel: number;
137
- pitch: number;
138
- bank: number;
139
- wind: Wind;
140
- };
141
- export type PilotStats = {
142
- id: number;
143
- all_time: PilotStat;
144
- month: PilotStat;
145
- links: Link[];
146
- };
147
- export type AirlineStats = {
148
- id: number;
149
- total_pilots: number;
150
- all_time: PilotStat;
151
- month: PilotStat;
152
- links: Link[];
153
- };
154
- export type PilotStat = {
155
- total_flights: number;
156
- total_hours: number;
157
- total_distance: number;
158
- average_landing: number;
159
- };
160
- export type Screenshot = {
161
- id: number;
162
- name: string;
163
- desc: any;
164
- urls: Urls;
165
- created_at: string;
166
- links: Link[];
167
- };
168
- export type Urls = {
169
- fullsize: string;
170
- thumbnail: string;
171
- };
172
- export type FSHubRequestOptions = {
173
- cursor?: number;
174
- limit?: number;
175
- };
176
- export type FSHubApi = {
177
- axios: AxiosInstance;
178
- Pilot_getCurrent: () => Promise<FSHubResponse<CurrentPilot>>;
179
- Pilot_getAll: () => Promise<FSHubResponse<Pilot[]>>;
180
- Pilot_get: (id: number) => Promise<FSHubResponse<Pilot>>;
181
- Pilot_getLatestFlight: (id: number) => Promise<FSHubResponse<Flight>>;
182
- Pilot_getAllFlights: (id: number) => Promise<FSHubResponse<Flight[]>>;
183
- Pilot_getAllAirlines: (id: number) => Promise<FSHubResponse<Airline[]>>;
184
- Pilot_getStats: (id: number) => Promise<FSHubResponse<PilotStats>>;
185
- Pilot_getAllFlightsDepartures: (id: number, airportCode: string) => Promise<FSHubResponse<Flight[]>>;
186
- Pilot_getAllFlightsArrivals: (id: number, airportCode: string) => Promise<FSHubResponse<Flight[]>>;
187
- Pilot_getAllFlightDeparturesAndArrivals: (id: number, departureAirportCode: string, arrivalAirportCode: string) => Promise<FSHubResponse<Flight[]>>;
188
- Pilot_getAllScreenshots: (id: number) => Promise<FSHubResponse<Screenshot[]>>;
189
- Airline_getAll: () => Promise<FSHubResponse<Airline[]>>;
190
- Airline_get: (id: number) => Promise<FSHubResponse<Airline>>;
191
- Airline_getPilots: (id: number) => Promise<FSHubResponse<Pilot[]>>;
192
- Airline_getPilotStats: (id: number, pilotId: number) => Promise<FSHubResponse<PilotStats>>;
193
- Airline_getFlights: (id: number) => Promise<FSHubResponse<Flight[]>>;
194
- Airline_getAllFlightsDepartures: (id: number, airportCode: string) => Promise<FSHubResponse<Flight[]>>;
195
- Airline_getAllFlightsArrivals: (id: number, airportCode: string) => Promise<FSHubResponse<Flight[]>>;
196
- Airline_getAllFlightDeparturesAndArrivals: (id: number, departureAirportCode: string, arrivalAirportCode: string) => Promise<FSHubResponse<Flight[]>>;
197
- Airline_getAllScreenshots: (id: number) => Promise<FSHubResponse<Screenshot[]>>;
198
- Airline_getStats: (id: number) => Promise<FSHubResponse<AirlineStats>>;
199
- Airline_approveApplication: (pilotId: number, airlineId: number) => Promise<FSHubResponse<FSHubApplicationResponse>>;
200
- Airline_rejectApplication: (pilotId: number, airlineId: number) => Promise<FSHubResponse<FSHubApplicationResponse>>;
201
- Airline_pilotPointPurchase: (pilotId: number, airlineId: number, data: FSHubPilotPointPurchaseTransactionData) => Promise<FSHubResponse<FSHubPilotPointPurchaseTransactionResponse>>;
202
- Airline_pilotSetRank: (pilotId: number, airlineId: number, data: FSHubPilotSetRankData) => Promise<FSHubResponse<FSHubApplicationResponse>>;
203
- Airline_getAllRanks: (airlineId: number) => Promise<FSHubResponse<FSHubAirlineRank[]>>;
204
- Airline_getAllRoles: (airlineId: number) => Promise<FSHubResponse<FSHubAirlineRole[]>>;
205
- Flight_getFlightById: (id: number) => Promise<FSHubResponse<Flight>>;
206
- Flight_getFlightScreenshotsById: (id: number) => Promise<FSHubResponse<Screenshot[]>>;
207
- Flight_getFlights: (options?: FSHubRequestOptions) => Promise<FSHubResponse<Flight[]>>;
208
- };
209
- export type FSHubResponse<T> = {
210
- data: T;
211
- meta?: {
212
- cursor: {
213
- current: number;
214
- prev: number;
215
- next: number;
216
- count: number;
217
- };
218
- };
219
- };
220
- export type FSHubApplicationResponse = {
221
- successful: boolean;
222
- message: string;
223
- };
224
- export type FSHubPilotPointPurchaseTransactionData = {
225
- amount: number;
226
- summary: string;
227
- };
228
- export type FSHubPilotPointPurchaseTransactionResponse = {
229
- successful: boolean;
230
- message: string;
231
- transferred: number;
232
- };
233
- export type FSHubError = {
234
- message: string;
235
- code: number;
236
- error?: boolean;
237
- details?: {
238
- pilot: number;
239
- };
240
- };
241
- export type FSHubPilotSetRankData = {
242
- rank_id: number;
243
- };
244
- export type FSHubAirlineRole = {
245
- id: number;
246
- name: string;
247
- created_at: string;
248
- updated_at: string;
249
- };
250
- export type FSHubAirlineRank = {
251
- id: number;
252
- name: string;
253
- abbreviation: string;
254
- min_hours: number;
255
- created_at: string;
256
- updated_at: string;
257
- };
6
+ export type { Config } from './Config';
7
+ export type { Link, Gps, Handles } from './Common';
8
+ export type { Pilot, CurrentPilot } from './Pilot';
9
+ export type { Flight, User, Aircraft, UserConf, Distance, Average, Max, Geo, Hdg, Spd, Wind, } from './Flight';
10
+ export type { Airline, Owner } from './Airline';
11
+ export type { PilotStats, AirlineStats, PilotStat } from './Stats';
12
+ export type { Screenshot, Urls } from './Screenshot';
13
+ export type { FSHubApi } from './FSHubApi';
14
+ export type { FSHubRequestOptions } from './FSHubRequestOptions';
15
+ export type { FSHubResponse } from './FSHubResponse';
16
+ export type { FSHubError } from './FSHubError';
17
+ export type { FSHubApplicationResponse, FSHubPilotSetRankData } from './FSHubApplication';
18
+ export type { FSHubPilotPointPurchaseTransactionData, FSHubPilotPointPurchaseTransactionResponse } from './FSHubPilotPointPurchase';
19
+ export type { FSHubAirlineRole, FSHubAirlineRank, FSHubAirlinePilotStats, FSHubAirlinePilotStatsRoles, FSHubAirlinePilotStatsUser, FSHubAirlinePilotStatsUserProfile, FSHubAirlinePilotStatsUserLocations, FSHubAirlinePilotStatsUserHandles, FSHubAirlinePilotStatsRank, FSHubAirlinePilotStatsLink } from './FSHubAirline';
20
+ export type { Airport } from './Airport';
21
+ export type { AirportMETARReport, AirportMETAR } from './AirportMETARReport';
258
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;GAEG;AAEH,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,GAAG,CAAA;IACR,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;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,0BAA0B,EAC1B,iCAAiC,EACjC,mCAAmC,EACnC,iCAAiC,EACjC,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,3 +1,8 @@
1
1
  "use strict";
2
+ /**
3
+ * FSHub API Types and types
4
+ *
5
+ * All types are exported from individual files for better organization.
6
+ */
2
7
  Object.defineProperty(exports, "__esModule", { value: true });
3
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "name": "fshub-api",
3
- "version": "4.0.1",
4
- "description": "TypeScript HTTP API wrapper library for FSHub REST API",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/VAMSApp/fshub-api"
10
- },
11
- "scripts": {
12
- "build": "tsc",
13
- "dev": "tsc --watch",
14
- "lint": "eslint src/**/*.ts",
15
- "clean": "rimraf dist",
16
- "test": "mocha --timeout 20000 --require ts-node/register src/**/*.spec.ts",
17
- "test:debug": "tsx test.ts",
18
- "test:watch": "mocha -w --timeout 20000 --require ts-node/register src/**/*.spec.ts",
19
- "prepublishOnly": "npm run clean && npm run build"
20
- },
21
- "keywords": [
22
- "fshub",
23
- "api",
24
- "typescript",
25
- "wrapper",
26
- "rest"
27
- ],
28
- "_moduleAliases": {
29
- "@types": "types/*",
30
- "@api": "api/*"
31
- },
32
- "author": {
33
- "name": "Mike DeVita",
34
- "email": "mike@devita.co"
35
- },
36
- "license": "ISC",
37
- "devDependencies": {
38
- "@types/jest": "^29.0.0",
39
- "@types/node": "^20.0.0",
40
- "@typescript-eslint/eslint-plugin": "^6.0.0",
41
- "@typescript-eslint/parser": "^6.0.0",
42
- "chai": "^5.2.1",
43
- "eslint": "^8.0.0",
44
- "jest": "^29.0.0",
45
- "mocha": "^11.7.1",
46
- "rimraf": "^5.0.0",
47
- "ts-jest": "^29.0.0",
48
- "ts-node": "^10.9.2",
49
- "tsx": "^4.20.3",
50
- "typescript": "^5.0.0"
51
- },
52
- "dependencies": {
53
- "axios": "^1.6.0",
54
- "dotenv": "^17.2.1"
55
- }
56
- }
1
+ {
2
+ "name": "fshub-api",
3
+ "version": "4.1.0",
4
+ "description": "TypeScript HTTP API wrapper library for FSHub REST API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/VAMSApp/fshub-api"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch",
14
+ "lint": "eslint src/**/*.ts",
15
+ "clean": "rimraf dist",
16
+ "test": "mocha --timeout 20000 --require ts-node/register src/**/*.spec.ts",
17
+ "test:debug": "tsx test.ts",
18
+ "test:watch": "mocha -w --timeout 20000 --require ts-node/register src/**/*.spec.ts",
19
+ "prepublishOnly": "npm run clean && npm run build"
20
+ },
21
+ "keywords": [
22
+ "fshub",
23
+ "api",
24
+ "typescript",
25
+ "wrapper",
26
+ "rest"
27
+ ],
28
+ "_moduleAliases": {
29
+ "@types": "types/*",
30
+ "@api": "api/*"
31
+ },
32
+ "author": {
33
+ "name": "Mike DeVita",
34
+ "email": "mike@devita.co"
35
+ },
36
+ "license": "ISC",
37
+ "devDependencies": {
38
+ "@types/jest": "^29.0.0",
39
+ "@types/node": "^20.0.0",
40
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
41
+ "@typescript-eslint/parser": "^6.0.0",
42
+ "chai": "^5.2.1",
43
+ "eslint": "^8.0.0",
44
+ "jest": "^29.0.0",
45
+ "mocha": "^11.7.1",
46
+ "rimraf": "^5.0.0",
47
+ "ts-jest": "^29.0.0",
48
+ "ts-node": "^10.9.2",
49
+ "tsx": "^4.20.3",
50
+ "typescript": "^5.0.0"
51
+ },
52
+ "dependencies": {
53
+ "axios": "^1.6.0",
54
+ "dotenv": "^17.2.1"
55
+ }
56
+ }
@@ -1,8 +1,8 @@
1
- import { FSHubApi, FSHubResponse, PilotStats } from "../../types";
1
+ import { FSHubAirlinePilotStats, FSHubApi, FSHubResponse } from "../../types";
2
2
  import FSHubApiRequest from "../FSHubApiRequest";
3
3
 
4
- export default async function Airline_getPilotStats(id: number, pilotId: number, api: FSHubApi): Promise<FSHubResponse<PilotStats>> {
5
- const response: FSHubResponse<PilotStats> = await FSHubApiRequest(`airline/${id}/pilot/${pilotId}/stats`, api);
4
+ export default async function Airline_getPilotStats(id: number, pilotId: number, api: FSHubApi): Promise<FSHubResponse<FSHubAirlinePilotStats>> {
5
+ const response: FSHubResponse<FSHubAirlinePilotStats> = await FSHubApiRequest(`airline/${id}/pilot/${pilotId}/stats`, api);
6
6
 
7
7
  return response;
8
8
  }
@@ -0,0 +1,9 @@
1
+ // https://fshub.io/api/v3/airport/{icao}
2
+ import { Airport, FSHubApi, FSHubResponse } from "../../types";
3
+ import FSHubApiRequest from "../FSHubApiRequest";
4
+
5
+ export default async function Airport_findByICAO(icao: string, api: FSHubApi): Promise<FSHubResponse<Airport>> {
6
+ const response: FSHubResponse<Airport> = await FSHubApiRequest(`airport/${icao}`, api);
7
+
8
+ return response;
9
+ }
@@ -0,0 +1,9 @@
1
+ // https://fshub.io/api/v3/airport/{icao}/metar
2
+ import { AirportMETARReport, FSHubApi, FSHubResponse } from "../../types";
3
+ import FSHubApiRequest from "../FSHubApiRequest";
4
+
5
+ export default async function Airport_findMETAR(icao: string, api: FSHubApi): Promise<FSHubResponse<AirportMETARReport>> {
6
+ const response: FSHubResponse<AirportMETARReport> = await FSHubApiRequest(`airport/${icao}/metar`, api);
7
+
8
+ return response;
9
+ }
@@ -0,0 +1,7 @@
1
+ import Airport_findByICAO from './Airport_findByICAO';
2
+ import Airport_findMETAR from './Airport_findMETAR';
3
+
4
+ export const Airport = {
5
+ findByICAO: Airport_findByICAO,
6
+ findMETAR: Airport_findMETAR,
7
+ }
package/src/api/index.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { Pilot } from "./pilot";
2
2
  import { Airline } from "./airline";
3
3
  import { Flight } from "./flight";
4
+ import { Airport } from "./airport";
4
5
 
5
6
  export const Api = {
6
7
  pilot: Pilot,
7
8
  airline: Airline,
8
- flight: Flight
9
+ flight: Flight,
10
+ airport: Airport
9
11
  };
package/src/index.spec.ts CHANGED
@@ -2,7 +2,7 @@ import { describe, before } from 'mocha';
2
2
  import { expect } from 'chai';
3
3
  import FSHubApiClass from './index';
4
4
  import dotenv from 'dotenv';
5
- import { CurrentPilot, Flight, Pilot, FSHubApi, Airline, PilotStats, Screenshot, FSHubResponse, AirlineStats, FSHubApplicationResponse, FSHubPilotPointPurchaseTransactionResponse } from './types';
5
+ import { CurrentPilot, Flight, Pilot, FSHubApi, Airline, PilotStats, Screenshot, FSHubResponse, AirlineStats, FSHubApplicationResponse, FSHubPilotPointPurchaseTransactionResponse, Airport, AirportMETARReport, FSHubAirlinePilotStats } from './types';
6
6
 
7
7
  dotenv.config();
8
8
  let api: FSHubApi;
@@ -31,6 +31,7 @@ describe('FSHubApi()', function() {
31
31
  expect(api.Pilot_getAllFlightsArrivals).to.be.a('function');
32
32
  expect(api.Pilot_getAllFlightDeparturesAndArrivals).to.be.a('function');
33
33
  expect(api.Pilot_getAllScreenshots).to.be.a('function');
34
+
34
35
  expect(api.Airline_getAll).to.be.a('function');
35
36
  expect(api.Airline_get).to.be.a('function');
36
37
  expect(api.Airline_getPilots).to.be.a('function');
@@ -47,9 +48,13 @@ describe('FSHubApi()', function() {
47
48
  expect(api.Airline_pilotSetRank).to.be.a('function');
48
49
  expect(api.Airline_getAllRanks).to.be.a('function');
49
50
  expect(api.Airline_getAllRoles).to.be.a('function');
51
+
50
52
  expect(api.Flight_getFlightById).to.be.a('function');
51
53
  expect(api.Flight_getFlightScreenshotsById).to.be.a('function');
52
54
  expect(api.Flight_getFlights).to.be.a('function');
55
+
56
+ expect(api.Airport_findByICAO).to.be.a('function');
57
+ expect(api.Airport_findMETAR).to.be.a('function');
53
58
  });
54
59
 
55
60
  describe('Pilot', function() {
@@ -165,7 +170,7 @@ describe('FSHubApi()', function() {
165
170
  it('Airline_getPilotStats(id, pilotId) is called, it should return a valid PilotStats object', async function() {
166
171
  const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
167
172
  const pilot: FSHubResponse<Pilot> = await api.Pilot_getCurrent();
168
- const stats: FSHubResponse<PilotStats> = await api.Airline_getPilotStats(airline.data.id, pilot.data.id);
173
+ const stats: FSHubResponse<FSHubAirlinePilotStats> = await api.Airline_getPilotStats(airline.data.id, pilot.data.id);
169
174
 
170
175
  expect(stats.data).to.be.an('Object');
171
176
  });
@@ -279,4 +284,22 @@ describe('FSHubApi()', function() {
279
284
  });
280
285
  });
281
286
  });
287
+
288
+ describe('Airport', function() {
289
+ describe('Airport_findByICAO(icao)', function() {
290
+ it('Airport_findByICAO(icao) is called, it should return a valid Airport object', async function() {
291
+ const airport: FSHubResponse<Airport> = await api.Airport_findByICAO('KPHX');
292
+
293
+ expect(airport.data).to.be.an('Object');
294
+ });
295
+ });
296
+
297
+ describe('Airport_findMETAR(icao)', function() {
298
+ it('Airport_findMETAR(icao) is called, it should return a valid AirportMETARReport object', async function() {
299
+ const airportMETARReport: FSHubResponse<AirportMETARReport> = await api.Airport_findMETAR('KPHX');
300
+
301
+ expect(airportMETARReport.data).to.be.an('Object');
302
+ });
303
+ });
304
+ });
282
305
  });
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import axios, { AxiosInstance } from 'axios';
2
- import type{ Config, FSHubApi, FSHubPilotPointPurchaseTransactionData, FSHubPilotSetRankData, FSHubRequestOptions } from './types';
2
+ import type{ Airport, Config, FSHubApi, FSHubPilotPointPurchaseTransactionData, FSHubPilotSetRankData, FSHubRequestOptions, FSHubResponse } from './types';
3
3
  import { Api } from './api';
4
4
  export * from './types';
5
5
 
@@ -56,6 +56,9 @@ export default class FSHubApiClass implements FSHubApi {
56
56
  this.Flight_getFlightById = this.Flight_getFlightById.bind(this);
57
57
  this.Flight_getFlightScreenshotsById = this.Flight_getFlightScreenshotsById.bind(this);
58
58
  this.Flight_getFlights = this.Flight_getFlights.bind(this);
59
+
60
+ this.Airport_findByICAO = this.Airport_findByICAO.bind(this);
61
+ this.Airport_findMETAR = this.Airport_findMETAR.bind(this);
59
62
  }
60
63
 
61
64
  public async Pilot_getCurrent() {
@@ -177,4 +180,12 @@ export default class FSHubApiClass implements FSHubApi {
177
180
  public async Flight_getFlights(options?: FSHubRequestOptions) {
178
181
  return await Api.flight.getFlights(this, options);
179
182
  }
183
+
184
+ public async Airport_findByICAO(icao: string): Promise<FSHubResponse<Airport>> {
185
+ return await Api.airport.findByICAO(icao, this);
186
+ }
187
+
188
+ public async Airport_findMETAR(icao: string) {
189
+ return await Api.airport.findMETAR(icao, this);
190
+ }
180
191
  }
@@ -0,0 +1,26 @@
1
+ import { Gps, Handles, Link } from './Common';
2
+
3
+ export type Owner = {
4
+ id: number
5
+ name: string
6
+ bio: any
7
+ handles: Handles
8
+ base: string
9
+ locale: string
10
+ gps: Gps
11
+ timezone: string
12
+ country: string
13
+ is_online: boolean
14
+ online_at: string
15
+ created_at: string
16
+ links: Link[]
17
+ }
18
+
19
+ export type Airline = {
20
+ id: number
21
+ name: string
22
+ abbr: string
23
+ owner: Owner
24
+ handles: Handles
25
+ links: Link[]
26
+ }
@@ -0,0 +1,56 @@
1
+ export type Airport = {
2
+ icao: string
3
+ iata: string
4
+ name: string
5
+ locale: AirportLocale
6
+ geo: AirportGeo
7
+ alt: number
8
+ mag_var: number
9
+ frequencies: AirportFrequencies
10
+ runways: AirportRunway[]
11
+ links: AirportLink[]
12
+ }
13
+
14
+ export type AirportLocale = {
15
+ city: string
16
+ state: string
17
+ county: string
18
+ }
19
+
20
+ export type AirportGeo = {
21
+ lat: number
22
+ lng: number
23
+ }
24
+
25
+ export type AirportFrequencies = {
26
+ atis: string
27
+ cd: string
28
+ gnd: string
29
+ tower: string
30
+ unicom: string
31
+ multicom: any
32
+ app: string
33
+ dep: string
34
+ }
35
+
36
+ export type AirportRunway = {
37
+ name: string
38
+ type: string
39
+ length: number
40
+ hdg: number
41
+ geo: AirportGeo
42
+ ils: AirportIls
43
+ }
44
+
45
+ export type AirportIls = {
46
+ id?: string
47
+ frequency?: string
48
+ hdg?: number
49
+ slope?: number
50
+ }
51
+
52
+ export type AirportLink = {
53
+ rel: string
54
+ uri: string
55
+ }
56
+