getAircraftWithHttpInfo method
- AircraftSearchByEnum searchBy,
- String searchParam, {
- bool? withImage,
- bool? withRegistrations,
Single aircraft (by tail-number, Mode-S or ID) TIER 1
Returns: Single aircraft, best matching specified search criteria, if found. 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
searchByis: *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), multiple matches are possible - see below; *icao24, then this field should be a ICAO 24-bit Mode-S address of an aircraft specified in hexadecimal format (e.g. 484161, 483EFD), multiple matches are possible - see below. If multiple matches are possible: There cannot be more than one aircraft actively flying with the same tail-number or ICAO 24-bit Mode-S address at any moment of time. However, historically aircraft tail-numbers or addresses may be used multiple times by different aircraft. This endpoint is supposed to return a single aircraft data. In case if multiple aircraft satisfy the search criteria, the best match will be chosen as follows: * If an active aircraft is found according to the requested critera, it is returned. * Otherwise, an aircraft that used requested tail-number/address the most recently is returned. * If usage time may not be determined, the aircraft stored in the database the most recently is returned. -
bool withImage: Should include aircraft image (default: false).
-
bool withRegistrations: Should include the history of aircraft registrations (default: false).
Implementation
Future<Response> getAircraftWithHttpInfo(
AircraftSearchByEnum searchBy,
String searchParam, {
bool? withImage,
bool? withRegistrations,
}) async {
// ignore: prefer_const_declarations
final path = r'/aircrafts/{searchBy}/{searchParam}'
.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,
);
}