// // AUTO-GENERATED FILE, DO NOT MODIFY! // import 'dart:async'; import 'package:built_value/json_object.dart'; import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; import 'package:openapi/src/api_util.dart'; import 'package:openapi/src/model/airline_entity.dart'; import 'package:openapi/src/model/flights_controller_get_flights_in_bounds_v1200_response.dart'; import 'package:openapi/src/model/flights_response_entity.dart'; import 'package:openapi/src/model/generic_error_entity.dart'; import 'package:openapi/src/model/get_airline_dto.dart'; import 'package:openapi/src/model/tracked_flights_response_entity.dart'; class FlightsApi { final Dio _dio; final Serializers _serializers; const FlightsApi(this._dio, this._serializers); /// Get airline /// Get airline with search query. This doesn't check if the number is correct /// /// Parameters: /// * [getAirlineDTO] /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// /// Returns a [Future] containing a [Response] with a [AirlineEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightsControllerGetAirlineV1({ required GetAirlineDTO getAirlineDTO, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flights/airline'; final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(GetAirlineDTO); _bodyData = _serializers.serialize(getAirlineDTO, specifiedType: _type); } catch(error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, _path, ), type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } final _response = await _dio.request( _path, data: _bodyData, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); AirlineEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(AirlineEntity), ) as AirlineEntity; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } /// Get flights within geographic bounds(deprecated - will return nothing) /// Get all aircraft currently flying within a specified geographic bounding box using FlightAware data with comprehensive aircraft details /// /// Parameters: /// * [minLat] - Minimum latitude of the bounding box /// * [maxLat] - Maximum latitude of the bounding box /// * [minLng] - Minimum longitude of the bounding box /// * [maxLng] - Maximum longitude of the bounding box /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// /// Returns a [Future] containing a [Response] with a [FlightsControllerGetFlightsInBoundsV1200Response] as data /// Throws [DioException] if API call or serialization fails @Deprecated('This operation has been deprecated') Future> flightsControllerGetFlightsInBoundsV1({ required num minLat, required num maxLat, required num minLng, required num maxLng, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flights/bounds'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'minLat': encodeQueryParameter(_serializers, minLat, const FullType(num)), r'maxLat': encodeQueryParameter(_serializers, maxLat, const FullType(num)), r'minLng': encodeQueryParameter(_serializers, minLng, const FullType(num)), r'maxLng': encodeQueryParameter(_serializers, maxLng, const FullType(num)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); FlightsControllerGetFlightsInBoundsV1200Response? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightsControllerGetFlightsInBoundsV1200Response), ) as FlightsControllerGetFlightsInBoundsV1200Response; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } /// Get flights between two airports /// Get all flights between two airports for a specific date /// /// Parameters: /// * [from] - Departure airport IATA code /// * [to] - Arrival airport IATA code /// * [date] - Flight date in ISO format /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// /// Returns a [Future] containing a [Response] with a [FlightsResponseEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightsControllerGetFlightsV1({ required String from, required String to, required String date, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flights'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'from': encodeQueryParameter(_serializers, from, const FullType(String)), r'to': encodeQueryParameter(_serializers, to, const FullType(String)), r'date': encodeQueryParameter(_serializers, date, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); FlightsResponseEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightsResponseEntity), ) as FlightsResponseEntity; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } /// Get all tracked flights /// Returns a list of all flights that have been tracked in the system, sorted by most recently created. Limited to 50 most recent flights. /// /// Parameters: /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// /// Returns a [Future] containing a [Response] with a [TrackedFlightsResponseEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightsControllerGetTrackedFlightsV1({ CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flights/tracked'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _path, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); TrackedFlightsResponseEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(TrackedFlightsResponseEntity), ) as TrackedFlightsResponseEntity; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } }