| 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/model/create_alert_dto.dart'; |
| 12 | import 'package:openapi/src/model/generic_error_entity.dart'; |
| 13 | |
| 14 | class AlertsApi { |
| 15 | |
| 16 | final Dio _dio; |
| 17 | |
| 18 | final Serializers _serializers; |
| 19 | |
| 20 | const AlertsApi(this |
| 21 | |
| 22 | /// Subscribe to flight alerts |
| 23 | /// Register a OneSignal player for push notifications about a flight. Seeds the initial flight + airport state in Redis and wakes the alerts worker. |
| 24 | /// |
| 25 | /// Parameters: |
| 26 | /// * [createAlertDto] |
| 27 | /// * [cancelToken] - A [CancelToken] |
| 28 | /// * [headers] - Can be used to add additional headers to the request |
| 29 | /// * [extras] - Can be used to add flags to the request |
| 30 | /// * [validateStatus] - A [ValidateStatus] |
| 31 | /// * [onSendProgress] - A [ProgressCallback] |
| 32 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 33 | /// |
| 34 | /// Returns a [Future] |
| 35 | /// Throws [DioException] if API call or serialization fails |
| 36 | Future<Response<void |
| 37 | required CreateAlertDto createAlertDto, |
| 38 | CancelToken? cancelToken, |
| 39 | Map<String, dynamic |
| 40 | Map<String, dynamic |
| 41 | ValidateStatus? validateStatus, |
| 42 | ProgressCallback? onSendProgress, |
| 43 | ProgressCallback? onReceiveProgress, |
| 44 | }) async { |
| 45 | final _path = r'/v1/alerts'; |
| 46 | final _options = Options( |
| 47 | method: r'POST', |
| 48 | headers: <String, dynamic |
| 49 | ...?headers, |
| 50 | }, |
| 51 | extra: <String, dynamic |
| 52 | 'secure': <Map<String |
| 53 | { |
| 54 | 'type': 'http', |
| 55 | 'scheme': 'bearer', |
| 56 | 'name': 'JWT-auth', |
| 57 | }, |
| 58 | ], |
| 59 | ...?extra, |
| 60 | }, |
| 61 | contentType: 'application/json', |
| 62 | validateStatus: validateStatus, |
| 63 | ); |
| 64 | |
| 65 | dynamic _bodyData; |
| 66 | |
| 67 | try { |
| 68 | const _type = FullType( |
| 69 | _bodyData = _serializers.serialize(createAlertDto, specifiedType |
| 70 | |
| 71 | } catch(error, stackTrace) { |
| 72 | throw DioException( |
| 73 | requestOptions: _options.compose( |
| 74 | _dio.options, |
| 75 | _path, |
| 76 | ), |
| 77 | type: DioExceptionType.unknown, |
| 78 | error: error, |
| 79 | stackTrace: stackTrace, |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | final _response = await _dio. |
| 84 | _path, |
| 85 | data: _bodyData, |
| 86 | options: _options, |
| 87 | cancelToken: cancelToken, |
| 88 | onSendProgress: onSendProgress, |
| 89 | onReceiveProgress: onReceiveProgress, |
| 90 | ); |
| 91 | |
| 92 | return _response; |
| 93 | } |
| 94 | |
| 95 | } |