| 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:built_collection/built_collection.dart'; |
| 12 | import 'package:openapi/src/api_util.dart'; |
| 13 | import 'package:openapi/src/model/airport_entity.dart'; |
| 14 | import 'package:openapi/src/model/generic_error_entity.dart'; |
| 15 | |
| 16 | class AirportsApi { |
| 17 | |
| 18 | final Dio _dio; |
| 19 | |
| 20 | final Serializers _serializers; |
| 21 | |
| 22 | const AirportsApi(this |
| 23 | |
| 24 | /// Get all airports |
| 25 | /// Get all airports. We do not recommend using this route without any search query. This route has over 20k records |
| 26 | /// |
| 27 | /// Parameters: |
| 28 | /// * [search] - Search query for airport. Can be iata, ident(icao), name or a part of any these. Searching is case insensitive |
| 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] containing a [Response] |
| 37 | /// Throws [DioException] if API call or serialization fails |
| 38 | Future<Response<BuiltList |
| 39 | String? search, |
| 40 | CancelToken? cancelToken, |
| 41 | Map<String, dynamic |
| 42 | Map<String, dynamic |
| 43 | ValidateStatus? validateStatus, |
| 44 | ProgressCallback? onSendProgress, |
| 45 | ProgressCallback? onReceiveProgress, |
| 46 | }) async { |
| 47 | final _path = r'/v1/airports'; |
| 48 | final _options = Options( |
| 49 | method: r'GET', |
| 50 | headers: <String, dynamic |
| 51 | ...?headers, |
| 52 | }, |
| 53 | extra: <String, dynamic |
| 54 | 'secure': <Map<String |
| 55 | ...?extra, |
| 56 | }, |
| 57 | validateStatus: validateStatus, |
| 58 | ); |
| 59 | |
| 60 | final _queryParameters = <String |
| 61 | if (search != null) r'search': |
| 62 | }; |
| 63 | |
| 64 | final _response = await _dio. |
| 65 | _path, |
| 66 | options: _options, |
| 67 | queryParameters: _queryParameters, |
| 68 | cancelToken: cancelToken, |
| 69 | onSendProgress: onSendProgress, |
| 70 | onReceiveProgress: onReceiveProgress, |
| 71 | ); |
| 72 | |
| 73 | BuiltList<AirportEntity>? _responseData |
| 74 | |
| 75 | try { |
| 76 | final rawResponse = _response.data; |
| 77 | _responseData = rawResponse == null ? null |
| 78 | rawResponse, |
| 79 | specifiedType: const FullType( |
| 80 | ) as BuiltList<AirportEntity> |
| 81 | |
| 82 | } catch (error, stackTrace) { |
| 83 | throw DioException( |
| 84 | requestOptions: _response.requestOptions, |
| 85 | response: _response, |
| 86 | type: DioExceptionType.unknown, |
| 87 | error: error, |
| 88 | stackTrace: stackTrace, |
| 89 | ); |
| 90 | } |
| 91 | |
| 92 | return Response<BuiltList |
| 93 | data: _responseData, |
| 94 | headers: _response.headers, |
| 95 | isRedirect: _response.isRedirect, |
| 96 | requestOptions: _response.requestOptions, |
| 97 | redirects: _response.redirects, |
| 98 | statusCode: _response.statusCode, |
| 99 | statusMessage: _response.statusMessage, |
| 100 | extra: _response.extra, |
| 101 | ); |
| 102 | } |
| 103 | |
| 104 | } |