fshub-api 3.0.1 → 4.0.1
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.
- package/README.md +30 -0
- package/dist/api/FSHubApiRequest.d.ts +5 -2
- package/dist/api/FSHubApiRequest.d.ts.map +1 -1
- package/dist/api/FSHubApiRequest.js +52 -8
- package/dist/api/FSHubApiRequest.js.map +1 -1
- package/dist/api/airline/Airline_approveApplication.d.ts +3 -0
- package/dist/api/airline/Airline_approveApplication.d.ts.map +1 -0
- package/dist/api/airline/Airline_approveApplication.js +56 -0
- package/dist/api/airline/Airline_approveApplication.js.map +1 -0
- package/dist/api/airline/Airline_get.d.ts +2 -2
- package/dist/api/airline/Airline_get.d.ts.map +1 -1
- package/dist/api/airline/Airline_get.js +1 -1
- package/dist/api/airline/Airline_get.js.map +1 -1
- package/dist/api/airline/Airline_getAll.d.ts +2 -2
- package/dist/api/airline/Airline_getAll.d.ts.map +1 -1
- package/dist/api/airline/Airline_getAll.js +1 -1
- package/dist/api/airline/Airline_getAll.js.map +1 -1
- package/dist/api/airline/Airline_getAllFlightDeparturesAndArrivals.d.ts +2 -2
- package/dist/api/airline/Airline_getAllFlightDeparturesAndArrivals.d.ts.map +1 -1
- package/dist/api/airline/Airline_getAllFlightDeparturesAndArrivals.js +1 -1
- package/dist/api/airline/Airline_getAllFlightDeparturesAndArrivals.js.map +1 -1
- package/dist/api/airline/Airline_getAllFlightsArrivals.d.ts +2 -2
- package/dist/api/airline/Airline_getAllFlightsArrivals.d.ts.map +1 -1
- package/dist/api/airline/Airline_getAllFlightsArrivals.js +1 -1
- package/dist/api/airline/Airline_getAllFlightsArrivals.js.map +1 -1
- package/dist/api/airline/Airline_getAllFlightsDepartures.d.ts +2 -2
- package/dist/api/airline/Airline_getAllFlightsDepartures.d.ts.map +1 -1
- package/dist/api/airline/Airline_getAllFlightsDepartures.js +1 -1
- package/dist/api/airline/Airline_getAllFlightsDepartures.js.map +1 -1
- package/dist/api/airline/Airline_getAllRanks.d.ts +3 -0
- package/dist/api/airline/Airline_getAllRanks.d.ts.map +1 -0
- package/dist/api/airline/Airline_getAllRanks.js +57 -0
- package/dist/api/airline/Airline_getAllRanks.js.map +1 -0
- package/dist/api/airline/Airline_getAllRoles.d.ts +3 -0
- package/dist/api/airline/Airline_getAllRoles.d.ts.map +1 -0
- package/dist/api/airline/Airline_getAllRoles.js +57 -0
- package/dist/api/airline/Airline_getAllRoles.js.map +1 -0
- package/dist/api/airline/Airline_getAllScreenshots.d.ts +2 -2
- package/dist/api/airline/Airline_getAllScreenshots.d.ts.map +1 -1
- package/dist/api/airline/Airline_getAllScreenshots.js +2 -2
- package/dist/api/airline/Airline_getAllScreenshots.js.map +1 -1
- package/dist/api/airline/Airline_getFlights.d.ts +2 -2
- package/dist/api/airline/Airline_getFlights.d.ts.map +1 -1
- package/dist/api/airline/Airline_getFlights.js +1 -1
- package/dist/api/airline/Airline_getFlights.js.map +1 -1
- package/dist/api/airline/Airline_getPilotStats.d.ts +2 -2
- package/dist/api/airline/Airline_getPilotStats.d.ts.map +1 -1
- package/dist/api/airline/Airline_getPilotStats.js +1 -1
- package/dist/api/airline/Airline_getPilotStats.js.map +1 -1
- package/dist/api/airline/Airline_getPilots.d.ts +2 -2
- package/dist/api/airline/Airline_getPilots.d.ts.map +1 -1
- package/dist/api/airline/Airline_getPilots.js +1 -1
- package/dist/api/airline/Airline_getPilots.js.map +1 -1
- package/dist/api/airline/Airline_getStats.d.ts +2 -2
- package/dist/api/airline/Airline_getStats.d.ts.map +1 -1
- package/dist/api/airline/Airline_getStats.js +1 -1
- package/dist/api/airline/Airline_getStats.js.map +1 -1
- package/dist/api/airline/Airline_pilotPointPurchase.d.ts +3 -0
- package/dist/api/airline/Airline_pilotPointPurchase.d.ts.map +1 -0
- package/dist/api/airline/Airline_pilotPointPurchase.js +56 -0
- package/dist/api/airline/Airline_pilotPointPurchase.js.map +1 -0
- package/dist/api/airline/Airline_pilotSetRank.d.ts +3 -0
- package/dist/api/airline/Airline_pilotSetRank.d.ts.map +1 -0
- package/dist/api/airline/Airline_pilotSetRank.js +56 -0
- package/dist/api/airline/Airline_pilotSetRank.js.map +1 -0
- package/dist/api/airline/Airline_rejectApplication.d.ts +3 -0
- package/dist/api/airline/Airline_rejectApplication.d.ts.map +1 -0
- package/dist/api/airline/Airline_rejectApplication.js +56 -0
- package/dist/api/airline/Airline_rejectApplication.js.map +1 -0
- package/dist/api/airline/index.d.ts +12 -0
- package/dist/api/airline/index.d.ts.map +1 -1
- package/dist/api/airline/index.js +12 -0
- package/dist/api/airline/index.js.map +1 -1
- package/dist/api/flight/Flight_getFlightById.d.ts +2 -2
- package/dist/api/flight/Flight_getFlightById.d.ts.map +1 -1
- package/dist/api/flight/Flight_getFlightById.js +1 -1
- package/dist/api/flight/Flight_getFlightById.js.map +1 -1
- package/dist/api/flight/Flight_getFlightScreenshotsById.d.ts +2 -2
- package/dist/api/flight/Flight_getFlightScreenshotsById.d.ts.map +1 -1
- package/dist/api/flight/Flight_getFlightScreenshotsById.js +2 -2
- package/dist/api/flight/Flight_getFlightScreenshotsById.js.map +1 -1
- package/dist/api/flight/Flight_getFlights.d.ts +3 -0
- package/dist/api/flight/Flight_getFlights.d.ts.map +1 -0
- package/dist/api/flight/Flight_getFlights.js +57 -0
- package/dist/api/flight/Flight_getFlights.js.map +1 -0
- package/dist/api/flight/index.d.ts +2 -0
- package/dist/api/flight/index.d.ts.map +1 -1
- package/dist/api/flight/index.js +2 -0
- package/dist/api/flight/index.js.map +1 -1
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_get.d.ts +2 -2
- package/dist/api/pilot/Pilot_get.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_get.js +1 -1
- package/dist/api/pilot/Pilot_get.js.map +1 -1
- package/dist/api/pilot/Pilot_getAll.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAll.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAll.js +1 -1
- package/dist/api/pilot/Pilot_getAll.js.map +1 -1
- package/dist/api/pilot/Pilot_getAllAirlines.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAllAirlines.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAllAirlines.js +1 -1
- package/dist/api/pilot/Pilot_getAllAirlines.js.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlightDeparturesAndArrivals.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAllFlightDeparturesAndArrivals.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlightDeparturesAndArrivals.js +1 -1
- package/dist/api/pilot/Pilot_getAllFlightDeparturesAndArrivals.js.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlights.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAllFlights.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlights.js +1 -1
- package/dist/api/pilot/Pilot_getAllFlights.js.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlightsArrivals.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAllFlightsArrivals.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlightsArrivals.js +1 -1
- package/dist/api/pilot/Pilot_getAllFlightsArrivals.js.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlightsDepartures.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAllFlightsDepartures.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAllFlightsDepartures.js +1 -1
- package/dist/api/pilot/Pilot_getAllFlightsDepartures.js.map +1 -1
- package/dist/api/pilot/Pilot_getAllScreenshots.d.ts +2 -2
- package/dist/api/pilot/Pilot_getAllScreenshots.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getAllScreenshots.js +2 -2
- package/dist/api/pilot/Pilot_getAllScreenshots.js.map +1 -1
- package/dist/api/pilot/Pilot_getCurrent.d.ts +2 -2
- package/dist/api/pilot/Pilot_getCurrent.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getCurrent.js +1 -1
- package/dist/api/pilot/Pilot_getCurrent.js.map +1 -1
- package/dist/api/pilot/Pilot_getLatestFlight.d.ts +2 -2
- package/dist/api/pilot/Pilot_getLatestFlight.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getLatestFlight.js +1 -1
- package/dist/api/pilot/Pilot_getLatestFlight.js.map +1 -1
- package/dist/api/pilot/Pilot_getStats.d.ts +2 -2
- package/dist/api/pilot/Pilot_getStats.d.ts.map +1 -1
- package/dist/api/pilot/Pilot_getStats.js +1 -1
- package/dist/api/pilot/Pilot_getStats.js.map +1 -1
- package/dist/index.d.ts +31 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +83 -34
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/release.ps1 +15 -0
- package/src/api/FSHubApiRequest.ts +31 -4
- package/src/api/airline/Airline_approveApplication.ts +10 -0
- package/src/api/airline/Airline_get.ts +2 -2
- package/src/api/airline/Airline_getAll.ts +2 -2
- package/src/api/airline/Airline_getAllFlightDeparturesAndArrivals.ts +2 -2
- package/src/api/airline/Airline_getAllFlightsArrivals.ts +2 -2
- package/src/api/airline/Airline_getAllFlightsDepartures.ts +2 -2
- package/src/api/airline/Airline_getAllRanks.ts +8 -0
- package/src/api/airline/Airline_getAllRoles.ts +8 -0
- package/src/api/airline/Airline_getAllScreenshots.ts +3 -3
- package/src/api/airline/Airline_getFlights.ts +2 -2
- package/src/api/airline/Airline_getPilotStats.ts +2 -2
- package/src/api/airline/Airline_getPilots.ts +2 -2
- package/src/api/airline/Airline_getStats.ts +2 -2
- package/src/api/airline/Airline_pilotPointPurchase.ts +10 -0
- package/src/api/airline/Airline_pilotSetRank.ts +10 -0
- package/src/api/airline/Airline_rejectApplication.ts +10 -0
- package/src/api/airline/index.ts +13 -1
- package/src/api/flight/Flight_getFlightById.ts +2 -2
- package/src/api/flight/Flight_getFlightScreenshotsById.ts +3 -3
- package/src/api/flight/Flight_getFlights.ts +9 -0
- package/src/api/flight/index.ts +2 -0
- package/src/api/pilot/Pilot_get.ts +2 -2
- package/src/api/pilot/Pilot_getAll.ts +2 -2
- package/src/api/pilot/Pilot_getAllAirlines.ts +2 -2
- package/src/api/pilot/Pilot_getAllFlightDeparturesAndArrivals.ts +2 -2
- package/src/api/pilot/Pilot_getAllFlights.ts +2 -2
- package/src/api/pilot/Pilot_getAllFlightsArrivals.ts +2 -2
- package/src/api/pilot/Pilot_getAllFlightsDepartures.ts +2 -2
- package/src/api/pilot/Pilot_getAllScreenshots.ts +3 -3
- package/src/api/pilot/Pilot_getCurrent.ts +2 -2
- package/src/api/pilot/Pilot_getLatestFlight.ts +2 -2
- package/src/api/pilot/Pilot_getStats.ts +2 -2
- package/src/index.spec.ts +143 -77
- package/src/index.ts +50 -1
- package/src/types/index.ts +92 -36
package/dist/types/index.d.ts
CHANGED
|
@@ -41,17 +41,6 @@ export type Gps = {
|
|
|
41
41
|
lat: number;
|
|
42
42
|
lng: number;
|
|
43
43
|
};
|
|
44
|
-
export type FSHubResponse<T> = {
|
|
45
|
-
data: T;
|
|
46
|
-
};
|
|
47
|
-
export type FSHubError = {
|
|
48
|
-
message: string;
|
|
49
|
-
code: number;
|
|
50
|
-
error?: boolean;
|
|
51
|
-
details?: {
|
|
52
|
-
pilot: number;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
44
|
export type Flight = {
|
|
56
45
|
id: number;
|
|
57
46
|
user: User;
|
|
@@ -180,30 +169,90 @@ export type Urls = {
|
|
|
180
169
|
fullsize: string;
|
|
181
170
|
thumbnail: string;
|
|
182
171
|
};
|
|
172
|
+
export type FSHubRequestOptions = {
|
|
173
|
+
cursor?: number;
|
|
174
|
+
limit?: number;
|
|
175
|
+
};
|
|
183
176
|
export type FSHubApi = {
|
|
184
177
|
axios: AxiosInstance;
|
|
185
|
-
Pilot_getCurrent: () => Promise<CurrentPilot
|
|
186
|
-
Pilot_getAll: () => Promise<Pilot[]
|
|
187
|
-
Pilot_get: (id: number) => Promise<Pilot
|
|
188
|
-
Pilot_getLatestFlight: (id: number) => Promise<Flight
|
|
189
|
-
Pilot_getAllFlights: (id: number) => Promise<Flight[]
|
|
190
|
-
Pilot_getAllAirlines: (id: number) => Promise<Airline[]
|
|
191
|
-
Pilot_getStats: (id: number) => Promise<PilotStats
|
|
192
|
-
Pilot_getAllFlightsDepartures: (id: number, airportCode: string) => Promise<Flight[]
|
|
193
|
-
Pilot_getAllFlightsArrivals: (id: number, airportCode: string) => Promise<Flight[]
|
|
194
|
-
Pilot_getAllFlightDeparturesAndArrivals: (id: number, departureAirportCode: string, arrivalAirportCode: string) => Promise<Flight[]
|
|
195
|
-
Pilot_getAllScreenshots: (id: number) => Promise<Screenshot[]
|
|
196
|
-
Airline_getAll: () => Promise<Airline[]
|
|
197
|
-
Airline_get: (id: number) => Promise<Airline
|
|
198
|
-
Airline_getPilots: (id: number) => Promise<Pilot[]
|
|
199
|
-
Airline_getPilotStats: (id: number, pilotId: number) => Promise<PilotStats
|
|
200
|
-
Airline_getFlights: (id: number) => Promise<Flight[]
|
|
201
|
-
Airline_getAllFlightsDepartures: (id: number, airportCode: string) => Promise<Flight[]
|
|
202
|
-
Airline_getAllFlightsArrivals: (id: number, airportCode: string) => Promise<Flight[]
|
|
203
|
-
Airline_getAllFlightDeparturesAndArrivals: (id: number, departureAirportCode: string, arrivalAirportCode: string) => Promise<Flight[]
|
|
204
|
-
Airline_getAllScreenshots: (id: number) => Promise<Screenshot[]
|
|
205
|
-
Airline_getStats: (id: number) => Promise<AirlineStats
|
|
206
|
-
|
|
207
|
-
|
|
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;
|
|
208
257
|
};
|
|
209
258
|
//# 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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MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fshub-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "TypeScript HTTP API wrapper library for FSHub REST API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"axios": "^1.6.0",
|
|
54
54
|
"dotenv": "^17.2.1"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|
package/release.ps1
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[Parameter(Mandatory=$true)]
|
|
3
|
+
[ValidateSet("patch", "minor", "major")]
|
|
4
|
+
[string]$Type
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
npm version $Type
|
|
8
|
+
npm run build
|
|
9
|
+
git add .
|
|
10
|
+
$version = npm pkg get version
|
|
11
|
+
$version = $version.Trim('"')
|
|
12
|
+
git commit -m "Release v$version"
|
|
13
|
+
git tag -a "v$version" -m "Release v$version"
|
|
14
|
+
git push origin master
|
|
15
|
+
git push origin --tags
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
-
import { FSHubResponse, FSHubError, FSHubApi } from '../types';
|
|
2
|
+
import { FSHubRequestOptions, FSHubResponse, FSHubError, FSHubApi } from '../types';
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export async function FSHubApiRequest<T>(url: string, api: FSHubApi, options?: FSHubRequestOptions): Promise<FSHubResponse<T>> {
|
|
5
|
+
let queryParams = '';
|
|
6
|
+
if (options) {
|
|
7
|
+
queryParams = `?cursor=${options.cursor}&limit=${options.limit}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const response: FSHubResponse<T> = await api.axios.get(url + queryParams)
|
|
6
11
|
.then((res: AxiosResponse<FSHubResponse<T>>) => res.data)
|
|
7
12
|
.catch((err: AxiosError<FSHubError>) => {
|
|
8
13
|
if (err.response?.data.code === 404) {
|
|
@@ -13,4 +18,26 @@ export default async function FSHubApiRequest<T>(url: string, api: FSHubApi): Pr
|
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
return response;
|
|
16
|
-
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function FSHubApiPostRequest<T, D = any>(url: string, api: FSHubApi, data?: D): Promise<FSHubResponse<T>> {
|
|
24
|
+
const response: FSHubResponse<T> = await api.axios.post(url, data)
|
|
25
|
+
.then((res: AxiosResponse<FSHubResponse<T>>) => res.data)
|
|
26
|
+
.catch((err: AxiosError<FSHubError>) => {
|
|
27
|
+
throw new Error(err.response?.data.message);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return response;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function FSHubApiPutRequest<T, D = any>(url: string, api: FSHubApi, data?: D): Promise<FSHubResponse<T>> {
|
|
34
|
+
const response: FSHubResponse<T> = await api.axios.put(url, data)
|
|
35
|
+
.then((res: AxiosResponse<FSHubResponse<T>>) => res.data)
|
|
36
|
+
.catch((err: AxiosError<FSHubError>) => {
|
|
37
|
+
throw new Error(err.response?.data.message);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default FSHubApiRequest;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FSHubApi, FSHubResponse, FSHubApplicationResponse } from "../../types";
|
|
2
|
+
import { FSHubApiPostRequest } from "../FSHubApiRequest";
|
|
3
|
+
|
|
4
|
+
export default async function Airline_approveApplication(pilotId: number, airlineId: number, api: FSHubApi): Promise<FSHubResponse<FSHubApplicationResponse>> {
|
|
5
|
+
const url = `airline/${airlineId}/application/${pilotId}/approve`;
|
|
6
|
+
|
|
7
|
+
const response: FSHubResponse<FSHubApplicationResponse> = await FSHubApiPostRequest<FSHubApplicationResponse, void>(url, api);
|
|
8
|
+
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Airline } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_get(id: number, api: FSHubApi): Promise<Airline
|
|
4
|
+
export default async function Airline_get(id: number, api: FSHubApi): Promise<FSHubResponse<Airline>> {
|
|
5
5
|
const response: FSHubResponse<Airline> = await FSHubApiRequest(`airline/${id}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Airline } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getAll(api: FSHubApi): Promise<Airline[]
|
|
4
|
+
export default async function Airline_getAll(api: FSHubApi): Promise<FSHubResponse<Airline[]>> {
|
|
5
5
|
const response: FSHubResponse<Airline[]> = await FSHubApiRequest(`airline`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Flight, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getAllFlightDeparturesAndArrivals(id: number, departureAirportCode: string, arrivalAirportCode: string, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Airline_getAllFlightDeparturesAndArrivals(id: number, departureAirportCode: string, arrivalAirportCode: string, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`airline/${id}/departure/${departureAirportCode}/arrival/${arrivalAirportCode}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Flight } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getAllFlightsArrivals(id: number, airportCode: string, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Airline_getAllFlightsArrivals(id: number, airportCode: string, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`airline/${id}/arrival/${airportCode}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Flight, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getAllFlightsDepartures(id: number, airportCode: string, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Airline_getAllFlightsDepartures(id: number, airportCode: string, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`airline/${id}/departure/${airportCode}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FSHubApi, FSHubResponse, FSHubAirlineRank } from "../../types";
|
|
2
|
+
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
|
+
|
|
4
|
+
export default async function Airline_getAllRanks(airlineId: number, api: FSHubApi): Promise<FSHubResponse<FSHubAirlineRank[]>> {
|
|
5
|
+
const response: FSHubResponse<FSHubAirlineRank[]> = await FSHubApiRequest(`airline/${airlineId}/rank`, api);
|
|
6
|
+
|
|
7
|
+
return response;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FSHubApi, FSHubResponse, FSHubAirlineRole } from "../../types";
|
|
2
|
+
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
|
+
|
|
4
|
+
export default async function Airline_getAllRoles(airlineId: number, api: FSHubApi): Promise<FSHubResponse<FSHubAirlineRole[]>> {
|
|
5
|
+
const response: FSHubResponse<FSHubAirlineRole[]> = await FSHubApiRequest(`airline/${airlineId}/role`, api);
|
|
6
|
+
|
|
7
|
+
return response;
|
|
8
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Screenshot } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getAllScreenshots(id: number, api: FSHubApi): Promise<Screenshot[]
|
|
4
|
+
export default async function Airline_getAllScreenshots(id: number, api: FSHubApi): Promise<FSHubResponse<Screenshot[]>> {
|
|
5
5
|
try {
|
|
6
6
|
const response: FSHubResponse<Screenshot[]> = await FSHubApiRequest(`airline/${id}/screenshot`, api);
|
|
7
7
|
|
|
8
|
-
return response
|
|
8
|
+
return response;
|
|
9
9
|
} catch (error) {
|
|
10
10
|
if (error instanceof Error && error.message === 'No records found') {
|
|
11
|
-
return [];
|
|
11
|
+
return { data: [] };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
throw error;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Flight } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getFlights(id: number, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Airline_getFlights(id: number, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`airline/${id}/flight`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, PilotStats } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getPilotStats(id: number, pilotId: number, api: FSHubApi): Promise<PilotStats
|
|
4
|
+
export default async function Airline_getPilotStats(id: number, pilotId: number, api: FSHubApi): Promise<FSHubResponse<PilotStats>> {
|
|
5
5
|
const response: FSHubResponse<PilotStats> = await FSHubApiRequest(`airline/${id}/pilot/${pilotId}/stats`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Pilot } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getPilots(id: number, api: FSHubApi): Promise<Pilot[]
|
|
4
|
+
export default async function Airline_getPilots(id: number, api: FSHubApi): Promise<FSHubResponse<Pilot[]>> {
|
|
5
5
|
const response: FSHubResponse<Pilot[]> = await FSHubApiRequest(`airline/${id}/pilot`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AirlineStats, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Airline_getStats(id: number, api: FSHubApi): Promise<AirlineStats
|
|
4
|
+
export default async function Airline_getStats(id: number, api: FSHubApi): Promise<FSHubResponse<AirlineStats>> {
|
|
5
5
|
const response: FSHubResponse<AirlineStats> = await FSHubApiRequest(`airline/${id}/stats`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FSHubApi, FSHubResponse, FSHubPilotPointPurchaseTransactionResponse, FSHubPilotPointPurchaseTransactionData } from "../../types";
|
|
2
|
+
import { FSHubApiPostRequest } from "../FSHubApiRequest";
|
|
3
|
+
|
|
4
|
+
export default async function Airline_pilotPointPurchase(pilotId: number, airlineId: number, data: FSHubPilotPointPurchaseTransactionData, api: FSHubApi): Promise<FSHubResponse<FSHubPilotPointPurchaseTransactionResponse>> {
|
|
5
|
+
const url = `airline/${airlineId}/application/${pilotId}/purchase`;
|
|
6
|
+
|
|
7
|
+
const response: FSHubResponse<FSHubPilotPointPurchaseTransactionResponse> = await FSHubApiPostRequest<FSHubPilotPointPurchaseTransactionResponse, FSHubPilotPointPurchaseTransactionData>(url, api, data);
|
|
8
|
+
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FSHubApi, FSHubResponse, FSHubApplicationResponse, FSHubPilotSetRankData } from "../../types";
|
|
2
|
+
import { FSHubApiPutRequest } from "../FSHubApiRequest";
|
|
3
|
+
|
|
4
|
+
export default async function Airline_pilotSetRank(pilotId: number, airlineId: number, data: FSHubPilotSetRankData, api: FSHubApi): Promise<FSHubResponse<FSHubApplicationResponse>> {
|
|
5
|
+
const url = `airline/${airlineId}/application/${pilotId}/rank`;
|
|
6
|
+
|
|
7
|
+
const response: FSHubResponse<FSHubApplicationResponse> = await FSHubApiPutRequest<FSHubApplicationResponse, FSHubPilotSetRankData>(url, api, data);
|
|
8
|
+
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FSHubApi, FSHubResponse, FSHubApplicationResponse } from "../../types";
|
|
2
|
+
import { FSHubApiPostRequest } from "../FSHubApiRequest";
|
|
3
|
+
|
|
4
|
+
export default async function Airline_rejectApplication(pilotId: number, airlineId: number, api: FSHubApi): Promise<FSHubResponse<FSHubApplicationResponse>> {
|
|
5
|
+
const url = `airline/${airlineId}/application/${pilotId}/reject`;
|
|
6
|
+
|
|
7
|
+
const response: FSHubResponse<FSHubApplicationResponse> = await FSHubApiPostRequest<FSHubApplicationResponse, void>(url, api);
|
|
8
|
+
|
|
9
|
+
return response;
|
|
10
|
+
}
|
package/src/api/airline/index.ts
CHANGED
|
@@ -8,6 +8,12 @@ import Airline_getAllFlightsArrivals from './Airline_getAllFlightsArrivals';
|
|
|
8
8
|
import Airline_getAllFlightDeparturesAndArrivals from './Airline_getAllFlightDeparturesAndArrivals';
|
|
9
9
|
import Airline_getAllScreenshots from './Airline_getAllScreenshots';
|
|
10
10
|
import Airline_getStats from './Airline_getStats';
|
|
11
|
+
import Airline_approveApplication from './Airline_approveApplication';
|
|
12
|
+
import Airline_rejectApplication from './Airline_rejectApplication';
|
|
13
|
+
import Airline_pilotPointPurchase from './Airline_pilotPointPurchase';
|
|
14
|
+
import Airline_getAllRanks from './Airline_getAllRanks';
|
|
15
|
+
import Airline_getAllRoles from './Airline_getAllRoles';
|
|
16
|
+
import Airline_pilotSetRank from './Airline_pilotSetRank';
|
|
11
17
|
|
|
12
18
|
export const Airline = {
|
|
13
19
|
getAll: Airline_getAll,
|
|
@@ -19,5 +25,11 @@ export const Airline = {
|
|
|
19
25
|
getAllFlightsArrivals: Airline_getAllFlightsArrivals,
|
|
20
26
|
getAllFlightDeparturesAndArrivals: Airline_getAllFlightDeparturesAndArrivals,
|
|
21
27
|
getAllScreenshots: Airline_getAllScreenshots,
|
|
22
|
-
getStats: Airline_getStats,
|
|
28
|
+
getStats: Airline_getStats,
|
|
29
|
+
approveApplication: Airline_approveApplication,
|
|
30
|
+
rejectApplication: Airline_rejectApplication,
|
|
31
|
+
pilotPointPurchase: Airline_pilotPointPurchase,
|
|
32
|
+
pilotSetRank: Airline_pilotSetRank,
|
|
33
|
+
getAllRanks: Airline_getAllRanks,
|
|
34
|
+
getAllRoles: Airline_getAllRoles,
|
|
23
35
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Flight, FSHubApi, FSHubResponse } from "../../types";
|
|
3
3
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
4
4
|
|
|
5
|
-
export default async function Flight_getFlightById(id: number, api: FSHubApi): Promise<Flight
|
|
5
|
+
export default async function Flight_getFlightById(id: number, api: FSHubApi): Promise<FSHubResponse<Flight>> {
|
|
6
6
|
const response: FSHubResponse<Flight> = await FSHubApiRequest(`flight/${id}`, api);
|
|
7
7
|
|
|
8
|
-
return response
|
|
8
|
+
return response;
|
|
9
9
|
}
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import { Screenshot, FSHubApi, FSHubResponse } from "../../types";
|
|
3
3
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
4
4
|
|
|
5
|
-
export default async function Flight_getFlightScreenshotsById(id: number, api: FSHubApi): Promise<Screenshot[]
|
|
5
|
+
export default async function Flight_getFlightScreenshotsById(id: number, api: FSHubApi): Promise<FSHubResponse<Screenshot[]>> {
|
|
6
6
|
let response: FSHubResponse<Screenshot[]>;
|
|
7
7
|
try {
|
|
8
8
|
response = await FSHubApiRequest(`flight/${id}/screenshot`, api);
|
|
9
9
|
} catch (error: any) {
|
|
10
10
|
if (error.message === 'Not Found') {
|
|
11
|
-
return [];
|
|
11
|
+
return { data: [] };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
throw error;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
return response
|
|
17
|
+
return response;
|
|
18
18
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// https://fshub.io/api/v3/flight/{id}
|
|
2
|
+
import { Flight, FSHubApi, FSHubRequestOptions, FSHubResponse } from "../../types";
|
|
3
|
+
import FSHubApiRequest from "../FSHubApiRequest";
|
|
4
|
+
|
|
5
|
+
export default async function Flight_getFlights(api: FSHubApi, options?: FSHubRequestOptions): Promise<FSHubResponse<Flight[]>> {
|
|
6
|
+
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`flight`, api, options);
|
|
7
|
+
|
|
8
|
+
return response;
|
|
9
|
+
}
|
package/src/api/flight/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import Flight_getFlightById from './Flight_getFlightById';
|
|
2
2
|
import Flight_getFlightScreenshotsById from './Flight_getFlightScreenshotsById';
|
|
3
|
+
import Flight_getFlights from './Flight_getFlights';
|
|
3
4
|
|
|
4
5
|
export const Flight = {
|
|
5
6
|
getFlightById: Flight_getFlightById,
|
|
6
7
|
getFlightScreenshotsById: Flight_getFlightScreenshotsById,
|
|
8
|
+
getFlights: Flight_getFlights,
|
|
7
9
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Pilot, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_get(id: number, api: FSHubApi): Promise<Pilot
|
|
4
|
+
export default async function Pilot_get(id: number, api: FSHubApi): Promise<FSHubResponse<Pilot>> {
|
|
5
5
|
const response: FSHubResponse<Pilot> = await FSHubApiRequest(`pilot/${id}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Pilot, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAll(api: FSHubApi): Promise<Pilot[]
|
|
4
|
+
export default async function Pilot_getAll(api: FSHubApi): Promise<FSHubResponse<Pilot[]>> {
|
|
5
5
|
const response: FSHubResponse<Pilot[]> = await FSHubApiRequest('pilot', api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Airline, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAllAirlines(id: number, api: FSHubApi): Promise<Airline[]
|
|
4
|
+
export default async function Pilot_getAllAirlines(id: number, api: FSHubApi): Promise<FSHubResponse<Airline[]>> {
|
|
5
5
|
const response: FSHubResponse<Airline[]> = await FSHubApiRequest(`pilot/${id}/airline`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Flight, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAllFlightDeparturesAndArrivals(id: number, departureAirportCode: string, arrivalAirportCode: string, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Pilot_getAllFlightDeparturesAndArrivals(id: number, departureAirportCode: string, arrivalAirportCode: string, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`pilot/${id}/flight/departure/${departureAirportCode}/arrival/${arrivalAirportCode}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Flight } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAllFlights(id: number, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Pilot_getAllFlights(id: number, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`pilot/${id}/flight`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Flight } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAllFlightsArrivals(id: number, airportCode: string, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Pilot_getAllFlightsArrivals(id: number, airportCode: string, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`pilot/${id}/flight/arrival/${airportCode}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Flight, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAllFlightsDepartures(id: number, airportCode: string, api: FSHubApi): Promise<Flight[]
|
|
4
|
+
export default async function Pilot_getAllFlightsDepartures(id: number, airportCode: string, api: FSHubApi): Promise<FSHubResponse<Flight[]>> {
|
|
5
5
|
const response: FSHubResponse<Flight[]> = await FSHubApiRequest(`pilot/${id}/flight/departure/${airportCode}`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FSHubApi, FSHubResponse, Screenshot } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getAllScreenshots(id: number, api: FSHubApi): Promise<Screenshot[]
|
|
4
|
+
export default async function Pilot_getAllScreenshots(id: number, api: FSHubApi): Promise<FSHubResponse<Screenshot[]>> {
|
|
5
5
|
try {
|
|
6
6
|
const response: FSHubResponse<Screenshot[]> = await FSHubApiRequest(`pilot/${id}/screenshot`, api);
|
|
7
7
|
|
|
8
|
-
return response
|
|
8
|
+
return response;
|
|
9
9
|
} catch (error) {
|
|
10
10
|
if (error instanceof Error && error.message === 'No records found') {
|
|
11
|
-
return [];
|
|
11
|
+
return { data: [] };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
throw error;
|