| 1 | // |
| 2 | // AUTO-GENERATED FILE, DO NOT MODIFY! |
| 3 | // |
| 4 | |
| 5 | import 'dart:async'; |
| 6 | |
| 7 | import 'package:built_value/json_object.dart'; |
| 8 | import 'package:built_value/serializer.dart'; |
| 9 | import 'package:dio/dio.dart'; |
| 10 | |
| 11 | import 'package:openapi/src/api_util.dart'; |
| 12 | import 'package:openapi/src/model/airline_entity.dart'; |
| 13 | import 'package:openapi/src/model/flights_controller_get_flights_in_bounds_v1200_response.dart'; |
| 14 | import 'package:openapi/src/model/flights_response_entity.dart'; |
| 15 | import 'package:openapi/src/model/generic_error_entity.dart'; |
| 16 | import 'package:openapi/src/model/get_airline_dto.dart'; |
| 17 | import 'package:openapi/src/model/tracked_flights_response_entity.dart'; |
| 18 | |
| 19 | class FlightsApi { |
| 20 | |
| 21 | final Dio _dio; |
| 22 | |
| 23 | final Serializers _serializers; |
| 24 | |
| 25 | const FlightsApi(this |
| 26 | |
| 27 | /// Get airline |
| 28 | /// Get airline with search query. This doesn't check if the number is correct |
| 29 | /// |
| 30 | /// Parameters: |
| 31 | /// * [getAirlineDTO] |
| 32 | /// * [cancelToken] - A [CancelToken] |
| 33 | /// * [headers] - Can be used to add additional headers to the request |
| 34 | /// * [extras] - Can be used to add flags to the request |
| 35 | /// * [validateStatus] - A [ValidateStatus] |
| 36 | /// * [onSendProgress] - A [ProgressCallback] |
| 37 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 38 | /// |
| 39 | /// Returns a [Future] containing a [Response] |
| 40 | /// Throws [DioException] if API call or serialization fails |
| 41 | Future<Response<AirlineEntity |
| 42 | required GetAirlineDTO getAirlineDTO, |
| 43 | CancelToken? cancelToken, |
| 44 | Map<String, dynamic |
| 45 | Map<String, dynamic |
| 46 | ValidateStatus? validateStatus, |
| 47 | ProgressCallback? onSendProgress, |
| 48 | ProgressCallback? onReceiveProgress, |
| 49 | }) async { |
| 50 | final _path = r'/v1/flights/airline'; |
| 51 | final _options = Options( |
| 52 | method: r'POST', |
| 53 | headers: <String, dynamic |
| 54 | ...?headers, |
| 55 | }, |
| 56 | extra: <String, dynamic |
| 57 | 'secure': <Map<String |
| 58 | { |
| 59 | 'type': 'http', |
| 60 | 'scheme': 'bearer', |
| 61 | 'name': 'JWT-auth', |
| 62 | }, |
| 63 | ], |
| 64 | ...?extra, |
| 65 | }, |
| 66 | contentType: 'application/json', |
| 67 | validateStatus: validateStatus, |
| 68 | ); |
| 69 | |
| 70 | dynamic _bodyData; |
| 71 | |
| 72 | try { |
| 73 | const _type = FullType( |
| 74 | _bodyData = _serializers.serialize(getAirlineDTO, specifiedType |
| 75 | |
| 76 | } catch(error, stackTrace) { |
| 77 | throw DioException( |
| 78 | requestOptions: _options.compose( |
| 79 | _dio.options, |
| 80 | _path, |
| 81 | ), |
| 82 | type: DioExceptionType.unknown, |
| 83 | error: error, |
| 84 | stackTrace: stackTrace, |
| 85 | ); |
| 86 | } |
| 87 | |
| 88 | final _response = await _dio. |
| 89 | _path, |
| 90 | data: _bodyData, |
| 91 | options: _options, |
| 92 | cancelToken: cancelToken, |
| 93 | onSendProgress: onSendProgress, |
| 94 | onReceiveProgress: onReceiveProgress, |
| 95 | ); |
| 96 | |
| 97 | AirlineEntity? _responseData; |
| 98 | |
| 99 | try { |
| 100 | final rawResponse = _response.data; |
| 101 | _responseData = rawResponse == null ? null |
| 102 | rawResponse, |
| 103 | specifiedType: const FullType( |
| 104 | ) as AirlineEntity; |
| 105 | |
| 106 | } catch (error, stackTrace) { |
| 107 | throw DioException( |
| 108 | requestOptions: _response.requestOptions, |
| 109 | response: _response, |
| 110 | type: DioExceptionType.unknown, |
| 111 | error: error, |
| 112 | stackTrace: stackTrace, |
| 113 | ); |
| 114 | } |
| 115 | |
| 116 | return Response<AirlineEntity |
| 117 | data: _responseData, |
| 118 | headers: _response.headers, |
| 119 | isRedirect: _response.isRedirect, |
| 120 | requestOptions: _response.requestOptions, |
| 121 | redirects: _response.redirects, |
| 122 | statusCode: _response.statusCode, |
| 123 | statusMessage: _response.statusMessage, |
| 124 | extra: _response.extra, |
| 125 | ); |
| 126 | } |
| 127 | |
| 128 | /// Get flights within geographic bounds(deprecated - will return nothing) |
| 129 | /// Get all aircraft currently flying within a specified geographic bounding box using FlightAware data with comprehensive aircraft details |
| 130 | /// |
| 131 | /// Parameters: |
| 132 | /// * [minLat] - Minimum latitude of the bounding box |
| 133 | /// * [maxLat] - Maximum latitude of the bounding box |
| 134 | /// * [minLng] - Minimum longitude of the bounding box |
| 135 | /// * [maxLng] - Maximum longitude of the bounding box |
| 136 | /// * [cancelToken] - A [CancelToken] |
| 137 | /// * [headers] - Can be used to add additional headers to the request |
| 138 | /// * [extras] - Can be used to add flags to the request |
| 139 | /// * [validateStatus] - A [ValidateStatus] |
| 140 | /// * [onSendProgress] - A [ProgressCallback] |
| 141 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 142 | /// |
| 143 | /// Returns a [Future] containing a [Response] |
| 144 | /// Throws [DioException] if API call or serialization fails |
| 145 | @Deprecated('This operation has been deprecated') |
| 146 | Future<Response<FlightsControllerGetFlightsInBoundsV1200Response |
| 147 | required num minLat, |
| 148 | required num maxLat, |
| 149 | required num minLng, |
| 150 | required num maxLng, |
| 151 | CancelToken? cancelToken, |
| 152 | Map<String, dynamic |
| 153 | Map<String, dynamic |
| 154 | ValidateStatus? validateStatus, |
| 155 | ProgressCallback? onSendProgress, |
| 156 | ProgressCallback? onReceiveProgress, |
| 157 | }) async { |
| 158 | final _path = r'/v1/flights/bounds'; |
| 159 | final _options = Options( |
| 160 | method: r'GET', |
| 161 | headers: <String, dynamic |
| 162 | ...?headers, |
| 163 | }, |
| 164 | extra: <String, dynamic |
| 165 | 'secure': <Map<String |
| 166 | { |
| 167 | 'type': 'http', |
| 168 | 'scheme': 'bearer', |
| 169 | 'name': 'JWT-auth', |
| 170 | }, |
| 171 | ], |
| 172 | ...?extra, |
| 173 | }, |
| 174 | validateStatus: validateStatus, |
| 175 | ); |
| 176 | |
| 177 | final _queryParameters = <String |
| 178 | r'minLat': encodeQueryParameter(_serializers, minLat |
| 179 | r'maxLat': encodeQueryParameter(_serializers, maxLat |
| 180 | r'minLng': encodeQueryParameter(_serializers, minLng |
| 181 | r'maxLng': encodeQueryParameter(_serializers, maxLng |
| 182 | }; |
| 183 | |
| 184 | final _response = await _dio. |
| 185 | _path, |
| 186 | options: _options, |
| 187 | queryParameters: _queryParameters, |
| 188 | cancelToken: cancelToken, |
| 189 | onSendProgress: onSendProgress, |
| 190 | onReceiveProgress: onReceiveProgress, |
| 191 | ); |
| 192 | |
| 193 | FlightsControllerGetFlightsInBoundsV1200Response? _responseData; |
| 194 | |
| 195 | try { |
| 196 | final rawResponse = _response.data; |
| 197 | _responseData = rawResponse == null ? null |
| 198 | rawResponse, |
| 199 | specifiedType: const FullType( |
| 200 | ) as FlightsControllerGetFlightsInBoundsV1200Response; |
| 201 | |
| 202 | } catch (error, stackTrace) { |
| 203 | throw DioException( |
| 204 | requestOptions: _response.requestOptions, |
| 205 | response: _response, |
| 206 | type: DioExceptionType.unknown, |
| 207 | error: error, |
| 208 | stackTrace: stackTrace, |
| 209 | ); |
| 210 | } |
| 211 | |
| 212 | return Response<FlightsControllerGetFlightsInBoundsV1200Response |
| 213 | data: _responseData, |
| 214 | headers: _response.headers, |
| 215 | isRedirect: _response.isRedirect, |
| 216 | requestOptions: _response.requestOptions, |
| 217 | redirects: _response.redirects, |
| 218 | statusCode: _response.statusCode, |
| 219 | statusMessage: _response.statusMessage, |
| 220 | extra: _response.extra, |
| 221 | ); |
| 222 | } |
| 223 | |
| 224 | /// Get flights between two airports |
| 225 | /// Get all flights between two airports for a specific date |
| 226 | /// |
| 227 | /// Parameters: |
| 228 | /// * [from] - Departure airport IATA code |
| 229 | /// * [to] - Arrival airport IATA code |
| 230 | /// * [date] - Flight date in ISO format |
| 231 | /// * [cancelToken] - A [CancelToken] |
| 232 | /// * [headers] - Can be used to add additional headers to the request |
| 233 | /// * [extras] - Can be used to add flags to the request |
| 234 | /// * [validateStatus] - A [ValidateStatus] |
| 235 | /// * [onSendProgress] - A [ProgressCallback] |
| 236 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 237 | /// |
| 238 | /// Returns a [Future] containing a [Response] |
| 239 | /// Throws [DioException] if API call or serialization fails |
| 240 | Future<Response<FlightsResponseEntity |
| 241 | required String from, |
| 242 | required String to, |
| 243 | required String date, |
| 244 | CancelToken? cancelToken, |
| 245 | Map<String, dynamic |
| 246 | Map<String, dynamic |
| 247 | ValidateStatus? validateStatus, |
| 248 | ProgressCallback? onSendProgress, |
| 249 | ProgressCallback? onReceiveProgress, |
| 250 | }) async { |
| 251 | final _path = r'/v1/flights'; |
| 252 | final _options = Options( |
| 253 | method: r'GET', |
| 254 | headers: <String, dynamic |
| 255 | ...?headers, |
| 256 | }, |
| 257 | extra: <String, dynamic |
| 258 | 'secure': <Map<String |
| 259 | { |
| 260 | 'type': 'http', |
| 261 | 'scheme': 'bearer', |
| 262 | 'name': 'JWT-auth', |
| 263 | }, |
| 264 | ], |
| 265 | ...?extra, |
| 266 | }, |
| 267 | validateStatus: validateStatus, |
| 268 | ); |
| 269 | |
| 270 | final _queryParameters = <String |
| 271 | r'from': encodeQueryParameter(_serializers, from |
| 272 | r'to': encodeQueryParameter(_serializers, to |
| 273 | r'date': encodeQueryParameter(_serializers, date |
| 274 | }; |
| 275 | |
| 276 | final _response = await _dio. |
| 277 | _path, |
| 278 | options: _options, |
| 279 | queryParameters: _queryParameters, |
| 280 | cancelToken: cancelToken, |
| 281 | onSendProgress: onSendProgress, |
| 282 | onReceiveProgress: onReceiveProgress, |
| 283 | ); |
| 284 | |
| 285 | FlightsResponseEntity? _responseData; |
| 286 | |
| 287 | try { |
| 288 | final rawResponse = _response.data; |
| 289 | _responseData = rawResponse == null ? null |
| 290 | rawResponse, |
| 291 | specifiedType: const FullType( |
| 292 | ) as FlightsResponseEntity; |
| 293 | |
| 294 | } catch (error, stackTrace) { |
| 295 | throw DioException( |
| 296 | requestOptions: _response.requestOptions, |
| 297 | response: _response, |
| 298 | type: DioExceptionType.unknown, |
| 299 | error: error, |
| 300 | stackTrace: stackTrace, |
| 301 | ); |
| 302 | } |
| 303 | |
| 304 | return Response<FlightsResponseEntity |
| 305 | data: _responseData, |
| 306 | headers: _response.headers, |
| 307 | isRedirect: _response.isRedirect, |
| 308 | requestOptions: _response.requestOptions, |
| 309 | redirects: _response.redirects, |
| 310 | statusCode: _response.statusCode, |
| 311 | statusMessage: _response.statusMessage, |
| 312 | extra: _response.extra, |
| 313 | ); |
| 314 | } |
| 315 | |
| 316 | /// Get all tracked flights |
| 317 | /// Returns a list of all flights that have been tracked in the system, sorted by most recently created. Limited to 50 most recent flights. |
| 318 | /// |
| 319 | /// Parameters: |
| 320 | /// * [cancelToken] - A [CancelToken] |
| 321 | /// * [headers] - Can be used to add additional headers to the request |
| 322 | /// * [extras] - Can be used to add flags to the request |
| 323 | /// * [validateStatus] - A [ValidateStatus] |
| 324 | /// * [onSendProgress] - A [ProgressCallback] |
| 325 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 326 | /// |
| 327 | /// Returns a [Future] containing a [Response] |
| 328 | /// Throws [DioException] if API call or serialization fails |
| 329 | Future<Response<TrackedFlightsResponseEntity |
| 330 | CancelToken? cancelToken, |
| 331 | Map<String, dynamic |
| 332 | Map<String, dynamic |
| 333 | ValidateStatus? validateStatus, |
| 334 | ProgressCallback? onSendProgress, |
| 335 | ProgressCallback? onReceiveProgress, |
| 336 | }) async { |
| 337 | final _path = r'/v1/flights/tracked'; |
| 338 | final _options = Options( |
| 339 | method: r'GET', |
| 340 | headers: <String, dynamic |
| 341 | ...?headers, |
| 342 | }, |
| 343 | extra: <String, dynamic |
| 344 | 'secure': <Map<String |
| 345 | { |
| 346 | 'type': 'http', |
| 347 | 'scheme': 'bearer', |
| 348 | 'name': 'JWT-auth', |
| 349 | }, |
| 350 | ], |
| 351 | ...?extra, |
| 352 | }, |
| 353 | validateStatus: validateStatus, |
| 354 | ); |
| 355 | |
| 356 | final _response = await _dio. |
| 357 | _path, |
| 358 | options: _options, |
| 359 | cancelToken: cancelToken, |
| 360 | onSendProgress: onSendProgress, |
| 361 | onReceiveProgress: onReceiveProgress, |
| 362 | ); |
| 363 | |
| 364 | TrackedFlightsResponseEntity? _responseData; |
| 365 | |
| 366 | try { |
| 367 | final rawResponse = _response.data; |
| 368 | _responseData = rawResponse == null ? null |
| 369 | rawResponse, |
| 370 | specifiedType: const FullType( |
| 371 | ) as TrackedFlightsResponseEntity; |
| 372 | |
| 373 | } catch (error, stackTrace) { |
| 374 | throw DioException( |
| 375 | requestOptions: _response.requestOptions, |
| 376 | response: _response, |
| 377 | type: DioExceptionType.unknown, |
| 378 | error: error, |
| 379 | stackTrace: stackTrace, |
| 380 | ); |
| 381 | } |
| 382 | |
| 383 | return Response<TrackedFlightsResponseEntity |
| 384 | data: _responseData, |
| 385 | headers: _response.headers, |
| 386 | isRedirect: _response.isRedirect, |
| 387 | requestOptions: _response.requestOptions, |
| 388 | redirects: _response.redirects, |
| 389 | statusCode: _response.statusCode, |
| 390 | statusMessage: _response.statusMessage, |
| 391 | extra: _response.extra, |
| 392 | ); |
| 393 | } |
| 394 | |
| 395 | } |