getAllAircraftWithHttpInfo method

Future<Response> getAllAircraftWithHttpInfo(
  1. AircraftSearchByEnum searchBy,
  2. String searchParam, {
  3. bool? withImage,
  4. bool? withRegistrations,
})

All aircraft (by tail-number, Mode-S or ID) TIER 1

Returns: A list of all aircraft ever matched the requested criteria. Please note that all found aircraft will be impersonated with registration information matching the requested tail number or Mode-S even though an aircraft might be flying under a different registration right now.

Note: This method returns the HTTP Response.

Parameters:

  • AircraftSearchByEnum searchBy (required): Criteria to search aircraft by

  • String searchParam (required): Value of the search criteria. If searchBy is: * id, then this field should be an ID of an aircraft (as specified in the database of this API); * reg, then this field should be a tail-number of an aircraft (with or without spaces or dashes, any case formats are acceptable, e.g.PH-BXO, DeMhJ); * icao24, then this field should be a ICAO 24-bit Mode-S address of an aircraft specified in hexadecimal format (e.g. 484161, 483EFD).

  • bool withImage: Should include aircraft image (default: false).

  • bool withRegistrations: Should include the history of aircraft registrations (default: false).

Implementation

Future<Response> getAllAircraftWithHttpInfo(
  AircraftSearchByEnum searchBy,
  String searchParam, {
  bool? withImage,
  bool? withRegistrations,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/aircrafts/{searchBy}/{searchParam}/all'
      .replaceAll('{searchBy}', searchBy.toString())
      .replaceAll('{searchParam}', searchParam);

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (withImage != null) {
    queryParams.addAll(_queryParams('', 'withImage', withImage));
  }
  if (withRegistrations != null) {
    queryParams
        .addAll(_queryParams('', 'withRegistrations', withRegistrations));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}