// // 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/flight_alert_dto.dart'; import 'package:openapi/src/model/generic_error_entity.dart'; class FlightAlertsApi { final Dio _dio; final Serializers _serializers; const FlightAlertsApi(this._dio, this._serializers); /// Subscribe to push alerts for a flight /// Registers a OneSignal subscription (player) ID to receive push notifications when this flight changes (status, gate, terminal, delays, baggage claim, airport delays). /// /// Parameters: /// * [id] - Flight ID or FlightAware flight ID /// * [flightAlertDTO] /// * [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] /// Throws [DioException] if API call or serialization fails Future> flightAlertsControllerSubscribeV1({ required String id, required FlightAlertDTO flightAlertDTO, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/{id}/alerts'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); 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(FlightAlertDTO); _bodyData = _serializers.serialize(flightAlertDTO, 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, ); return _response; } /// Unsubscribe from push alerts for a flight /// Removes a OneSignal subscription (player) ID from a flight’s alert list. Tracking stops once no devices remain. /// /// Parameters: /// * [id] - Flight ID or FlightAware flight ID /// * [flightAlertDTO] /// * [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] /// Throws [DioException] if API call or serialization fails Future> flightAlertsControllerUnsubscribeV1({ required String id, required FlightAlertDTO flightAlertDTO, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/flight/{id}/alerts'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'DELETE', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'http', 'scheme': 'bearer', 'name': 'JWT-auth', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(FlightAlertDTO); _bodyData = _serializers.serialize(flightAlertDTO, 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, ); return _response; } }