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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CurrentPilot, FSHubApi, FSHubResponse } from "../../types";
|
|
2
2
|
import FSHubApiRequest from "../FSHubApiRequest";
|
|
3
3
|
|
|
4
|
-
export default async function Pilot_getCurrent(api: FSHubApi): Promise<CurrentPilot
|
|
4
|
+
export default async function Pilot_getCurrent(api: FSHubApi): Promise<FSHubResponse<CurrentPilot>> {
|
|
5
5
|
const response: FSHubResponse<CurrentPilot> = await FSHubApiRequest('user', 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_getLatestFlight(id: number, api: FSHubApi): Promise<Flight
|
|
4
|
+
export default async function Pilot_getLatestFlight(id: number, api: FSHubApi): Promise<FSHubResponse<Flight>> {
|
|
5
5
|
const response: FSHubResponse<Flight> = await FSHubApiRequest(`pilot/${id}/flight/latest`, 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 Pilot_getStats(id: number, api: FSHubApi): Promise<PilotStats
|
|
4
|
+
export default async function Pilot_getStats(id: number, api: FSHubApi): Promise<FSHubResponse<PilotStats>> {
|
|
5
5
|
const response: FSHubResponse<PilotStats> = await FSHubApiRequest(`pilot/${id}/stats`, api);
|
|
6
6
|
|
|
7
|
-
return response
|
|
7
|
+
return response;
|
|
8
8
|
}
|
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 } from './types';
|
|
5
|
+
import { CurrentPilot, Flight, Pilot, FSHubApi, Airline, PilotStats, Screenshot, FSHubResponse, AirlineStats, FSHubApplicationResponse, FSHubPilotPointPurchaseTransactionResponse } from './types';
|
|
6
6
|
|
|
7
7
|
dotenv.config();
|
|
8
8
|
let api: FSHubApi;
|
|
@@ -41,176 +41,242 @@ describe('FSHubApi()', function() {
|
|
|
41
41
|
expect(api.Airline_getAllFlightDeparturesAndArrivals).to.be.a('function');
|
|
42
42
|
expect(api.Airline_getAllScreenshots).to.be.a('function');
|
|
43
43
|
expect(api.Airline_getStats).to.be.a('function');
|
|
44
|
+
expect(api.Airline_approveApplication).to.be.a('function');
|
|
45
|
+
expect(api.Airline_rejectApplication).to.be.a('function');
|
|
46
|
+
expect(api.Airline_pilotPointPurchase).to.be.a('function');
|
|
47
|
+
expect(api.Airline_pilotSetRank).to.be.a('function');
|
|
48
|
+
expect(api.Airline_getAllRanks).to.be.a('function');
|
|
49
|
+
expect(api.Airline_getAllRoles).to.be.a('function');
|
|
44
50
|
expect(api.Flight_getFlightById).to.be.a('function');
|
|
45
51
|
expect(api.Flight_getFlightScreenshotsById).to.be.a('function');
|
|
52
|
+
expect(api.Flight_getFlights).to.be.a('function');
|
|
46
53
|
});
|
|
47
54
|
|
|
48
55
|
describe('Pilot', function() {
|
|
49
56
|
it('Pilot_getCurrent() is called, it should return a valid CurrentPilot object', async function() {
|
|
50
|
-
const pilot: CurrentPilot = await api.Pilot_getCurrent();
|
|
51
|
-
|
|
52
|
-
expect(pilot).to.be.an('Object');
|
|
53
|
-
expect(pilot.id).to.be.a('number');
|
|
54
|
-
expect(pilot.name).to.be.a('string');
|
|
55
|
-
expect(pilot.base).to.be.a('string');
|
|
56
|
-
expect(pilot.locale).to.be.an('string');
|
|
57
|
-
expect(pilot.gps).to.be.an('Object');
|
|
57
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
58
|
+
|
|
59
|
+
expect(pilot.data).to.be.an('Object');
|
|
60
|
+
expect(pilot.data.id).to.be.a('number');
|
|
61
|
+
expect(pilot.data.name).to.be.a('string');
|
|
62
|
+
expect(pilot.data.base).to.be.a('string');
|
|
63
|
+
expect(pilot.data.locale).to.be.an('string');
|
|
64
|
+
expect(pilot.data.gps).to.be.an('Object');
|
|
58
65
|
});
|
|
59
66
|
|
|
60
67
|
it('Pilot_getAll() is called, it should return an array of valid Pilot objects', async function() {
|
|
61
|
-
const pilots: Pilot[] = await api.Pilot_getAll();
|
|
68
|
+
const pilots: FSHubResponse<Pilot[]> = await api.Pilot_getAll();
|
|
62
69
|
|
|
63
|
-
expect(pilots).to.be.an('Array');
|
|
70
|
+
expect(pilots.data).to.be.an('Array');
|
|
64
71
|
});
|
|
65
72
|
|
|
66
73
|
it('Pilot_get(id) is called, it should return a valid Pilot object', async function() {
|
|
67
|
-
const pilot: Pilot = await api.Pilot_get(1);
|
|
68
|
-
|
|
69
|
-
expect(pilot).to.be.an('Object');
|
|
74
|
+
const pilot: FSHubResponse<Pilot> = await api.Pilot_get(1);
|
|
75
|
+
|
|
76
|
+
expect(pilot.data).to.be.an('Object');
|
|
77
|
+
expect(pilot.data).to.be.an('Object');
|
|
78
|
+
expect(pilot.data.id).to.be.a('number');
|
|
79
|
+
expect(pilot.data.name).to.be.a('string');
|
|
80
|
+
expect(pilot.data.base).to.be.a('string');
|
|
81
|
+
expect(pilot.data.locale).to.be.an('string');
|
|
82
|
+
expect(pilot.data.gps).to.be.an('Object');
|
|
70
83
|
});
|
|
71
84
|
|
|
72
85
|
it('Pilot_getLatestFlight(id) is called, it should return a valid Flight object', async function() {
|
|
73
|
-
const pilot:
|
|
74
|
-
const flight: Flight = await api.Pilot_getLatestFlight(pilot.id);
|
|
86
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
87
|
+
const flight: FSHubResponse<Flight> = await api.Pilot_getLatestFlight(pilot.data.id);
|
|
75
88
|
|
|
76
89
|
expect(flight).to.be.an('Object');
|
|
77
90
|
});
|
|
78
91
|
|
|
79
92
|
it('Pilot_getAllFlights(id) is called, it should return an array of valid Flight objects', async function() {
|
|
80
|
-
const pilot:
|
|
81
|
-
const flights: Flight[] = await api.Pilot_getAllFlights(pilot.id);
|
|
93
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
94
|
+
const flights: FSHubResponse<Flight[]> = await api.Pilot_getAllFlights(pilot.data.id);
|
|
82
95
|
|
|
83
|
-
expect(flights).to.be.an('Array');
|
|
96
|
+
expect(flights.data).to.be.an('Array');
|
|
84
97
|
});
|
|
85
98
|
|
|
86
99
|
it('Pilot_getAllAirlines(id) is called, it should return an array of valid Airline objects', async function() {
|
|
87
|
-
const pilot:
|
|
88
|
-
const airlines: Airline[] = await api.Pilot_getAllAirlines(pilot.id);
|
|
100
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
101
|
+
const airlines: FSHubResponse<Airline[]> = await api.Pilot_getAllAirlines(pilot.data.id);
|
|
89
102
|
|
|
90
|
-
expect(airlines).to.be.an('Array');
|
|
103
|
+
expect(airlines.data).to.be.an('Array');
|
|
91
104
|
});
|
|
92
105
|
|
|
93
106
|
it('Pilot_getStats(id) is called, it should return a valid PilotStats object', async function() {
|
|
94
|
-
const pilot:
|
|
95
|
-
const stats: PilotStats = await api.Pilot_getStats(pilot.id);
|
|
107
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
108
|
+
const stats: FSHubResponse<PilotStats> = await api.Pilot_getStats(pilot.data.id);
|
|
96
109
|
|
|
97
|
-
expect(stats).to.be.an('Object');
|
|
98
|
-
expect(stats.id).to.be.a('number');
|
|
99
|
-
expect(stats.all_time).to.be.an('Object');
|
|
100
|
-
expect(stats.month).to.be.an('Object');
|
|
110
|
+
expect(stats.data).to.be.an('Object');
|
|
111
|
+
expect(stats.data.id).to.be.a('number');
|
|
112
|
+
expect(stats.data.all_time).to.be.an('Object');
|
|
113
|
+
expect(stats.data.month).to.be.an('Object');
|
|
101
114
|
});
|
|
102
115
|
|
|
103
116
|
it('Pilot_getAllFlightsDepartures(id, airportCode) is called, it should return an array of valid Flight objects', async function() {
|
|
104
|
-
const pilot:
|
|
105
|
-
const flights: Flight[] = await api.Pilot_getAllFlightsDepartures(pilot.id, 'KPHX');
|
|
117
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
118
|
+
const flights: FSHubResponse<Flight[]> = await api.Pilot_getAllFlightsDepartures(pilot.data.id, 'KPHX');
|
|
106
119
|
|
|
107
|
-
expect(flights).to.be.an('Array');
|
|
120
|
+
expect(flights.data).to.be.an('Array');
|
|
108
121
|
});
|
|
109
122
|
|
|
110
123
|
it('Pilot_getAllFlightsArrivals(id, airportCode) is called, it should return an array of valid Flight objects', async function() {
|
|
111
|
-
const pilot:
|
|
112
|
-
const flights: Flight[] = await api.Pilot_getAllFlightsArrivals(pilot.id, 'KPHX');
|
|
124
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
125
|
+
const flights: FSHubResponse<Flight[]> = await api.Pilot_getAllFlightsArrivals(pilot.data.id, 'KPHX');
|
|
113
126
|
|
|
114
|
-
expect(flights).to.be.an('Array');
|
|
127
|
+
expect(flights.data).to.be.an('Array');
|
|
115
128
|
});
|
|
116
129
|
|
|
117
130
|
it('Pilot_getAllFlightDeparturesAndArrivals(id, departureAirportCode, arrivalAirportCode) is called, it should return an array of valid Flight objects', async function() {
|
|
118
|
-
const pilot:
|
|
119
|
-
const flights: Flight[] = await api.Pilot_getAllFlightDeparturesAndArrivals(pilot.id, 'KPHX', 'KJAC');
|
|
131
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
132
|
+
const flights: FSHubResponse<Flight[]> = await api.Pilot_getAllFlightDeparturesAndArrivals(pilot.data.id, 'KPHX', 'KJAC');
|
|
120
133
|
|
|
121
|
-
expect(flights).to.be.an('Array');
|
|
134
|
+
expect(flights.data).to.be.an('Array');
|
|
122
135
|
});
|
|
123
136
|
|
|
124
137
|
it('Pilot_getAllScreenshots(id) is called, it should return an array of valid Screenshot objects', async function() {
|
|
125
|
-
const pilot:
|
|
126
|
-
const screenshots: Screenshot[] = await api.Pilot_getAllScreenshots(pilot.id);
|
|
138
|
+
const pilot: FSHubResponse<CurrentPilot> = await api.Pilot_getCurrent();
|
|
139
|
+
const screenshots: FSHubResponse<Screenshot[]> = await api.Pilot_getAllScreenshots(pilot.data.id);
|
|
127
140
|
|
|
128
|
-
expect(screenshots).to.be.an('Array');
|
|
141
|
+
expect(screenshots.data).to.be.an('Array');
|
|
129
142
|
});
|
|
130
143
|
});
|
|
131
144
|
|
|
132
145
|
describe('Airline', function() {
|
|
133
146
|
it('Airline_getAll() is called, it should return an array of valid Airline objects', async function() {
|
|
134
|
-
const airlines: Airline[] = await api.Airline_getAll();
|
|
147
|
+
const airlines: FSHubResponse<Airline[]> = await api.Airline_getAll();
|
|
135
148
|
|
|
136
|
-
expect(airlines).to.be.an('Array');
|
|
149
|
+
expect(airlines.data).to.be.an('Array');
|
|
137
150
|
});
|
|
138
151
|
|
|
139
152
|
it('Airline_get(id) is called, it should return a valid Airline object', async function() {
|
|
140
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
153
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
141
154
|
|
|
142
|
-
expect(airline).to.be.an('Object');
|
|
155
|
+
expect(airline.data).to.be.an('Object');
|
|
143
156
|
});
|
|
144
157
|
|
|
145
158
|
it('Airline_getPilots(id) is called, it should return an array of valid Pilot objects', async function() {
|
|
146
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
147
|
-
const pilots: Pilot[] = await api.Airline_getPilots(airline.id);
|
|
159
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
160
|
+
const pilots: FSHubResponse<Pilot[]> = await api.Airline_getPilots(airline.data.id);
|
|
148
161
|
|
|
149
|
-
expect(pilots).to.be.an('Array');
|
|
162
|
+
expect(pilots.data).to.be.an('Array');
|
|
150
163
|
});
|
|
151
164
|
|
|
152
165
|
it('Airline_getPilotStats(id, pilotId) is called, it should return a valid PilotStats object', async function() {
|
|
153
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
154
|
-
const pilot: Pilot = await api.Pilot_getCurrent();
|
|
155
|
-
const stats: PilotStats = await api.Airline_getPilotStats(airline.id, pilot.id);
|
|
166
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
167
|
+
const pilot: FSHubResponse<Pilot> = await api.Pilot_getCurrent();
|
|
168
|
+
const stats: FSHubResponse<PilotStats> = await api.Airline_getPilotStats(airline.data.id, pilot.data.id);
|
|
156
169
|
|
|
157
|
-
expect(stats).to.be.an('Object');
|
|
170
|
+
expect(stats.data).to.be.an('Object');
|
|
158
171
|
});
|
|
159
172
|
|
|
160
173
|
it('Airline_getFlights(id) is called, it should return an array of valid Flight objects', async function() {
|
|
161
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
162
|
-
const flights: Flight[] = await api.Airline_getFlights(airline.id);
|
|
174
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
175
|
+
const flights: FSHubResponse<Flight[]> = await api.Airline_getFlights(airline.data.id);
|
|
163
176
|
|
|
164
|
-
expect(flights).to.be.an('Array');
|
|
177
|
+
expect(flights.data).to.be.an('Array');
|
|
165
178
|
});
|
|
166
179
|
|
|
167
180
|
it('Airline_getAllFlightsDepartures(id, airportCode) is called, it should return an array of valid Flight objects', async function() {
|
|
168
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
169
|
-
const flights: Flight[] = await api.Airline_getAllFlightsDepartures(airline.id, 'KPHX');
|
|
181
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
182
|
+
const flights: FSHubResponse<Flight[]> = await api.Airline_getAllFlightsDepartures(airline.data.id, 'KPHX');
|
|
170
183
|
|
|
171
|
-
expect(flights).to.be.an('Array');
|
|
184
|
+
expect(flights.data).to.be.an('Array');
|
|
172
185
|
});
|
|
173
186
|
|
|
174
187
|
it('Airline_getAllFlightsArrivals(id, airportCode) is called, it should return an array of valid Flight objects', async function() {
|
|
175
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
176
|
-
const flights: Flight[] = await api.Airline_getAllFlightsArrivals(airline.id, 'KPHX');
|
|
188
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
189
|
+
const flights: FSHubResponse<Flight[]> = await api.Airline_getAllFlightsArrivals(airline.data.id, 'KPHX');
|
|
177
190
|
|
|
178
|
-
expect(flights).to.be.an('Array');
|
|
191
|
+
expect(flights.data).to.be.an('Array');
|
|
179
192
|
});
|
|
180
193
|
|
|
181
194
|
it('Airline_getAllFlightDeparturesAndArrivals(id, departureAirportCode, arrivalAirportCode) is called, it should return an array of valid Flight objects', async function() {
|
|
182
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
183
|
-
const flights: Flight[] = await api.Airline_getAllFlightDeparturesAndArrivals(airline.id, 'KPHX', 'KJAC');
|
|
195
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
196
|
+
const flights: FSHubResponse<Flight[]> = await api.Airline_getAllFlightDeparturesAndArrivals(airline.data.id, 'KPHX', 'KJAC');
|
|
184
197
|
|
|
185
|
-
expect(flights).to.be.an('Array');
|
|
198
|
+
expect(flights.data).to.be.an('Array');
|
|
186
199
|
});
|
|
187
200
|
|
|
188
201
|
it('Airline_getAllScreenshots(id) is called, it should return an array of valid Screenshot objects', async function() {
|
|
189
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
190
|
-
const screenshots: Screenshot[] = await api.Airline_getAllScreenshots(airline.id);
|
|
202
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
203
|
+
const screenshots: FSHubResponse<Screenshot[]> = await api.Airline_getAllScreenshots(airline.data.id);
|
|
191
204
|
|
|
192
|
-
expect(screenshots).to.be.an('Array');
|
|
205
|
+
expect(screenshots.data).to.be.an('Array');
|
|
193
206
|
});
|
|
194
207
|
|
|
195
208
|
it('Airline_getStats(id) is called, it should return a valid object with airline statistics', async function() {
|
|
196
|
-
const airline: Airline = await api.Airline_get(6082);
|
|
197
|
-
const stats = await api.Airline_getStats(airline.id);
|
|
209
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
210
|
+
const stats: FSHubResponse<AirlineStats> = await api.Airline_getStats(airline.data.id);
|
|
198
211
|
|
|
199
|
-
expect(stats).to.be.an('Object');
|
|
212
|
+
expect(stats.data).to.be.an('Object');
|
|
200
213
|
});
|
|
201
|
-
});
|
|
202
214
|
|
|
203
|
-
|
|
204
|
-
it('
|
|
205
|
-
const
|
|
215
|
+
// @todo: before each test, create a new application for the pilot
|
|
216
|
+
it.skip('Airline_approveApplication(pilotId, airlineId) is called, it should return a valid FSHubApplicationResponse object', async function() {
|
|
217
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
218
|
+
const pilot: FSHubResponse<Pilot> = await api.Pilot_getCurrent();
|
|
219
|
+
const response: FSHubResponse<FSHubApplicationResponse> = await api.Airline_approveApplication(pilot.data.id, airline.data.id);
|
|
206
220
|
|
|
207
|
-
expect(
|
|
221
|
+
expect(response.data).to.be.an('Object');
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it.skip('Airline_rejectApplication(pilotId, airlineId) is called, it should return a valid FSHubApplicationResponse object', async function() {
|
|
225
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
226
|
+
const pilot: FSHubResponse<Pilot> = await api.Pilot_getCurrent();
|
|
227
|
+
const response: FSHubResponse<FSHubApplicationResponse> = await api.Airline_rejectApplication(pilot.data.id, airline.data.id);
|
|
228
|
+
|
|
229
|
+
expect(response.data).to.be.an('Object');
|
|
208
230
|
});
|
|
209
231
|
|
|
210
|
-
it('
|
|
211
|
-
|
|
232
|
+
it.skip('Airline_pilotPointPurchase(pilotId, airlineId, data) is called, it should return a valid FSHubPilotPointPurchaseTransactionResponse object', async function() {
|
|
233
|
+
|
|
234
|
+
const airline: FSHubResponse<Airline> = await api.Airline_get(6082);
|
|
235
|
+
const pilot: FSHubResponse<Pilot> = await api.Pilot_getCurrent();
|
|
236
|
+
const response: FSHubResponse<FSHubPilotPointPurchaseTransactionResponse> = await api.Airline_pilotPointPurchase(pilot.data.id, airline.data.id, { amount: 100, summary: 'Test purchase' });
|
|
212
237
|
|
|
213
|
-
expect(
|
|
238
|
+
expect(response.data).to.be.an('Object');
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe('Flight', function() {
|
|
243
|
+
describe('Flight_getFlightById(id)', function() {
|
|
244
|
+
it('Flight_getFlightById(id) is called, it should return a valid Flight object', async function() {
|
|
245
|
+
const flight: FSHubResponse<Flight> = await api.Flight_getFlightById(4009359);
|
|
246
|
+
|
|
247
|
+
expect(flight.data).to.be.an('Object');
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
describe('Flight_getFlightScreenshotsById(id)', function() {
|
|
252
|
+
it('Flight_getFlightScreenshotsById(id) is called, it should return an array of valid Screenshot objects', async function() {
|
|
253
|
+
const flight: FSHubResponse<Screenshot[]> = await api.Flight_getFlightScreenshotsById(4009359);
|
|
254
|
+
|
|
255
|
+
expect(flight.data).to.be.an('Array');
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
describe('Flight_getFlights(options)', function() {
|
|
260
|
+
it('Flight_getFlights(options) is called, it should return an array of valid Flight objects', async function() {
|
|
261
|
+
const flights: FSHubResponse<Flight[]> = await api.Flight_getFlights();
|
|
262
|
+
|
|
263
|
+
expect(flights.data).to.be.an('Array');
|
|
264
|
+
expect(flights.data.length).to.be.equal(10);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('Flight_getFlights(options) is called with limit option, it should limit the number of flights returned', async function() {
|
|
268
|
+
const flights: FSHubResponse<Flight[]> = await api.Flight_getFlights({ limit: 1 });
|
|
269
|
+
|
|
270
|
+
expect(flights.data).to.be.an('Array');
|
|
271
|
+
expect(flights.data.length).to.be.equal(1);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('Flight_getFlights(options) is called with cursor option, it should return the next page of flights', async function() {
|
|
275
|
+
const flights: FSHubResponse<Flight[]> = await api.Flight_getFlights({ cursor: 100 });
|
|
276
|
+
|
|
277
|
+
expect(flights.data).to.be.an('Array');
|
|
278
|
+
expect(flights.data.length).to.be.equal(100);
|
|
279
|
+
});
|
|
214
280
|
});
|
|
215
281
|
});
|
|
216
282
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios, { AxiosInstance } from 'axios';
|
|
2
|
-
import type{ Config, FSHubApi } from './types';
|
|
2
|
+
import type{ Config, FSHubApi, FSHubPilotPointPurchaseTransactionData, FSHubPilotSetRankData, FSHubRequestOptions } from './types';
|
|
3
3
|
import { Api } from './api';
|
|
4
4
|
export * from './types';
|
|
5
5
|
|
|
@@ -35,6 +35,27 @@ export default class FSHubApiClass implements FSHubApi {
|
|
|
35
35
|
this.Pilot_getAllFlightsArrivals = this.Pilot_getAllFlightsArrivals.bind(this);
|
|
36
36
|
this.Pilot_getAllFlightDeparturesAndArrivals = this.Pilot_getAllFlightDeparturesAndArrivals.bind(this);
|
|
37
37
|
this.Pilot_getAllScreenshots = this.Pilot_getAllScreenshots.bind(this);
|
|
38
|
+
|
|
39
|
+
this.Airline_getAll = this.Airline_getAll.bind(this);
|
|
40
|
+
this.Airline_get = this.Airline_get.bind(this);
|
|
41
|
+
this.Airline_getPilots = this.Airline_getPilots.bind(this);
|
|
42
|
+
this.Airline_getPilotStats = this.Airline_getPilotStats.bind(this);
|
|
43
|
+
this.Airline_getFlights = this.Airline_getFlights.bind(this);
|
|
44
|
+
this.Airline_getAllFlightsDepartures = this.Airline_getAllFlightsDepartures.bind(this);
|
|
45
|
+
this.Airline_getAllFlightsArrivals = this.Airline_getAllFlightsArrivals.bind(this);
|
|
46
|
+
this.Airline_getAllFlightDeparturesAndArrivals = this.Airline_getAllFlightDeparturesAndArrivals.bind(this);
|
|
47
|
+
this.Airline_getAllScreenshots = this.Airline_getAllScreenshots.bind(this);
|
|
48
|
+
this.Airline_getStats = this.Airline_getStats.bind(this);
|
|
49
|
+
this.Airline_approveApplication = this.Airline_approveApplication.bind(this);
|
|
50
|
+
this.Airline_rejectApplication = this.Airline_rejectApplication.bind(this);
|
|
51
|
+
this.Airline_pilotPointPurchase = this.Airline_pilotPointPurchase.bind(this);
|
|
52
|
+
this.Airline_pilotSetRank = this.Airline_pilotSetRank.bind(this);
|
|
53
|
+
this.Airline_getAllRanks = this.Airline_getAllRanks.bind(this);
|
|
54
|
+
this.Airline_getAllRoles = this.Airline_getAllRoles.bind(this);
|
|
55
|
+
|
|
56
|
+
this.Flight_getFlightById = this.Flight_getFlightById.bind(this);
|
|
57
|
+
this.Flight_getFlightScreenshotsById = this.Flight_getFlightScreenshotsById.bind(this);
|
|
58
|
+
this.Flight_getFlights = this.Flight_getFlights.bind(this);
|
|
38
59
|
}
|
|
39
60
|
|
|
40
61
|
public async Pilot_getCurrent() {
|
|
@@ -121,6 +142,30 @@ export default class FSHubApiClass implements FSHubApi {
|
|
|
121
142
|
return await Api.airline.getStats(id, this);
|
|
122
143
|
}
|
|
123
144
|
|
|
145
|
+
public async Airline_approveApplication(pilotId: number, airlineId: number) {
|
|
146
|
+
return await Api.airline.approveApplication(pilotId, airlineId, this);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public async Airline_rejectApplication(pilotId: number, airlineId: number) {
|
|
150
|
+
return await Api.airline.rejectApplication(pilotId, airlineId, this);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public async Airline_pilotPointPurchase(pilotId: number, airlineId: number, data: FSHubPilotPointPurchaseTransactionData) {
|
|
154
|
+
return await Api.airline.pilotPointPurchase(pilotId, airlineId, data, this);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public async Airline_pilotSetRank(pilotId: number, airlineId: number, data: FSHubPilotSetRankData) {
|
|
158
|
+
return await Api.airline.pilotSetRank(pilotId, airlineId, data, this);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
public async Airline_getAllRanks(airlineId: number) {
|
|
162
|
+
return await Api.airline.getAllRanks(airlineId, this);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
public async Airline_getAllRoles(airlineId: number) {
|
|
166
|
+
return await Api.airline.getAllRoles(airlineId, this);
|
|
167
|
+
}
|
|
168
|
+
|
|
124
169
|
public async Flight_getFlightById(id: number) {
|
|
125
170
|
return await Api.flight.getFlightById(id, this);
|
|
126
171
|
}
|
|
@@ -128,4 +173,8 @@ export default class FSHubApiClass implements FSHubApi {
|
|
|
128
173
|
public async Flight_getFlightScreenshotsById(id: number) {
|
|
129
174
|
return await Api.flight.getFlightScreenshotsById(id, this);
|
|
130
175
|
}
|
|
176
|
+
|
|
177
|
+
public async Flight_getFlights(options?: FSHubRequestOptions) {
|
|
178
|
+
return await Api.flight.getFlights(this, options);
|
|
179
|
+
}
|
|
131
180
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -49,19 +49,6 @@ export type Gps = {
|
|
|
49
49
|
lng: number
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export type FSHubResponse<T> = {
|
|
53
|
-
data: T
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type FSHubError = {
|
|
57
|
-
message: string
|
|
58
|
-
code: number
|
|
59
|
-
error?: boolean
|
|
60
|
-
details?: {
|
|
61
|
-
pilot: number
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
52
|
export type Flight = {
|
|
66
53
|
id: number
|
|
67
54
|
user: User
|
|
@@ -209,29 +196,98 @@ export type Urls = {
|
|
|
209
196
|
thumbnail: string
|
|
210
197
|
}
|
|
211
198
|
|
|
199
|
+
export type FSHubRequestOptions = {
|
|
200
|
+
cursor?: number;
|
|
201
|
+
limit?: number;
|
|
202
|
+
}
|
|
203
|
+
|
|
212
204
|
export type FSHubApi = {
|
|
213
205
|
axios: AxiosInstance
|
|
214
|
-
Pilot_getCurrent: () => Promise<CurrentPilot
|
|
215
|
-
Pilot_getAll: () => Promise<Pilot[]
|
|
216
|
-
Pilot_get: (id: number) => Promise<Pilot
|
|
217
|
-
Pilot_getLatestFlight: (id: number) => Promise<Flight
|
|
218
|
-
Pilot_getAllFlights: (id: number) => Promise<Flight[]
|
|
219
|
-
Pilot_getAllAirlines: (id: number) => Promise<Airline[]
|
|
220
|
-
Pilot_getStats: (id: number) => Promise<PilotStats
|
|
221
|
-
Pilot_getAllFlightsDepartures:(id:number, airportCode:string) => Promise<Flight[]
|
|
222
|
-
Pilot_getAllFlightsArrivals:(id:number, airportCode:string) => Promise<Flight[]
|
|
223
|
-
Pilot_getAllFlightDeparturesAndArrivals:(id:number, departureAirportCode:string, arrivalAirportCode:string) => Promise<Flight[]
|
|
224
|
-
Pilot_getAllScreenshots: (id: number) => Promise<Screenshot[]
|
|
225
|
-
Airline_getAll: () => Promise<Airline[]
|
|
226
|
-
Airline_get: (id: number) => Promise<Airline
|
|
227
|
-
Airline_getPilots: (id: number) => Promise<Pilot[]
|
|
228
|
-
Airline_getPilotStats: (id: number, pilotId: number) => Promise<PilotStats
|
|
229
|
-
Airline_getFlights: (id: number) => Promise<Flight[]
|
|
230
|
-
Airline_getAllFlightsDepartures:(id:number, airportCode:string) => Promise<Flight[]
|
|
231
|
-
Airline_getAllFlightsArrivals:(id:number, airportCode:string) => Promise<Flight[]
|
|
232
|
-
Airline_getAllFlightDeparturesAndArrivals:(id:number, departureAirportCode:string, arrivalAirportCode:string) => Promise<Flight[]
|
|
233
|
-
Airline_getAllScreenshots: (id: number) => Promise<Screenshot[]
|
|
234
|
-
Airline_getStats: (id: number) => Promise<AirlineStats
|
|
235
|
-
|
|
236
|
-
|
|
206
|
+
Pilot_getCurrent: () => Promise<FSHubResponse<CurrentPilot>>
|
|
207
|
+
Pilot_getAll: () => Promise<FSHubResponse<Pilot[]>>
|
|
208
|
+
Pilot_get: (id: number) => Promise<FSHubResponse<Pilot>>
|
|
209
|
+
Pilot_getLatestFlight: (id: number) => Promise<FSHubResponse<Flight>>
|
|
210
|
+
Pilot_getAllFlights: (id: number) => Promise<FSHubResponse<Flight[]>>
|
|
211
|
+
Pilot_getAllAirlines: (id: number) => Promise<FSHubResponse<Airline[]>>
|
|
212
|
+
Pilot_getStats: (id: number) => Promise<FSHubResponse<PilotStats>>
|
|
213
|
+
Pilot_getAllFlightsDepartures:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
214
|
+
Pilot_getAllFlightsArrivals:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
215
|
+
Pilot_getAllFlightDeparturesAndArrivals:(id:number, departureAirportCode:string, arrivalAirportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
216
|
+
Pilot_getAllScreenshots: (id: number) => Promise<FSHubResponse<Screenshot[]>>
|
|
217
|
+
Airline_getAll: () => Promise<FSHubResponse<Airline[]>>
|
|
218
|
+
Airline_get: (id: number) => Promise<FSHubResponse<Airline>>
|
|
219
|
+
Airline_getPilots: (id: number) => Promise<FSHubResponse<Pilot[]>>
|
|
220
|
+
Airline_getPilotStats: (id: number, pilotId: number) => Promise<FSHubResponse<PilotStats>>
|
|
221
|
+
Airline_getFlights: (id: number) => Promise<FSHubResponse<Flight[]>>
|
|
222
|
+
Airline_getAllFlightsDepartures:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
223
|
+
Airline_getAllFlightsArrivals:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
224
|
+
Airline_getAllFlightDeparturesAndArrivals:(id:number, departureAirportCode:string, arrivalAirportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
225
|
+
Airline_getAllScreenshots: (id: number) => Promise<FSHubResponse<Screenshot[]>>
|
|
226
|
+
Airline_getStats: (id: number) => Promise<FSHubResponse<AirlineStats>>
|
|
227
|
+
Airline_approveApplication: (pilotId: number, airlineId: number) => Promise<FSHubResponse<FSHubApplicationResponse>>
|
|
228
|
+
Airline_rejectApplication: (pilotId: number, airlineId: number) => Promise<FSHubResponse<FSHubApplicationResponse>>
|
|
229
|
+
Airline_pilotPointPurchase: (pilotId: number, airlineId: number, data: FSHubPilotPointPurchaseTransactionData) => Promise<FSHubResponse<FSHubPilotPointPurchaseTransactionResponse>>
|
|
230
|
+
Airline_pilotSetRank: (pilotId: number, airlineId: number, data: FSHubPilotSetRankData) => Promise<FSHubResponse<FSHubApplicationResponse>>
|
|
231
|
+
Airline_getAllRanks: (airlineId: number) => Promise<FSHubResponse<FSHubAirlineRank[]>>
|
|
232
|
+
Airline_getAllRoles: (airlineId: number) => Promise<FSHubResponse<FSHubAirlineRole[]>>
|
|
233
|
+
Flight_getFlightById: (id: number) => Promise<FSHubResponse<Flight>>
|
|
234
|
+
Flight_getFlightScreenshotsById: (id: number) => Promise<FSHubResponse<Screenshot[]>>
|
|
235
|
+
Flight_getFlights: (options?: FSHubRequestOptions) => Promise<FSHubResponse<Flight[]>>
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type FSHubResponse<T> = {
|
|
239
|
+
data: T
|
|
240
|
+
meta?: {
|
|
241
|
+
cursor: {
|
|
242
|
+
current: number
|
|
243
|
+
prev: number
|
|
244
|
+
next: number
|
|
245
|
+
count: number
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export type FSHubApplicationResponse = {
|
|
251
|
+
successful: boolean;
|
|
252
|
+
message: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export type FSHubPilotPointPurchaseTransactionData = {
|
|
256
|
+
amount: number;
|
|
257
|
+
summary: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type FSHubPilotPointPurchaseTransactionResponse = {
|
|
261
|
+
successful: boolean;
|
|
262
|
+
message: string;
|
|
263
|
+
transferred: number;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type FSHubError = {
|
|
267
|
+
message: string
|
|
268
|
+
code: number
|
|
269
|
+
error?: boolean
|
|
270
|
+
details?: {
|
|
271
|
+
pilot: number
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export type FSHubPilotSetRankData = {
|
|
276
|
+
rank_id: number;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export type FSHubAirlineRole = {
|
|
280
|
+
id: number;
|
|
281
|
+
name: string;
|
|
282
|
+
created_at: string;
|
|
283
|
+
updated_at: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export type FSHubAirlineRank = {
|
|
287
|
+
id: number;
|
|
288
|
+
name: string;
|
|
289
|
+
abbreviation: string;
|
|
290
|
+
min_hours: number;
|
|
291
|
+
created_at: string;
|
|
292
|
+
updated_at: string;
|
|
237
293
|
}
|