| 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/flight_alert_dto.dart'; |
| 13 | import 'package:openapi/src/model/generic_error_entity.dart'; |
| 14 | |
| 15 | class FlightAlertsApi { |
| 16 | |
| 17 | final Dio _dio; |
| 18 | |
| 19 | final Serializers _serializers; |
| 20 | |
| 21 | const FlightAlertsApi(this |
| 22 | |
| 23 | /// Subscribe to push alerts for a flight |
| 24 | /// Registers a OneSignal subscription (player) ID to receive push notifications when this flight changes (status, gate, terminal, delays, baggage claim, airport delays). |
| 25 | /// |
| 26 | /// Parameters: |
| 27 | /// * [id] - Flight ID or FlightAware flight ID |
| 28 | /// * [flightAlertDTO] |
| 29 | /// * [cancelToken] - A [CancelToken] |
| 30 | /// * [headers] - Can be used to add additional headers to the request |
| 31 | /// * [extras] - Can be used to add flags to the request |
| 32 | /// * [validateStatus] - A [ValidateStatus] |
| 33 | /// * [onSendProgress] - A [ProgressCallback] |
| 34 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 35 | /// |
| 36 | /// Returns a [Future] |
| 37 | /// Throws [DioException] if API call or serialization fails |
| 38 | Future<Response<void |
| 39 | required String id, |
| 40 | required FlightAlertDTO flightAlertDTO, |
| 41 | CancelToken? cancelToken, |
| 42 | Map<String, dynamic |
| 43 | Map<String, dynamic |
| 44 | ValidateStatus? validateStatus, |
| 45 | ProgressCallback? onSendProgress, |
| 46 | ProgressCallback? onReceiveProgress, |
| 47 | }) async { |
| 48 | final _path = r'/v1/flight/{id}/alerts'.replaceAll |
| 49 | final _options = Options( |
| 50 | method: r'POST', |
| 51 | headers: <String, dynamic |
| 52 | ...?headers, |
| 53 | }, |
| 54 | extra: <String, dynamic |
| 55 | 'secure': <Map<String |
| 56 | { |
| 57 | 'type': 'http', |
| 58 | 'scheme': 'bearer', |
| 59 | 'name': 'JWT-auth', |
| 60 | }, |
| 61 | ], |
| 62 | ...?extra, |
| 63 | }, |
| 64 | contentType: 'application/json', |
| 65 | validateStatus: validateStatus, |
| 66 | ); |
| 67 | |
| 68 | dynamic _bodyData; |
| 69 | |
| 70 | try { |
| 71 | const _type = FullType( |
| 72 | _bodyData = _serializers.serialize(flightAlertDTO, specifiedType |
| 73 | |
| 74 | } catch(error, stackTrace) { |
| 75 | throw DioException( |
| 76 | requestOptions: _options.compose( |
| 77 | _dio.options, |
| 78 | _path, |
| 79 | ), |
| 80 | type: DioExceptionType.unknown, |
| 81 | error: error, |
| 82 | stackTrace: stackTrace, |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | final _response = await _dio. |
| 87 | _path, |
| 88 | data: _bodyData, |
| 89 | options: _options, |
| 90 | cancelToken: cancelToken, |
| 91 | onSendProgress: onSendProgress, |
| 92 | onReceiveProgress: onReceiveProgress, |
| 93 | ); |
| 94 | |
| 95 | return _response; |
| 96 | } |
| 97 | |
| 98 | /// Unsubscribe from push alerts for a flight |
| 99 | /// Removes a OneSignal subscription (player) ID from a flight’s alert list. Tracking stops once no devices remain. |
| 100 | /// |
| 101 | /// Parameters: |
| 102 | /// * [id] - Flight ID or FlightAware flight ID |
| 103 | /// * [flightAlertDTO] |
| 104 | /// * [cancelToken] - A [CancelToken] |
| 105 | /// * [headers] - Can be used to add additional headers to the request |
| 106 | /// * [extras] - Can be used to add flags to the request |
| 107 | /// * [validateStatus] - A [ValidateStatus] |
| 108 | /// * [onSendProgress] - A [ProgressCallback] |
| 109 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 110 | /// |
| 111 | /// Returns a [Future] |
| 112 | /// Throws [DioException] if API call or serialization fails |
| 113 | Future<Response<void |
| 114 | required String id, |
| 115 | required FlightAlertDTO flightAlertDTO, |
| 116 | CancelToken? cancelToken, |
| 117 | Map<String, dynamic |
| 118 | Map<String, dynamic |
| 119 | ValidateStatus? validateStatus, |
| 120 | ProgressCallback? onSendProgress, |
| 121 | ProgressCallback? onReceiveProgress, |
| 122 | }) async { |
| 123 | final _path = r'/v1/flight/{id}/alerts'.replaceAll |
| 124 | final _options = Options( |
| 125 | method: r'DELETE', |
| 126 | headers: <String, dynamic |
| 127 | ...?headers, |
| 128 | }, |
| 129 | extra: <String, dynamic |
| 130 | 'secure': <Map<String |
| 131 | { |
| 132 | 'type': 'http', |
| 133 | 'scheme': 'bearer', |
| 134 | 'name': 'JWT-auth', |
| 135 | }, |
| 136 | ], |
| 137 | ...?extra, |
| 138 | }, |
| 139 | contentType: 'application/json', |
| 140 | validateStatus: validateStatus, |
| 141 | ); |
| 142 | |
| 143 | dynamic _bodyData; |
| 144 | |
| 145 | try { |
| 146 | const _type = FullType( |
| 147 | _bodyData = _serializers.serialize(flightAlertDTO, specifiedType |
| 148 | |
| 149 | } catch(error, stackTrace) { |
| 150 | throw DioException( |
| 151 | requestOptions: _options.compose( |
| 152 | _dio.options, |
| 153 | _path, |
| 154 | ), |
| 155 | type: DioExceptionType.unknown, |
| 156 | error: error, |
| 157 | stackTrace: stackTrace, |
| 158 | ); |
| 159 | } |
| 160 | |
| 161 | final _response = await _dio. |
| 162 | _path, |
| 163 | data: _bodyData, |
| 164 | options: _options, |
| 165 | cancelToken: cancelToken, |
| 166 | onSendProgress: onSendProgress, |
| 167 | onReceiveProgress: onReceiveProgress, |
| 168 | ); |
| 169 | |
| 170 | return _response; |
| 171 | } |
| 172 | |
| 173 | } |