R/fse_aircraft.R

Defines functions fse_aircraft_for_sale fse_icao_aircraft fse_aircraft_by_owner_name fse_aircraft_by_key fse_aircraft_by_makemodel

Documented in fse_aircraft_by_key fse_aircraft_by_makemodel fse_aircraft_by_owner_name fse_aircraft_for_sale fse_icao_aircraft

#' Query FSE aircraft
#'
#' @description Functions for querying FSE aircraft.
#'
#' @description - `fse_aircraft_by_makemodel` queries aircraft by model name
#'
#' @param makemodel character, aircraft model name, see Details
#'
#' @details For [fse_aircraft_by_makemodel()], to get a list of valid model
#'   names that can be submitted to \code{makemodel} fetch aircraft configs with
#'   [fse_aircraft_configs()] or go to FSE system WWW page, "Aircraft" menu,
#'   "Purchase aircraft" item and check the dropdown list after selecting "By
#'   model" radio button.
#'
#' @template feed2
#'
#' @return All these function return data.frame/XML with the following columns/tags:
#'
#' @return - `SerialNumber` -- Aircraft serial number
#' - `MakeModel` -- Aircraft model name
#' - `Registration` -- Registration number
#' - `Owner`
#' - `Location`
#' - `LocationName`
#' - `Home`
#' - `SalePrice`
#' - `SellbackPrice`
#' - `Equipment`
#' - `RentalDry`
#' - `RentalWet`
#' - `Bonus`
#' - `RentalTime`
#' - `RentedBy`
#' - `PctFuel`
#' - `NeedsRepair`
#' - `AirframeTime`
#' - `EngineTime`
#' - `TimeLast100hr`
#' - `LeasedFrom`
#' - `MonthlyFee`
#' - `FeeOwed`
#'
#'
#' @name fse_aircraft
#' @export
#'
#' @examples
#' \dontrun{
#' r <- fse_aircraft_by_makemodel("Cessna 172 Skyhawk")
#' }

fse_aircraft_by_makemodel <- function(makemodel, ...) {
  fse_api(
    query="aircraft",
    search="makemodel",
    makemodel=makemodel,
    ...
  )$content
}




#' @rdname fse_aircraft
#'
#' @description - `fse_aircraft_by_key` queries for aircraft associated to an
#'   FSE read access key
#'
#' @param accesskey FSE read access key
#'
#' @export
fse_aircraft_by_key <- function(accesskey, ...) {
  fse_api(
    query="aircraft",
    search="key",
    readaccesskey=accesskey,
    ...
  )$content
}


#' @rdname fse_aircraft
#'
#' @description - `fse_aircraft_by_owner_name` query aircraft by owner name
#'
#' @param ownername character, FSE account name
#'
#' @export

fse_aircraft_by_owner_name <- function(ownername, ...) {
  fse_api(
    query="aircraft",
    search="ownername",
    ownername=ownername,
    ...
  )$content
}


#' @rdname fse_aircraft
#'
#' @description - `fse_icao_aircraft` -- List of aircraft at ICAO
#'
#' @param icao airport ICAO code
#'
#' @export
#'
#' @examples
#' \dontrun{
#' r <- fse_icao_aircraft("epbc")
#' }
fse_icao_aircraft <- function(icao, ...) {
  fse_api(
    query="icao",
    search="aircraft",
    icao = icao,
    ...
  )$content
}





#' @rdname fse_aircraft
#'
#' @description - [fse_aircraft_for_sale()] -- List aircraft currently for sale
#'
#' @export
fse_aircraft_for_sale <- function(...) {
  fse_api(
    query="aircraft",
    search="forsale",
    ...
  )$content
}
rfse/fse documentation built on Jan. 25, 2022, 5:54 a.m.