// // 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/airport_entity.dart'; import 'package:openapi/src/model/generic_error_entity.dart'; class AirportsApi { final Dio _dio; final Serializers _serializers; const AirportsApi(this._dio, this._serializers); /// Get all airports /// Get all airports. We do not recommend using this route without any search query. This route has over 20k records /// /// Parameters: /// * [search] - Search query for airport. Can be iata, ident(icao), name or a part of any these. Searching is case insensitive /// * [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>> airportsControllerGetAirportsV1({ String? search, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/v1/airports'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { if (search != null) r'search': encodeQueryParameter(_serializers, search, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, 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(AirportEntity)]), ) 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, ); } }