| 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/create_flight_booking_dto.dart'; |
| 14 | import 'package:openapi/src/model/flight_booking_entity.dart'; |
| 15 | import 'package:openapi/src/model/flight_controller_delete_flight_booking_v1200_response.dart'; |
| 16 | import 'package:openapi/src/model/flight_response_entity.dart'; |
| 17 | import 'package:openapi/src/model/flight_search_response_entity.dart'; |
| 18 | import 'package:openapi/src/model/flight_track_response_entity.dart'; |
| 19 | import 'package:openapi/src/model/generic_error_entity.dart'; |
| 20 | import 'package:openapi/src/model/update_flight_booking_dto.dart'; |
| 21 | |
| 22 | class FlightApi { |
| 23 | |
| 24 | final Dio _dio; |
| 25 | |
| 26 | final Serializers _serializers; |
| 27 | |
| 28 | const FlightApi(this |
| 29 | |
| 30 | /// Create a flight booking |
| 31 | /// Create a new booking for a flight with booking details |
| 32 | /// |
| 33 | /// Parameters: |
| 34 | /// * [createFlightBookingDTO] |
| 35 | /// * [cancelToken] - A [CancelToken] |
| 36 | /// * [headers] - Can be used to add additional headers to the request |
| 37 | /// * [extras] - Can be used to add flags to the request |
| 38 | /// * [validateStatus] - A [ValidateStatus] |
| 39 | /// * [onSendProgress] - A [ProgressCallback] |
| 40 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 41 | /// |
| 42 | /// Returns a [Future] containing a [Response] |
| 43 | /// Throws [DioException] if API call or serialization fails |
| 44 | Future<Response<FlightBookingEntity |
| 45 | required CreateFlightBookingDTO createFlightBookingDTO, |
| 46 | CancelToken? cancelToken, |
| 47 | Map<String, dynamic |
| 48 | Map<String, dynamic |
| 49 | ValidateStatus? validateStatus, |
| 50 | ProgressCallback? onSendProgress, |
| 51 | ProgressCallback? onReceiveProgress, |
| 52 | }) async { |
| 53 | final _path = r'/v1/flight/booking'; |
| 54 | final _options = Options( |
| 55 | method: r'POST', |
| 56 | headers: <String, dynamic |
| 57 | ...?headers, |
| 58 | }, |
| 59 | extra: <String, dynamic |
| 60 | 'secure': <Map<String |
| 61 | { |
| 62 | 'type': 'http', |
| 63 | 'scheme': 'bearer', |
| 64 | 'name': 'JWT-auth', |
| 65 | }, |
| 66 | ], |
| 67 | ...?extra, |
| 68 | }, |
| 69 | contentType: 'application/json', |
| 70 | validateStatus: validateStatus, |
| 71 | ); |
| 72 | |
| 73 | dynamic _bodyData; |
| 74 | |
| 75 | try { |
| 76 | const _type = FullType( |
| 77 | _bodyData = _serializers.serialize(createFlightBookingDTO, specifiedType |
| 78 | |
| 79 | } catch(error, stackTrace) { |
| 80 | throw DioException( |
| 81 | requestOptions: _options.compose( |
| 82 | _dio.options, |
| 83 | _path, |
| 84 | ), |
| 85 | type: DioExceptionType.unknown, |
| 86 | error: error, |
| 87 | stackTrace: stackTrace, |
| 88 | ); |
| 89 | } |
| 90 | |
| 91 | final _response = await _dio. |
| 92 | _path, |
| 93 | data: _bodyData, |
| 94 | options: _options, |
| 95 | cancelToken: cancelToken, |
| 96 | onSendProgress: onSendProgress, |
| 97 | onReceiveProgress: onReceiveProgress, |
| 98 | ); |
| 99 | |
| 100 | FlightBookingEntity? _responseData; |
| 101 | |
| 102 | try { |
| 103 | final rawResponse = _response.data; |
| 104 | _responseData = rawResponse == null ? null |
| 105 | rawResponse, |
| 106 | specifiedType: const FullType( |
| 107 | ) as FlightBookingEntity; |
| 108 | |
| 109 | } catch (error, stackTrace) { |
| 110 | throw DioException( |
| 111 | requestOptions: _response.requestOptions, |
| 112 | response: _response, |
| 113 | type: DioExceptionType.unknown, |
| 114 | error: error, |
| 115 | stackTrace: stackTrace, |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | return Response<FlightBookingEntity |
| 120 | data: _responseData, |
| 121 | headers: _response.headers, |
| 122 | isRedirect: _response.isRedirect, |
| 123 | requestOptions: _response.requestOptions, |
| 124 | redirects: _response.redirects, |
| 125 | statusCode: _response.statusCode, |
| 126 | statusMessage: _response.statusMessage, |
| 127 | extra: _response.extra, |
| 128 | ); |
| 129 | } |
| 130 | |
| 131 | /// Delete a flight booking |
| 132 | /// Delete a flight booking |
| 133 | /// |
| 134 | /// Parameters: |
| 135 | /// * [bookingId] - ID of the booking to delete |
| 136 | /// * [cancelToken] - A [CancelToken] |
| 137 | /// * [headers] - Can be used to add additional headers to the request |
| 138 | /// * [extras] - Can be used to add flags to the request |
| 139 | /// * [validateStatus] - A [ValidateStatus] |
| 140 | /// * [onSendProgress] - A [ProgressCallback] |
| 141 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 142 | /// |
| 143 | /// Returns a [Future] containing a [Response] |
| 144 | /// Throws [DioException] if API call or serialization fails |
| 145 | Future<Response<FlightControllerDeleteFlightBookingV1200Response |
| 146 | required String bookingId, |
| 147 | CancelToken? cancelToken, |
| 148 | Map<String, dynamic |
| 149 | Map<String, dynamic |
| 150 | ValidateStatus? validateStatus, |
| 151 | ProgressCallback? onSendProgress, |
| 152 | ProgressCallback? onReceiveProgress, |
| 153 | }) async { |
| 154 | final _path = r'/v1/flight/booking/{bookingId}'.replaceAll |
| 155 | final _options = Options( |
| 156 | method: r'DELETE', |
| 157 | headers: <String, dynamic |
| 158 | ...?headers, |
| 159 | }, |
| 160 | extra: <String, dynamic |
| 161 | 'secure': <Map<String |
| 162 | { |
| 163 | 'type': 'http', |
| 164 | 'scheme': 'bearer', |
| 165 | 'name': 'JWT-auth', |
| 166 | }, |
| 167 | ], |
| 168 | ...?extra, |
| 169 | }, |
| 170 | validateStatus: validateStatus, |
| 171 | ); |
| 172 | |
| 173 | final _response = await _dio. |
| 174 | _path, |
| 175 | options: _options, |
| 176 | cancelToken: cancelToken, |
| 177 | onSendProgress: onSendProgress, |
| 178 | onReceiveProgress: onReceiveProgress, |
| 179 | ); |
| 180 | |
| 181 | FlightControllerDeleteFlightBookingV1200Response? _responseData; |
| 182 | |
| 183 | try { |
| 184 | final rawResponse = _response.data; |
| 185 | _responseData = rawResponse == null ? null |
| 186 | rawResponse, |
| 187 | specifiedType: const FullType( |
| 188 | ) as FlightControllerDeleteFlightBookingV1200Response; |
| 189 | |
| 190 | } catch (error, stackTrace) { |
| 191 | throw DioException( |
| 192 | requestOptions: _response.requestOptions, |
| 193 | response: _response, |
| 194 | type: DioExceptionType.unknown, |
| 195 | error: error, |
| 196 | stackTrace: stackTrace, |
| 197 | ); |
| 198 | } |
| 199 | |
| 200 | return Response<FlightControllerDeleteFlightBookingV1200Response |
| 201 | data: _responseData, |
| 202 | headers: _response.headers, |
| 203 | isRedirect: _response.isRedirect, |
| 204 | requestOptions: _response.requestOptions, |
| 205 | redirects: _response.redirects, |
| 206 | statusCode: _response.statusCode, |
| 207 | statusMessage: _response.statusMessage, |
| 208 | extra: _response.extra, |
| 209 | ); |
| 210 | } |
| 211 | |
| 212 | /// Get a flight booking |
| 213 | /// Get details of a specific flight booking |
| 214 | /// |
| 215 | /// Parameters: |
| 216 | /// * [bookingId] - ID of the booking to retrieve |
| 217 | /// * [cancelToken] - A [CancelToken] |
| 218 | /// * [headers] - Can be used to add additional headers to the request |
| 219 | /// * [extras] - Can be used to add flags to the request |
| 220 | /// * [validateStatus] - A [ValidateStatus] |
| 221 | /// * [onSendProgress] - A [ProgressCallback] |
| 222 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 223 | /// |
| 224 | /// Returns a [Future] containing a [Response] |
| 225 | /// Throws [DioException] if API call or serialization fails |
| 226 | Future<Response<FlightBookingEntity |
| 227 | required String bookingId, |
| 228 | CancelToken? cancelToken, |
| 229 | Map<String, dynamic |
| 230 | Map<String, dynamic |
| 231 | ValidateStatus? validateStatus, |
| 232 | ProgressCallback? onSendProgress, |
| 233 | ProgressCallback? onReceiveProgress, |
| 234 | }) async { |
| 235 | final _path = r'/v1/flight/booking/{bookingId}'.replaceAll |
| 236 | final _options = Options( |
| 237 | method: r'GET', |
| 238 | headers: <String, dynamic |
| 239 | ...?headers, |
| 240 | }, |
| 241 | extra: <String, dynamic |
| 242 | 'secure': <Map<String |
| 243 | { |
| 244 | 'type': 'http', |
| 245 | 'scheme': 'bearer', |
| 246 | 'name': 'JWT-auth', |
| 247 | }, |
| 248 | ], |
| 249 | ...?extra, |
| 250 | }, |
| 251 | validateStatus: validateStatus, |
| 252 | ); |
| 253 | |
| 254 | final _response = await _dio. |
| 255 | _path, |
| 256 | options: _options, |
| 257 | cancelToken: cancelToken, |
| 258 | onSendProgress: onSendProgress, |
| 259 | onReceiveProgress: onReceiveProgress, |
| 260 | ); |
| 261 | |
| 262 | FlightBookingEntity? _responseData; |
| 263 | |
| 264 | try { |
| 265 | final rawResponse = _response.data; |
| 266 | _responseData = rawResponse == null ? null |
| 267 | rawResponse, |
| 268 | specifiedType: const FullType( |
| 269 | ) as FlightBookingEntity; |
| 270 | |
| 271 | } catch (error, stackTrace) { |
| 272 | throw DioException( |
| 273 | requestOptions: _response.requestOptions, |
| 274 | response: _response, |
| 275 | type: DioExceptionType.unknown, |
| 276 | error: error, |
| 277 | stackTrace: stackTrace, |
| 278 | ); |
| 279 | } |
| 280 | |
| 281 | return Response<FlightBookingEntity |
| 282 | data: _responseData, |
| 283 | headers: _response.headers, |
| 284 | isRedirect: _response.isRedirect, |
| 285 | requestOptions: _response.requestOptions, |
| 286 | redirects: _response.redirects, |
| 287 | statusCode: _response.statusCode, |
| 288 | statusMessage: _response.statusMessage, |
| 289 | extra: _response.extra, |
| 290 | ); |
| 291 | } |
| 292 | |
| 293 | /// Get all bookings for a flight |
| 294 | /// Get all bookings associated with a specific flight |
| 295 | /// |
| 296 | /// Parameters: |
| 297 | /// * [flightId] - ID of the flight |
| 298 | /// * [cancelToken] - A [CancelToken] |
| 299 | /// * [headers] - Can be used to add additional headers to the request |
| 300 | /// * [extras] - Can be used to add flags to the request |
| 301 | /// * [validateStatus] - A [ValidateStatus] |
| 302 | /// * [onSendProgress] - A [ProgressCallback] |
| 303 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 304 | /// |
| 305 | /// Returns a [Future] containing a [Response] |
| 306 | /// Throws [DioException] if API call or serialization fails |
| 307 | Future<Response<BuiltList |
| 308 | required String flightId, |
| 309 | CancelToken? cancelToken, |
| 310 | Map<String, dynamic |
| 311 | Map<String, dynamic |
| 312 | ValidateStatus? validateStatus, |
| 313 | ProgressCallback? onSendProgress, |
| 314 | ProgressCallback? onReceiveProgress, |
| 315 | }) async { |
| 316 | final _path = r'/v1/flight/booking/flight/{flightId}'.replaceAll |
| 317 | final _options = Options( |
| 318 | method: r'GET', |
| 319 | headers: <String, dynamic |
| 320 | ...?headers, |
| 321 | }, |
| 322 | extra: <String, dynamic |
| 323 | 'secure': <Map<String |
| 324 | { |
| 325 | 'type': 'http', |
| 326 | 'scheme': 'bearer', |
| 327 | 'name': 'JWT-auth', |
| 328 | }, |
| 329 | ], |
| 330 | ...?extra, |
| 331 | }, |
| 332 | validateStatus: validateStatus, |
| 333 | ); |
| 334 | |
| 335 | final _response = await _dio. |
| 336 | _path, |
| 337 | options: _options, |
| 338 | cancelToken: cancelToken, |
| 339 | onSendProgress: onSendProgress, |
| 340 | onReceiveProgress: onReceiveProgress, |
| 341 | ); |
| 342 | |
| 343 | BuiltList<FlightBookingEntity>? _responseData |
| 344 | |
| 345 | try { |
| 346 | final rawResponse = _response.data; |
| 347 | _responseData = rawResponse == null ? null |
| 348 | rawResponse, |
| 349 | specifiedType: const FullType( |
| 350 | ) as BuiltList<FlightBookingEntity> |
| 351 | |
| 352 | } catch (error, stackTrace) { |
| 353 | throw DioException( |
| 354 | requestOptions: _response.requestOptions, |
| 355 | response: _response, |
| 356 | type: DioExceptionType.unknown, |
| 357 | error: error, |
| 358 | stackTrace: stackTrace, |
| 359 | ); |
| 360 | } |
| 361 | |
| 362 | return Response<BuiltList |
| 363 | data: _responseData, |
| 364 | headers: _response.headers, |
| 365 | isRedirect: _response.isRedirect, |
| 366 | requestOptions: _response.requestOptions, |
| 367 | redirects: _response.redirects, |
| 368 | statusCode: _response.statusCode, |
| 369 | statusMessage: _response.statusMessage, |
| 370 | extra: _response.extra, |
| 371 | ); |
| 372 | } |
| 373 | |
| 374 | /// Get flight track/path |
| 375 | /// Get the flight path with all position data points for a specific flight |
| 376 | /// |
| 377 | /// Parameters: |
| 378 | /// * [iata] - IATA flight number |
| 379 | /// * [icao] - ICAO flight number |
| 380 | /// * [timezone] - The timezone from which the request is being made. |
| 381 | /// * [date] - Flight date (ISO format). Defaults to current date if not provided |
| 382 | /// * [cancelToken] - A [CancelToken] |
| 383 | /// * [headers] - Can be used to add additional headers to the request |
| 384 | /// * [extras] - Can be used to add flags to the request |
| 385 | /// * [validateStatus] - A [ValidateStatus] |
| 386 | /// * [onSendProgress] - A [ProgressCallback] |
| 387 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 388 | /// |
| 389 | /// Returns a [Future] containing a [Response] |
| 390 | /// Throws [DioException] if API call or serialization fails |
| 391 | Future<Response<FlightTrackResponseEntity |
| 392 | required String iata, |
| 393 | required String icao, |
| 394 | required String timezone, |
| 395 | String? date, |
| 396 | CancelToken? cancelToken, |
| 397 | Map<String, dynamic |
| 398 | Map<String, dynamic |
| 399 | ValidateStatus? validateStatus, |
| 400 | ProgressCallback? onSendProgress, |
| 401 | ProgressCallback? onReceiveProgress, |
| 402 | }) async { |
| 403 | final _path = r'/v1/flight/track'; |
| 404 | final _options = Options( |
| 405 | method: r'GET', |
| 406 | headers: <String, dynamic |
| 407 | ...?headers, |
| 408 | }, |
| 409 | extra: <String, dynamic |
| 410 | 'secure': <Map<String |
| 411 | { |
| 412 | 'type': 'http', |
| 413 | 'scheme': 'bearer', |
| 414 | 'name': 'JWT-auth', |
| 415 | }, |
| 416 | ], |
| 417 | ...?extra, |
| 418 | }, |
| 419 | validateStatus: validateStatus, |
| 420 | ); |
| 421 | |
| 422 | final _queryParameters = <String |
| 423 | r'iata': encodeQueryParameter(_serializers, iata |
| 424 | r'icao': encodeQueryParameter(_serializers, icao |
| 425 | if (date != null) r'date': |
| 426 | r'timezone': encodeQueryParameter(_serializers, timezone |
| 427 | }; |
| 428 | |
| 429 | final _response = await _dio. |
| 430 | _path, |
| 431 | options: _options, |
| 432 | queryParameters: _queryParameters, |
| 433 | cancelToken: cancelToken, |
| 434 | onSendProgress: onSendProgress, |
| 435 | onReceiveProgress: onReceiveProgress, |
| 436 | ); |
| 437 | |
| 438 | FlightTrackResponseEntity? _responseData; |
| 439 | |
| 440 | try { |
| 441 | final rawResponse = _response.data; |
| 442 | _responseData = rawResponse == null ? null |
| 443 | rawResponse, |
| 444 | specifiedType: const FullType( |
| 445 | ) as FlightTrackResponseEntity; |
| 446 | |
| 447 | } catch (error, stackTrace) { |
| 448 | throw DioException( |
| 449 | requestOptions: _response.requestOptions, |
| 450 | response: _response, |
| 451 | type: DioExceptionType.unknown, |
| 452 | error: error, |
| 453 | stackTrace: stackTrace, |
| 454 | ); |
| 455 | } |
| 456 | |
| 457 | return Response<FlightTrackResponseEntity |
| 458 | data: _responseData, |
| 459 | headers: _response.headers, |
| 460 | isRedirect: _response.isRedirect, |
| 461 | requestOptions: _response.requestOptions, |
| 462 | redirects: _response.redirects, |
| 463 | statusCode: _response.statusCode, |
| 464 | statusMessage: _response.statusMessage, |
| 465 | extra: _response.extra, |
| 466 | ); |
| 467 | } |
| 468 | |
| 469 | /// Get flight details |
| 470 | /// Get detailed information about a specific flight including real-time tracking data. Use faFlightId to fetch a specific flight after searching. |
| 471 | /// |
| 472 | /// Parameters: |
| 473 | /// * [iata] - IATA flight number |
| 474 | /// * [icao] - ICAO flight number |
| 475 | /// * [timezone] - The timezone from which the request is being made. |
| 476 | /// * [date] - Flight date (ISO format). Defaults to current date if not provided |
| 477 | /// * [forceUpdate] - Force update the flight data(used to refresh the flight data) |
| 478 | /// * [faFlightId] - FlightAware flight ID to fetch a specific flight. Use this after searching for flights to get details of a selected flight. |
| 479 | /// * [cancelToken] - A [CancelToken] |
| 480 | /// * [headers] - Can be used to add additional headers to the request |
| 481 | /// * [extras] - Can be used to add flags to the request |
| 482 | /// * [validateStatus] - A [ValidateStatus] |
| 483 | /// * [onSendProgress] - A [ProgressCallback] |
| 484 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 485 | /// |
| 486 | /// Returns a [Future] containing a [Response] |
| 487 | /// Throws [DioException] if API call or serialization fails |
| 488 | Future<Response<FlightResponseEntity |
| 489 | required String iata, |
| 490 | required String icao, |
| 491 | required String timezone, |
| 492 | String? date, |
| 493 | bool? forceUpdate = false, |
| 494 | String? faFlightId, |
| 495 | CancelToken? cancelToken, |
| 496 | Map<String, dynamic |
| 497 | Map<String, dynamic |
| 498 | ValidateStatus? validateStatus, |
| 499 | ProgressCallback? onSendProgress, |
| 500 | ProgressCallback? onReceiveProgress, |
| 501 | }) async { |
| 502 | final _path = r'/v1/flight'; |
| 503 | final _options = Options( |
| 504 | method: r'GET', |
| 505 | headers: <String, dynamic |
| 506 | ...?headers, |
| 507 | }, |
| 508 | extra: <String, dynamic |
| 509 | 'secure': <Map<String |
| 510 | { |
| 511 | 'type': 'http', |
| 512 | 'scheme': 'bearer', |
| 513 | 'name': 'JWT-auth', |
| 514 | }, |
| 515 | ], |
| 516 | ...?extra, |
| 517 | }, |
| 518 | validateStatus: validateStatus, |
| 519 | ); |
| 520 | |
| 521 | final _queryParameters = <String |
| 522 | r'iata': encodeQueryParameter(_serializers, iata |
| 523 | r'icao': encodeQueryParameter(_serializers, icao |
| 524 | if (date != null) r'date': |
| 525 | r'timezone': encodeQueryParameter(_serializers, timezone |
| 526 | if (forceUpdate != null) r'forceUpdate': |
| 527 | if (faFlightId != null) r'faFlightId': |
| 528 | }; |
| 529 | |
| 530 | final _response = await _dio. |
| 531 | _path, |
| 532 | options: _options, |
| 533 | queryParameters: _queryParameters, |
| 534 | cancelToken: cancelToken, |
| 535 | onSendProgress: onSendProgress, |
| 536 | onReceiveProgress: onReceiveProgress, |
| 537 | ); |
| 538 | |
| 539 | FlightResponseEntity? _responseData; |
| 540 | |
| 541 | try { |
| 542 | final rawResponse = _response.data; |
| 543 | _responseData = rawResponse == null ? null |
| 544 | rawResponse, |
| 545 | specifiedType: const FullType( |
| 546 | ) as FlightResponseEntity; |
| 547 | |
| 548 | } catch (error, stackTrace) { |
| 549 | throw DioException( |
| 550 | requestOptions: _response.requestOptions, |
| 551 | response: _response, |
| 552 | type: DioExceptionType.unknown, |
| 553 | error: error, |
| 554 | stackTrace: stackTrace, |
| 555 | ); |
| 556 | } |
| 557 | |
| 558 | return Response<FlightResponseEntity |
| 559 | data: _responseData, |
| 560 | headers: _response.headers, |
| 561 | isRedirect: _response.isRedirect, |
| 562 | requestOptions: _response.requestOptions, |
| 563 | redirects: _response.redirects, |
| 564 | statusCode: _response.statusCode, |
| 565 | statusMessage: _response.statusMessage, |
| 566 | extra: _response.extra, |
| 567 | ); |
| 568 | } |
| 569 | |
| 570 | /// Search flights |
| 571 | /// Search for flights by identifier and optional date. Returns lightweight flight summaries for selection. |
| 572 | /// |
| 573 | /// Parameters: |
| 574 | /// * [iata] - IATA flight number |
| 575 | /// * [icao] - ICAO flight number |
| 576 | /// * [timezone] - The timezone from which the request is being made. |
| 577 | /// * [date] - Flight date (ISO format). Filters flights by date if provided |
| 578 | /// * [cancelToken] - A [CancelToken] |
| 579 | /// * [headers] - Can be used to add additional headers to the request |
| 580 | /// * [extras] - Can be used to add flags to the request |
| 581 | /// * [validateStatus] - A [ValidateStatus] |
| 582 | /// * [onSendProgress] - A [ProgressCallback] |
| 583 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 584 | /// |
| 585 | /// Returns a [Future] containing a [Response] |
| 586 | /// Throws [DioException] if API call or serialization fails |
| 587 | Future<Response<FlightSearchResponseEntity |
| 588 | required String iata, |
| 589 | required String icao, |
| 590 | required String timezone, |
| 591 | String? date, |
| 592 | CancelToken? cancelToken, |
| 593 | Map<String, dynamic |
| 594 | Map<String, dynamic |
| 595 | ValidateStatus? validateStatus, |
| 596 | ProgressCallback? onSendProgress, |
| 597 | ProgressCallback? onReceiveProgress, |
| 598 | }) async { |
| 599 | final _path = r'/v1/flight/search'; |
| 600 | final _options = Options( |
| 601 | method: r'GET', |
| 602 | headers: <String, dynamic |
| 603 | ...?headers, |
| 604 | }, |
| 605 | extra: <String, dynamic |
| 606 | 'secure': <Map<String |
| 607 | { |
| 608 | 'type': 'http', |
| 609 | 'scheme': 'bearer', |
| 610 | 'name': 'JWT-auth', |
| 611 | }, |
| 612 | ], |
| 613 | ...?extra, |
| 614 | }, |
| 615 | validateStatus: validateStatus, |
| 616 | ); |
| 617 | |
| 618 | final _queryParameters = <String |
| 619 | r'iata': encodeQueryParameter(_serializers, iata |
| 620 | r'icao': encodeQueryParameter(_serializers, icao |
| 621 | if (date != null) r'date': |
| 622 | r'timezone': encodeQueryParameter(_serializers, timezone |
| 623 | }; |
| 624 | |
| 625 | final _response = await _dio. |
| 626 | _path, |
| 627 | options: _options, |
| 628 | queryParameters: _queryParameters, |
| 629 | cancelToken: cancelToken, |
| 630 | onSendProgress: onSendProgress, |
| 631 | onReceiveProgress: onReceiveProgress, |
| 632 | ); |
| 633 | |
| 634 | FlightSearchResponseEntity? _responseData; |
| 635 | |
| 636 | try { |
| 637 | final rawResponse = _response.data; |
| 638 | _responseData = rawResponse == null ? null |
| 639 | rawResponse, |
| 640 | specifiedType: const FullType( |
| 641 | ) as FlightSearchResponseEntity; |
| 642 | |
| 643 | } catch (error, stackTrace) { |
| 644 | throw DioException( |
| 645 | requestOptions: _response.requestOptions, |
| 646 | response: _response, |
| 647 | type: DioExceptionType.unknown, |
| 648 | error: error, |
| 649 | stackTrace: stackTrace, |
| 650 | ); |
| 651 | } |
| 652 | |
| 653 | return Response<FlightSearchResponseEntity |
| 654 | data: _responseData, |
| 655 | headers: _response.headers, |
| 656 | isRedirect: _response.isRedirect, |
| 657 | requestOptions: _response.requestOptions, |
| 658 | redirects: _response.redirects, |
| 659 | statusCode: _response.statusCode, |
| 660 | statusMessage: _response.statusMessage, |
| 661 | extra: _response.extra, |
| 662 | ); |
| 663 | } |
| 664 | |
| 665 | /// Update a flight booking |
| 666 | /// Update an existing flight booking |
| 667 | /// |
| 668 | /// Parameters: |
| 669 | /// * [bookingId] - ID of the booking to update |
| 670 | /// * [updateFlightBookingDTO] |
| 671 | /// * [cancelToken] - A [CancelToken] |
| 672 | /// * [headers] - Can be used to add additional headers to the request |
| 673 | /// * [extras] - Can be used to add flags to the request |
| 674 | /// * [validateStatus] - A [ValidateStatus] |
| 675 | /// * [onSendProgress] - A [ProgressCallback] |
| 676 | /// * [onReceiveProgress] - A [ProgressCallback] |
| 677 | /// |
| 678 | /// Returns a [Future] containing a [Response] |
| 679 | /// Throws [DioException] if API call or serialization fails |
| 680 | Future<Response<FlightBookingEntity |
| 681 | required String bookingId, |
| 682 | required UpdateFlightBookingDTO updateFlightBookingDTO, |
| 683 | CancelToken? cancelToken, |
| 684 | Map<String, dynamic |
| 685 | Map<String, dynamic |
| 686 | ValidateStatus? validateStatus, |
| 687 | ProgressCallback? onSendProgress, |
| 688 | ProgressCallback? onReceiveProgress, |
| 689 | }) async { |
| 690 | final _path = r'/v1/flight/booking/{bookingId}'.replaceAll |
| 691 | final _options = Options( |
| 692 | method: r'PUT', |
| 693 | headers: <String, dynamic |
| 694 | ...?headers, |
| 695 | }, |
| 696 | extra: <String, dynamic |
| 697 | 'secure': <Map<String |
| 698 | { |
| 699 | 'type': 'http', |
| 700 | 'scheme': 'bearer', |
| 701 | 'name': 'JWT-auth', |
| 702 | }, |
| 703 | ], |
| 704 | ...?extra, |
| 705 | }, |
| 706 | contentType: 'application/json', |
| 707 | validateStatus: validateStatus, |
| 708 | ); |
| 709 | |
| 710 | dynamic _bodyData; |
| 711 | |
| 712 | try { |
| 713 | const _type = FullType( |
| 714 | _bodyData = _serializers.serialize(updateFlightBookingDTO, specifiedType |
| 715 | |
| 716 | } catch(error, stackTrace) { |
| 717 | throw DioException( |
| 718 | requestOptions: _options.compose( |
| 719 | _dio.options, |
| 720 | _path, |
| 721 | ), |
| 722 | type: DioExceptionType.unknown, |
| 723 | error: error, |
| 724 | stackTrace: stackTrace, |
| 725 | ); |
| 726 | } |
| 727 | |
| 728 | final _response = await _dio. |
| 729 | _path, |
| 730 | data: _bodyData, |
| 731 | options: _options, |
| 732 | cancelToken: cancelToken, |
| 733 | onSendProgress: onSendProgress, |
| 734 | onReceiveProgress: onReceiveProgress, |
| 735 | ); |
| 736 | |
| 737 | FlightBookingEntity? _responseData; |
| 738 | |
| 739 | try { |
| 740 | final rawResponse = _response.data; |
| 741 | _responseData = rawResponse == null ? null |
| 742 | rawResponse, |
| 743 | specifiedType: const FullType( |
| 744 | ) as FlightBookingEntity; |
| 745 | |
| 746 | } catch (error, stackTrace) { |
| 747 | throw DioException( |
| 748 | requestOptions: _response.requestOptions, |
| 749 | response: _response, |
| 750 | type: DioExceptionType.unknown, |
| 751 | error: error, |
| 752 | stackTrace: stackTrace, |
| 753 | ); |
| 754 | } |
| 755 | |
| 756 | return Response<FlightBookingEntity |
| 757 | data: _responseData, |
| 758 | headers: _response.headers, |
| 759 | isRedirect: _response.isRedirect, |
| 760 | requestOptions: _response.requestOptions, |
| 761 | redirects: _response.redirects, |
| 762 | statusCode: _response.statusCode, |
| 763 | statusMessage: _response.statusMessage, |
| 764 | extra: _response.extra, |
| 765 | ); |
| 766 | } |
| 767 | |
| 768 | } |