// // 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:built_collection/built_collection.dart'; import 'package:openapi/src/api_util.dart'; import 'package:openapi/src/model/create_flight_booking_dto.dart'; import 'package:openapi/src/model/flight_booking_entity.dart'; import 'package:openapi/src/model/flight_controller_delete_flight_booking_v1200_response.dart'; import 'package:openapi/src/model/flight_response_entity.dart'; import 'package:openapi/src/model/flight_search_response_entity.dart'; import 'package:openapi/src/model/flight_track_response_entity.dart'; import 'package:openapi/src/model/generic_error_entity.dart'; import 'package:openapi/src/model/update_flight_booking_dto.dart'; class FlightApi { final Dio _dio; final Serializers _serializers; const FlightApi(this._dio, this._serializers); /// Create a flight booking /// Create a new booking for a flight with booking details /// /// Parameters: /// * [createFlightBookingDTO] /// * [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 [FlightBookingEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerCreateFlightBookingV1({ required CreateFlightBookingDTO createFlightBookingDTO, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/booking'; 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(CreateFlightBookingDTO); _bodyData = _serializers.serialize(createFlightBookingDTO, 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, ); FlightBookingEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightBookingEntity), ) as FlightBookingEntity; } 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, ); } /// Delete a flight booking /// Delete a flight booking /// /// Parameters: /// * [bookingId] - ID of the booking to delete /// * [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 [FlightControllerDeleteFlightBookingV1200Response] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerDeleteFlightBookingV1({ required String bookingId, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/booking/{bookingId}'.replaceAll('{' r'bookingId' '}', encodeQueryParameter(_serializers, bookingId, const FullType(String)).toString()); final _options = Options( method: r'DELETE', 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, ); FlightControllerDeleteFlightBookingV1200Response? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightControllerDeleteFlightBookingV1200Response), ) as FlightControllerDeleteFlightBookingV1200Response; } 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 a flight booking /// Get details of a specific flight booking /// /// Parameters: /// * [bookingId] - ID of the booking to retrieve /// * [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 [FlightBookingEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerGetFlightBookingV1({ required String bookingId, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/booking/{bookingId}'.replaceAll('{' r'bookingId' '}', encodeQueryParameter(_serializers, bookingId, const FullType(String)).toString()); 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, ); FlightBookingEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightBookingEntity), ) as FlightBookingEntity; } 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 bookings for a flight /// Get all bookings associated with a specific flight /// /// Parameters: /// * [flightId] - ID of the flight /// * [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 [BuiltList] as data /// Throws [DioException] if API call or serialization fails Future>> flightControllerGetFlightBookingsByFlightIdV1({ required String flightId, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/booking/flight/{flightId}'.replaceAll('{' r'flightId' '}', encodeQueryParameter(_serializers, flightId, const FullType(String)).toString()); 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, ); BuiltList? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(BuiltList, [FullType(FlightBookingEntity)]), ) as BuiltList; } 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 flight track/path /// Get the flight path with all position data points for a specific flight /// /// Parameters: /// * [iata] - IATA flight number /// * [icao] - ICAO flight number /// * [timezone] - The timezone from which the request is being made. /// * [date] - Flight date (ISO format). Defaults to current date if not provided /// * [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 [FlightTrackResponseEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerGetFlightTrackV1({ required String iata, required String icao, required String timezone, String? date, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/track'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'iata': encodeQueryParameter(_serializers, iata, const FullType(String)), r'icao': encodeQueryParameter(_serializers, icao, const FullType(String)), if (date != null) r'date': encodeQueryParameter(_serializers, date, const FullType(String)), r'timezone': encodeQueryParameter(_serializers, timezone, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); FlightTrackResponseEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightTrackResponseEntity), ) as FlightTrackResponseEntity; } 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 flight details /// Get detailed information about a specific flight including real-time tracking data. Use faFlightId to fetch a specific flight after searching. /// /// Parameters: /// * [iata] - IATA flight number /// * [icao] - ICAO flight number /// * [timezone] - The timezone from which the request is being made. /// * [date] - Flight date (ISO format). Defaults to current date if not provided /// * [forceUpdate] - Force update the flight data(used to refresh the flight data) /// * [faFlightId] - FlightAware flight ID to fetch a specific flight. Use this after searching for flights to get details of a selected flight. /// * [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 [FlightResponseEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerGetFlightV1({ required String iata, required String icao, required String timezone, String? date, bool? forceUpdate = false, String? faFlightId, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'iata': encodeQueryParameter(_serializers, iata, const FullType(String)), r'icao': encodeQueryParameter(_serializers, icao, const FullType(String)), if (date != null) r'date': encodeQueryParameter(_serializers, date, const FullType(String)), r'timezone': encodeQueryParameter(_serializers, timezone, const FullType(String)), if (forceUpdate != null) r'forceUpdate': encodeQueryParameter(_serializers, forceUpdate, const FullType(bool)), if (faFlightId != null) r'faFlightId': encodeQueryParameter(_serializers, faFlightId, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); FlightResponseEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightResponseEntity), ) as FlightResponseEntity; } 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, ); } /// Search flights /// Search for flights by identifier and optional date. Returns lightweight flight summaries for selection. /// /// Parameters: /// * [iata] - IATA flight number /// * [icao] - ICAO flight number /// * [timezone] - The timezone from which the request is being made. /// * [date] - Flight date (ISO format). Filters flights by date if provided /// * [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 [FlightSearchResponseEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerSearchFlightsV1({ required String iata, required String icao, required String timezone, String? date, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/search'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'iata': encodeQueryParameter(_serializers, iata, const FullType(String)), r'icao': encodeQueryParameter(_serializers, icao, const FullType(String)), if (date != null) r'date': encodeQueryParameter(_serializers, date, const FullType(String)), r'timezone': encodeQueryParameter(_serializers, timezone, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); FlightSearchResponseEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightSearchResponseEntity), ) as FlightSearchResponseEntity; } 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, ); } /// Update a flight booking /// Update an existing flight booking /// /// Parameters: /// * [bookingId] - ID of the booking to update /// * [updateFlightBookingDTO] /// * [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 [FlightBookingEntity] as data /// Throws [DioException] if API call or serialization fails Future> flightControllerUpdateFlightBookingV1({ required String bookingId, required UpdateFlightBookingDTO updateFlightBookingDTO, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/booking/{bookingId}'.replaceAll('{' r'bookingId' '}', encodeQueryParameter(_serializers, bookingId, const FullType(String)).toString()); final _options = Options( method: r'PUT', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(UpdateFlightBookingDTO); _bodyData = _serializers.serialize(updateFlightBookingDTO, 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, ); FlightBookingEntity? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(FlightBookingEntity), ) as FlightBookingEntity; } 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, ); } }