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.
- 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.map +1 -1
- package/dist/api/airport/Airport_findByICAO.d.ts +3 -0
- package/dist/api/airport/Airport_findByICAO.d.ts.map +1 -0
- package/dist/api/airport/Airport_findByICAO.js +57 -0
- package/dist/api/airport/Airport_findByICAO.js.map +1 -0
- package/dist/api/airport/Airport_findMETAR.d.ts +3 -0
- package/dist/api/airport/Airport_findMETAR.d.ts.map +1 -0
- package/dist/api/airport/Airport_findMETAR.js +57 -0
- package/dist/api/airport/Airport_findMETAR.js.map +1 -0
- package/dist/api/airport/index.d.ts +7 -0
- package/dist/api/airport/index.d.ts.map +1 -0
- package/dist/api/airport/index.js +13 -0
- package/dist/api/airport/index.js.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +3 -1
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +33 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Airline.d.ts +25 -0
- package/dist/types/Airline.d.ts.map +1 -0
- package/dist/types/Airline.js +3 -0
- package/dist/types/Airline.js.map +1 -0
- package/dist/types/Airport.d.ts +50 -0
- package/dist/types/Airport.d.ts.map +1 -0
- package/dist/types/Airport.js +3 -0
- package/dist/types/Airport.js.map +1 -0
- package/dist/types/AirportMETARReport.d.ts +13 -0
- package/dist/types/AirportMETARReport.d.ts.map +1 -0
- package/dist/types/AirportMETARReport.js +3 -0
- package/dist/types/AirportMETARReport.js.map +1 -0
- package/dist/types/Common.d.ts +16 -0
- package/dist/types/Common.d.ts.map +1 -0
- package/dist/types/Common.js +3 -0
- package/dist/types/Common.js.map +1 -0
- package/dist/types/Config.d.ts +7 -0
- package/dist/types/Config.d.ts.map +1 -0
- package/dist/types/Config.js +3 -0
- package/dist/types/Config.js.map +1 -0
- package/dist/types/FSHubAirline.d.ts +65 -0
- package/dist/types/FSHubAirline.d.ts.map +1 -0
- package/dist/types/FSHubAirline.js +3 -0
- package/dist/types/FSHubAirline.js.map +1 -0
- package/dist/types/FSHubApi.d.ts +54 -0
- package/dist/types/FSHubApi.d.ts.map +1 -0
- package/dist/types/FSHubApi.js +3 -0
- package/dist/types/FSHubApi.js.map +1 -0
- package/dist/types/FSHubApplication.d.ts +8 -0
- package/dist/types/FSHubApplication.d.ts.map +1 -0
- package/dist/types/FSHubApplication.js +3 -0
- package/dist/types/FSHubApplication.js.map +1 -0
- package/dist/types/FSHubError.d.ts +9 -0
- package/dist/types/FSHubError.d.ts.map +1 -0
- package/dist/types/FSHubError.js +3 -0
- package/dist/types/FSHubError.js.map +1 -0
- package/dist/types/FSHubPilotPointPurchase.d.ts +10 -0
- package/dist/types/FSHubPilotPointPurchase.d.ts.map +1 -0
- package/dist/types/FSHubPilotPointPurchase.js +3 -0
- package/dist/types/FSHubPilotPointPurchase.js.map +1 -0
- package/dist/types/FSHubRequestOptions.d.ts +5 -0
- package/dist/types/FSHubRequestOptions.d.ts.map +1 -0
- package/dist/types/FSHubRequestOptions.js +3 -0
- package/dist/types/FSHubRequestOptions.js.map +1 -0
- package/dist/types/FSHubResponse.d.ts +12 -0
- package/dist/types/FSHubResponse.d.ts.map +1 -0
- package/dist/types/FSHubResponse.js +3 -0
- package/dist/types/FSHubResponse.js.map +1 -0
- package/dist/types/Flight.d.ts +77 -0
- package/dist/types/Flight.d.ts.map +1 -0
- package/dist/types/Flight.js +3 -0
- package/dist/types/Flight.js.map +1 -0
- package/dist/types/Pilot.d.ts +20 -0
- package/dist/types/Pilot.d.ts.map +1 -0
- package/dist/types/Pilot.js +3 -0
- package/dist/types/Pilot.js.map +1 -0
- package/dist/types/Screenshot.d.ts +14 -0
- package/dist/types/Screenshot.d.ts.map +1 -0
- package/dist/types/Screenshot.js +3 -0
- package/dist/types/Screenshot.js.map +1 -0
- package/dist/types/Stats.d.ts +21 -0
- package/dist/types/Stats.d.ts.map +1 -0
- package/dist/types/Stats.js +3 -0
- package/dist/types/Stats.js.map +1 -0
- package/dist/types/index.d.ts +19 -255
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +56 -56
- package/src/api/airline/Airline_getPilotStats.ts +3 -3
- package/src/api/airport/Airport_findByICAO.ts +9 -0
- package/src/api/airport/Airport_findMETAR.ts +9 -0
- package/src/api/airport/index.ts +7 -0
- package/src/api/index.ts +3 -1
- package/src/index.spec.ts +25 -2
- package/src/index.ts +12 -1
- package/src/types/Airline.ts +26 -0
- package/src/types/Airport.ts +56 -0
- package/src/types/AirportMETARReport.ts +14 -0
- package/src/types/Common.ts +17 -0
- package/src/types/Config.ts +6 -0
- package/src/types/FSHubAirline.ts +73 -0
- package/src/types/FSHubApi.ts +54 -0
- package/src/types/FSHubApplication.ts +8 -0
- package/src/types/FSHubError.ts +8 -0
- package/src/types/FSHubPilotPointPurchase.ts +10 -0
- package/src/types/FSHubRequestOptions.ts +4 -0
- package/src/types/FSHubResponse.ts +11 -0
- package/src/types/Flight.ts +88 -0
- package/src/types/Pilot.ts +21 -0
- package/src/types/Screenshot.ts +15 -0
- package/src/types/Stats.ts +23 -0
- package/src/types/index.ts +63 -290
- package/workspace.code-workspace +10 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type FSHubAirlineRole = {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
created_at: string;
|
|
5
|
+
updated_at: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type FSHubAirlineRank = {
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
abbreviation: string;
|
|
12
|
+
min_hours: number;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type FSHubAirlinePilotStatsRoles = {
|
|
18
|
+
[key: string]: any; // TODO: Add proper type
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type FSHubAirlinePilotStatsUserProfile = {
|
|
22
|
+
avatar_url: string
|
|
23
|
+
bio: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type FSHubAirlinePilotStatsUserLocations = {
|
|
27
|
+
base: string
|
|
28
|
+
locale: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type FSHubAirlinePilotStatsUserHandles = {
|
|
32
|
+
website: any
|
|
33
|
+
twitter: any
|
|
34
|
+
facebook: any
|
|
35
|
+
vatsim: any
|
|
36
|
+
ivao: any
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type FSHubAirlinePilotStatsUser = {
|
|
40
|
+
id: number
|
|
41
|
+
name: string
|
|
42
|
+
email: string
|
|
43
|
+
profile: FSHubAirlinePilotStatsUserProfile
|
|
44
|
+
locations: FSHubAirlinePilotStatsUserLocations
|
|
45
|
+
handles: FSHubAirlinePilotStatsUserHandles
|
|
46
|
+
timezone: string
|
|
47
|
+
country: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type FSHubAirlinePilotStatsRank = {
|
|
51
|
+
id: number
|
|
52
|
+
name: string
|
|
53
|
+
abbreviation: string
|
|
54
|
+
min_hours: number
|
|
55
|
+
created_at: string
|
|
56
|
+
updated_at: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type FSHubAirlinePilotStatsLink = {
|
|
60
|
+
rel: string
|
|
61
|
+
uri: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type FSHubAirlinePilotStats = {
|
|
65
|
+
user: FSHubAirlinePilotStatsUser
|
|
66
|
+
points: number
|
|
67
|
+
carry_hours: number
|
|
68
|
+
rank: FSHubAirlinePilotStatsRank
|
|
69
|
+
roles: FSHubAirlinePilotStatsRoles[]
|
|
70
|
+
hired_at: string
|
|
71
|
+
discord_id: number
|
|
72
|
+
links: FSHubAirlinePilotStatsLink[]
|
|
73
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Pilot } from './Pilot';
|
|
3
|
+
import { CurrentPilot } from './Pilot';
|
|
4
|
+
import { Flight } from './Flight';
|
|
5
|
+
import { Airline } from './Airline';
|
|
6
|
+
import { PilotStats } from './Stats';
|
|
7
|
+
import { AirlineStats } from './Stats';
|
|
8
|
+
import { Screenshot } from './Screenshot';
|
|
9
|
+
import { FSHubRequestOptions } from './FSHubRequestOptions';
|
|
10
|
+
import { FSHubResponse } from './FSHubResponse';
|
|
11
|
+
import { FSHubApplicationResponse } from './FSHubApplication';
|
|
12
|
+
import { FSHubPilotPointPurchaseTransactionData, FSHubPilotPointPurchaseTransactionResponse } from './FSHubPilotPointPurchase';
|
|
13
|
+
import { FSHubPilotSetRankData } from './FSHubApplication';
|
|
14
|
+
import { FSHubAirlineRank } from './FSHubAirline';
|
|
15
|
+
import { FSHubAirlineRole } from './FSHubAirline';
|
|
16
|
+
import { FSHubAirlinePilotStats } from './FSHubAirline';
|
|
17
|
+
import { AirportMETARReport } from './AirportMETARReport';
|
|
18
|
+
import { Airport } from './Airport';
|
|
19
|
+
|
|
20
|
+
export type FSHubApi = {
|
|
21
|
+
axios: AxiosInstance
|
|
22
|
+
Pilot_getCurrent: () => Promise<FSHubResponse<CurrentPilot>>
|
|
23
|
+
Pilot_getAll: () => Promise<FSHubResponse<Pilot[]>>
|
|
24
|
+
Pilot_get: (id: number) => Promise<FSHubResponse<Pilot>>
|
|
25
|
+
Pilot_getLatestFlight: (id: number) => Promise<FSHubResponse<Flight>>
|
|
26
|
+
Pilot_getAllFlights: (id: number) => Promise<FSHubResponse<Flight[]>>
|
|
27
|
+
Pilot_getAllAirlines: (id: number) => Promise<FSHubResponse<Airline[]>>
|
|
28
|
+
Pilot_getStats: (id: number) => Promise<FSHubResponse<PilotStats>>
|
|
29
|
+
Pilot_getAllFlightsDepartures:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
30
|
+
Pilot_getAllFlightsArrivals:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
31
|
+
Pilot_getAllFlightDeparturesAndArrivals:(id:number, departureAirportCode:string, arrivalAirportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
32
|
+
Pilot_getAllScreenshots: (id: number) => Promise<FSHubResponse<Screenshot[]>>
|
|
33
|
+
Airline_getAll: () => Promise<FSHubResponse<Airline[]>>
|
|
34
|
+
Airline_get: (id: number) => Promise<FSHubResponse<Airline>>
|
|
35
|
+
Airline_getPilots: (id: number) => Promise<FSHubResponse<Pilot[]>>
|
|
36
|
+
Airline_getPilotStats: (id: number, pilotId: number) => Promise<FSHubResponse<FSHubAirlinePilotStats>>
|
|
37
|
+
Airline_getFlights: (id: number) => Promise<FSHubResponse<Flight[]>>
|
|
38
|
+
Airline_getAllFlightsDepartures:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
39
|
+
Airline_getAllFlightsArrivals:(id:number, airportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
40
|
+
Airline_getAllFlightDeparturesAndArrivals:(id:number, departureAirportCode:string, arrivalAirportCode:string) => Promise<FSHubResponse<Flight[]>>
|
|
41
|
+
Airline_getAllScreenshots: (id: number) => Promise<FSHubResponse<Screenshot[]>>
|
|
42
|
+
Airline_getStats: (id: number) => Promise<FSHubResponse<AirlineStats>>
|
|
43
|
+
Airline_approveApplication: (pilotId: number, airlineId: number) => Promise<FSHubResponse<FSHubApplicationResponse>>
|
|
44
|
+
Airline_rejectApplication: (pilotId: number, airlineId: number) => Promise<FSHubResponse<FSHubApplicationResponse>>
|
|
45
|
+
Airline_pilotPointPurchase: (pilotId: number, airlineId: number, data: FSHubPilotPointPurchaseTransactionData) => Promise<FSHubResponse<FSHubPilotPointPurchaseTransactionResponse>>
|
|
46
|
+
Airline_pilotSetRank: (pilotId: number, airlineId: number, data: FSHubPilotSetRankData) => Promise<FSHubResponse<FSHubApplicationResponse>>
|
|
47
|
+
Airline_getAllRanks: (airlineId: number) => Promise<FSHubResponse<FSHubAirlineRank[]>>
|
|
48
|
+
Airline_getAllRoles: (airlineId: number) => Promise<FSHubResponse<FSHubAirlineRole[]>>
|
|
49
|
+
Flight_getFlightById: (id: number) => Promise<FSHubResponse<Flight>>
|
|
50
|
+
Flight_getFlightScreenshotsById: (id: number) => Promise<FSHubResponse<Screenshot[]>>
|
|
51
|
+
Flight_getFlights: (options?: FSHubRequestOptions) => Promise<FSHubResponse<Flight[]>>
|
|
52
|
+
Airport_findByICAO: (icao: string) => Promise<FSHubResponse<Airport>>
|
|
53
|
+
Airport_findMETAR: (icao: string) => Promise<FSHubResponse<AirportMETARReport>>
|
|
54
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Airline } from './Airline';
|
|
2
|
+
import { Link } from './Common';
|
|
3
|
+
|
|
4
|
+
export type User = {
|
|
5
|
+
id: number
|
|
6
|
+
name: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type UserConf = {
|
|
10
|
+
tail: string
|
|
11
|
+
icao: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type Aircraft = {
|
|
15
|
+
icao: string
|
|
16
|
+
icao_name: string
|
|
17
|
+
name: string
|
|
18
|
+
type: string
|
|
19
|
+
user_conf: UserConf
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type Distance = {
|
|
23
|
+
nm: number
|
|
24
|
+
km: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type Average = {
|
|
28
|
+
spd: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type Max = {
|
|
32
|
+
alt: number
|
|
33
|
+
spd: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type Geo = {
|
|
37
|
+
lat: number
|
|
38
|
+
lng: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type Hdg = {
|
|
42
|
+
mag: number
|
|
43
|
+
true: number
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type Spd = {
|
|
47
|
+
tas: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type Wind = {
|
|
51
|
+
spd: number
|
|
52
|
+
dir: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type Airport = {
|
|
56
|
+
icao: string
|
|
57
|
+
iata: string
|
|
58
|
+
name: string
|
|
59
|
+
time: string
|
|
60
|
+
geo: Geo
|
|
61
|
+
hdg: Hdg
|
|
62
|
+
spd: Spd
|
|
63
|
+
fuel: number
|
|
64
|
+
pitch: number
|
|
65
|
+
bank: number
|
|
66
|
+
wind: Wind
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type Flight = {
|
|
70
|
+
id: number
|
|
71
|
+
user: User
|
|
72
|
+
airline: Airline
|
|
73
|
+
schedule_status: any
|
|
74
|
+
aircraft: Aircraft
|
|
75
|
+
plan: any
|
|
76
|
+
fuel_used: number
|
|
77
|
+
landing_rate: number
|
|
78
|
+
distance: Distance
|
|
79
|
+
average: Average
|
|
80
|
+
max: Max
|
|
81
|
+
time: number
|
|
82
|
+
tags: any[]
|
|
83
|
+
flags: any[]
|
|
84
|
+
points: number
|
|
85
|
+
departure: Airport
|
|
86
|
+
arrival: Airport
|
|
87
|
+
links: Link[]
|
|
88
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Gps, Handles, Link } from './Common';
|
|
2
|
+
|
|
3
|
+
export type Pilot = {
|
|
4
|
+
id: number
|
|
5
|
+
name: string
|
|
6
|
+
base: string
|
|
7
|
+
locale: string
|
|
8
|
+
gps: Gps
|
|
9
|
+
is_online: boolean
|
|
10
|
+
online_at: string
|
|
11
|
+
bio?: string
|
|
12
|
+
handles?: Handles
|
|
13
|
+
timezone?: string
|
|
14
|
+
country?: string
|
|
15
|
+
created_at?: string
|
|
16
|
+
links?: Link[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type CurrentPilot = Pilot & {
|
|
20
|
+
discord_id?: number
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Link } from './Common';
|
|
2
|
+
|
|
3
|
+
export type PilotStat = {
|
|
4
|
+
total_flights: number
|
|
5
|
+
total_hours: number
|
|
6
|
+
total_distance: number
|
|
7
|
+
average_landing: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type PilotStats = {
|
|
11
|
+
id: number
|
|
12
|
+
all_time: PilotStat
|
|
13
|
+
month: PilotStat
|
|
14
|
+
links: Link[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type AirlineStats = {
|
|
18
|
+
id: number
|
|
19
|
+
total_pilots: number
|
|
20
|
+
all_time: PilotStat
|
|
21
|
+
month: PilotStat
|
|
22
|
+
links: Link[]
|
|
23
|
+
}
|