fshub-api 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/api/airport/Airport_findByICAO.d.ts +3 -0
  2. package/dist/api/airport/Airport_findByICAO.d.ts.map +1 -0
  3. package/dist/api/airport/Airport_findByICAO.js +57 -0
  4. package/dist/api/airport/Airport_findByICAO.js.map +1 -0
  5. package/dist/api/airport/Airport_findMETAR.d.ts +3 -0
  6. package/dist/api/airport/Airport_findMETAR.d.ts.map +1 -0
  7. package/dist/api/airport/Airport_findMETAR.js +57 -0
  8. package/dist/api/airport/Airport_findMETAR.js.map +1 -0
  9. package/dist/api/airport/index.d.ts +7 -0
  10. package/dist/api/airport/index.d.ts.map +1 -0
  11. package/dist/api/airport/index.js +13 -0
  12. package/dist/api/airport/index.js.map +1 -0
  13. package/dist/api/index.d.ts +4 -0
  14. package/dist/api/index.d.ts.map +1 -1
  15. package/dist/api/index.js +3 -1
  16. package/dist/api/index.js.map +1 -1
  17. package/dist/index.d.ts +33 -31
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +22 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/types/Airline.d.ts +25 -0
  22. package/dist/types/Airline.d.ts.map +1 -0
  23. package/dist/types/Airline.js +3 -0
  24. package/dist/types/Airline.js.map +1 -0
  25. package/dist/types/Airport.d.ts +50 -0
  26. package/dist/types/Airport.d.ts.map +1 -0
  27. package/dist/types/Airport.js +3 -0
  28. package/dist/types/Airport.js.map +1 -0
  29. package/dist/types/AirportMETARReport.d.ts +13 -0
  30. package/dist/types/AirportMETARReport.d.ts.map +1 -0
  31. package/dist/types/AirportMETARReport.js +3 -0
  32. package/dist/types/AirportMETARReport.js.map +1 -0
  33. package/dist/types/Common.d.ts +16 -0
  34. package/dist/types/Common.d.ts.map +1 -0
  35. package/dist/types/Common.js +3 -0
  36. package/dist/types/Common.js.map +1 -0
  37. package/dist/types/Config.d.ts +7 -0
  38. package/dist/types/Config.d.ts.map +1 -0
  39. package/dist/types/Config.js +3 -0
  40. package/dist/types/Config.js.map +1 -0
  41. package/dist/types/FSHubAirline.d.ts +65 -0
  42. package/dist/types/FSHubAirline.d.ts.map +1 -0
  43. package/dist/types/FSHubAirline.js +3 -0
  44. package/dist/types/FSHubAirline.js.map +1 -0
  45. package/dist/types/FSHubApi.d.ts +54 -0
  46. package/dist/types/FSHubApi.d.ts.map +1 -0
  47. package/dist/types/FSHubApi.js +3 -0
  48. package/dist/types/FSHubApi.js.map +1 -0
  49. package/dist/types/FSHubApplication.d.ts +8 -0
  50. package/dist/types/FSHubApplication.d.ts.map +1 -0
  51. package/dist/types/FSHubApplication.js +3 -0
  52. package/dist/types/FSHubApplication.js.map +1 -0
  53. package/dist/types/FSHubError.d.ts +9 -0
  54. package/dist/types/FSHubError.d.ts.map +1 -0
  55. package/dist/types/FSHubError.js +3 -0
  56. package/dist/types/FSHubError.js.map +1 -0
  57. package/dist/types/FSHubPilotPointPurchase.d.ts +10 -0
  58. package/dist/types/FSHubPilotPointPurchase.d.ts.map +1 -0
  59. package/dist/types/FSHubPilotPointPurchase.js +3 -0
  60. package/dist/types/FSHubPilotPointPurchase.js.map +1 -0
  61. package/dist/types/FSHubRequestOptions.d.ts +5 -0
  62. package/dist/types/FSHubRequestOptions.d.ts.map +1 -0
  63. package/dist/types/FSHubRequestOptions.js +3 -0
  64. package/dist/types/FSHubRequestOptions.js.map +1 -0
  65. package/dist/types/FSHubResponse.d.ts +12 -0
  66. package/dist/types/FSHubResponse.d.ts.map +1 -0
  67. package/dist/types/FSHubResponse.js +3 -0
  68. package/dist/types/FSHubResponse.js.map +1 -0
  69. package/dist/types/Flight.d.ts +77 -0
  70. package/dist/types/Flight.d.ts.map +1 -0
  71. package/dist/types/Flight.js +3 -0
  72. package/dist/types/Flight.js.map +1 -0
  73. package/dist/types/Pilot.d.ts +20 -0
  74. package/dist/types/Pilot.d.ts.map +1 -0
  75. package/dist/types/Pilot.js +3 -0
  76. package/dist/types/Pilot.js.map +1 -0
  77. package/dist/types/Screenshot.d.ts +14 -0
  78. package/dist/types/Screenshot.d.ts.map +1 -0
  79. package/dist/types/Screenshot.js +3 -0
  80. package/dist/types/Screenshot.js.map +1 -0
  81. package/dist/types/Stats.d.ts +21 -0
  82. package/dist/types/Stats.d.ts.map +1 -0
  83. package/dist/types/Stats.js +3 -0
  84. package/dist/types/Stats.js.map +1 -0
  85. package/dist/types/index.d.ts +19 -305
  86. package/dist/types/index.d.ts.map +1 -1
  87. package/dist/types/index.js +5 -0
  88. package/dist/types/index.js.map +1 -1
  89. package/package.json +56 -56
  90. package/src/api/airport/Airport_findByICAO.ts +9 -0
  91. package/src/api/airport/Airport_findMETAR.ts +9 -0
  92. package/src/api/airport/index.ts +7 -0
  93. package/src/api/index.ts +3 -1
  94. package/src/index.spec.ts +25 -2
  95. package/src/index.ts +12 -1
  96. package/src/types/Airline.ts +26 -0
  97. package/src/types/Airport.ts +56 -0
  98. package/src/types/AirportMETARReport.ts +14 -0
  99. package/src/types/Common.ts +17 -0
  100. package/src/types/Config.ts +6 -0
  101. package/src/types/FSHubAirline.ts +73 -0
  102. package/src/types/FSHubApi.ts +54 -0
  103. package/src/types/FSHubApplication.ts +8 -0
  104. package/src/types/FSHubError.ts +8 -0
  105. package/src/types/FSHubPilotPointPurchase.ts +10 -0
  106. package/src/types/FSHubRequestOptions.ts +4 -0
  107. package/src/types/FSHubResponse.ts +11 -0
  108. package/src/types/Flight.ts +88 -0
  109. package/src/types/Pilot.ts +21 -0
  110. package/src/types/Screenshot.ts +15 -0
  111. package/src/types/Stats.ts +23 -0
  112. package/src/types/index.ts +63 -348
  113. package/workspace.code-workspace +10 -0
@@ -1,351 +1,66 @@
1
- import { AxiosInstance } from 'axios';
2
-
3
1
  /**
4
- * FSHub API Types and type= s
2
+ * FSHub API Types and types
3
+ *
4
+ * All types are exported from individual files for better organization.
5
5
  */
6
6
 
7
- export type Config = {
8
- baseURL?: string;
9
- apiKey?: string;
10
- timeout?: number;
11
- headers?: Record<string, string>;
12
- };
13
-
14
- export type CurrentPilot = Pilot & {
15
- discord_id?: number
16
- }
17
-
18
- export type Pilot = {
19
- id: number
20
- name: string
21
- base: string
22
- locale: string
23
- gps: Gps
24
- is_online: boolean
25
- online_at: string
26
- bio?: string
27
- handles?: Handles
28
- timezone?: string
29
- country?: string
30
- created_at?: string
31
- links?: Link[]
32
- }
33
-
34
- export type Handles = {
35
- facebook: any
36
- twitter: string
37
- website: any
38
- vatsim: string
39
- ivao: string
40
- }
41
-
42
- export type Link = {
43
- rel: string
44
- uri: string
45
- }
46
-
47
- export type Gps = {
48
- lat: number
49
- lng: number
50
- }
51
-
52
- export type Flight = {
53
- id: number
54
- user: User
55
- airline: Airline
56
- schedule_status: any
57
- aircraft: Aircraft
58
- plan: any
59
- fuel_used: number
60
- landing_rate: number
61
- distance: Distance
62
- average: Average
63
- max: Max
64
- time: number
65
- tags: any[]
66
- flags: any[]
67
- points: number
68
- departure: Airport
69
- arrival: Airport
70
- links: Link[]
71
- }
72
-
73
- export type Airline = {
74
- id: number
75
- name: string
76
- abbr: string
77
- owner: Owner
78
- handles: Handles
79
- links: Link[]
80
- }
81
-
82
- export type Owner = {
83
- id: number
84
- name: string
85
- bio: any
86
- handles: Handles
87
- base: string
88
- locale: string
89
- gps: Gps
90
- timezone: string
91
- country: string
92
- is_online: boolean
93
- online_at: string
94
- created_at: string
95
- links: Link[]
96
- }
97
-
98
- export type User = {
99
- id: number
100
- name: string
101
- }
102
-
103
- export type Aircraft = {
104
- icao: string
105
- icao_name: string
106
- name: string
107
- type: string
108
- user_conf: UserConf
109
- }
110
-
111
- export type UserConf = {
112
- tail: string
113
- icao: string
114
- }
115
-
116
- export type Distance = {
117
- nm: number
118
- km: number
119
- }
120
-
121
- export type Average = {
122
- spd: number
123
- }
124
-
125
- export type Max = {
126
- alt: number
127
- spd: number
128
- }
129
-
130
- export type Geo = {
131
- lat: number
132
- lng: number
133
- }
134
-
135
- export type Hdg = {
136
- mag: number
137
- true: number
138
- }
139
-
140
- export type Spd = {
141
- tas: number
142
- }
143
-
144
- export type Wind = {
145
- spd: number
146
- dir: number
147
- }
148
-
149
- export type Airport = {
150
- icao: string
151
- iata: string
152
- name: string
153
- time: string
154
- geo: Geo
155
- hdg: Hdg
156
- spd: Spd
157
- fuel: number
158
- pitch: number
159
- bank: number
160
- wind: Wind
161
- }
162
-
163
- export type PilotStats = {
164
- id: number
165
- all_time: PilotStat
166
- month: PilotStat
167
- links: Link[]
168
- }
169
-
170
- export type AirlineStats = {
171
- id: number
172
- total_pilots: number
173
- all_time: PilotStat
174
- month: PilotStat
175
- links: Link[]
176
- }
177
-
178
- export type PilotStat = {
179
- total_flights: number
180
- total_hours: number
181
- total_distance: number
182
- average_landing: number
183
- }
184
-
185
- export type Screenshot = {
186
- id: number
187
- name: string
188
- desc: any
189
- urls: Urls
190
- created_at: string
191
- links: Link[]
192
- }
193
-
194
- export type Urls = {
195
- fullsize: string
196
- thumbnail: string
197
- }
198
-
199
- export type FSHubRequestOptions = {
200
- cursor?: number;
201
- limit?: number;
202
- }
203
-
204
- export type FSHubApi = {
205
- axios: AxiosInstance
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<FSHubAirlinePilotStats>>
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;
293
- }
294
-
295
- export type FSHubAirlinePilotStats = {
296
- user: FSHubAirlinePilotStatsUser
297
- points: number
298
- carry_hours: number
299
- rank: FSHubAirlinePilotStatsRank
300
- roles: FSHubAirlinePilotStatsRoles[]
301
- hired_at: string
302
- discord_id: number
303
- links: FSHubAirlinePilotStatsLink[]
304
- }
305
-
306
- export type FSHubAirlinePilotStatsRoles = {
307
- [key: string]: any; // TODO: Add proper type
308
- }
309
-
310
- export type FSHubAirlinePilotStatsUser = {
311
- id: number
312
- name: string
313
- email: string
314
- profile: FSHubAirlinePilotStatsUserProfile
315
- locations: FSHubAirlinePilotStatsUserLocations
316
- handles: FSHubAirlinePilotStatsUserHandles
317
- timezone: string
318
- country: string
319
- }
320
-
321
- export type FSHubAirlinePilotStatsUserProfile = {
322
- avatar_url: string
323
- bio: string
324
- }
325
-
326
- export type FSHubAirlinePilotStatsUserLocations = {
327
- base: string
328
- locale: string
329
- }
330
-
331
- export type FSHubAirlinePilotStatsUserHandles = {
332
- website: any
333
- twitter: any
334
- facebook: any
335
- vatsim: any
336
- ivao: any
337
- }
338
-
339
- export type FSHubAirlinePilotStatsRank = {
340
- id: number
341
- name: string
342
- abbreviation: string
343
- min_hours: number
344
- created_at: string
345
- updated_at: string
346
- }
347
-
348
- export type FSHubAirlinePilotStatsLink = {
349
- rel: string
350
- uri: string
351
- }
7
+ // Config
8
+ export type { Config } from './Config';
9
+
10
+ // Common types
11
+ export type { Link, Gps, Handles } from './Common';
12
+
13
+ // Pilot types
14
+ export type { Pilot, CurrentPilot } from './Pilot';
15
+
16
+ // Flight types
17
+ export type {
18
+ Flight,
19
+ User,
20
+ Aircraft,
21
+ UserConf,
22
+ Distance,
23
+ Average,
24
+ Max,
25
+ Geo,
26
+ Hdg,
27
+ Spd,
28
+ Wind,
29
+ } from './Flight';
30
+
31
+ // Airline types
32
+ export type { Airline, Owner } from './Airline';
33
+
34
+ // Stats types
35
+ export type { PilotStats, AirlineStats, PilotStat } from './Stats';
36
+
37
+ // Screenshot types
38
+ export type { Screenshot, Urls } from './Screenshot';
39
+
40
+ // FSHub API types
41
+ export type { FSHubApi } from './FSHubApi';
42
+ export type { FSHubRequestOptions } from './FSHubRequestOptions';
43
+ export type { FSHubResponse } from './FSHubResponse';
44
+ export type { FSHubError } from './FSHubError';
45
+ export type { FSHubApplicationResponse, FSHubPilotSetRankData } from './FSHubApplication';
46
+ export type {
47
+ FSHubPilotPointPurchaseTransactionData,
48
+ FSHubPilotPointPurchaseTransactionResponse
49
+ } from './FSHubPilotPointPurchase';
50
+ export type {
51
+ FSHubAirlineRole,
52
+ FSHubAirlineRank,
53
+ FSHubAirlinePilotStats,
54
+ FSHubAirlinePilotStatsRoles,
55
+ FSHubAirlinePilotStatsUser,
56
+ FSHubAirlinePilotStatsUserProfile,
57
+ FSHubAirlinePilotStatsUserLocations,
58
+ FSHubAirlinePilotStatsUserHandles,
59
+ FSHubAirlinePilotStatsRank,
60
+ FSHubAirlinePilotStatsLink
61
+ } from './FSHubAirline';
62
+
63
+ // Airport types
64
+ export type { Airport } from './Airport';
65
+
66
+ export type { AirportMETARReport, AirportMETAR } from './AirportMETARReport';
@@ -0,0 +1,10 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ],
7
+ "settings": {
8
+ "workbench.colorTheme": "Cursor Dark"
9
+ }
10
+ }