#' @title
#' put /traits/\{traitDbId\}
#'
#' @description
#' Update an existing Trait
#'
#' @param con list; required: TRUE; BrAPI connection object
#' @param traitDbId character; required: TRUE; the internal database identifier of the trait to be updated; default: ""
#' @param alternativeAbbreviations vector of type character; required: FALSE; Other frequent abbreviations of the trait, if any. These abbreviations do not have to follow a convention; default: "", when using multiple values supply as c("value1", "value2").
#' @param attribute character; required: FALSE; A trait can be decomposed as "Trait" = "Entity" + "Attribute", the attribute is the observed feature (or characteristic) of the entity e.g., for "grain colour", attribute = "colour"; default: "".
#' @param class character; required: FALSE; Trait class. (examples: "morphological trait", "phenological trait", "agronomical trait", "physiological trait", "abiotic stress trait", "biotic stress trait", "biochemical trait", "quality traits trait", "fertility trait", etc.); default: "".
#' @param description character; required: FALSE; The description of a trait; default: "".
#' @param entity character; required: FALSE; A trait can be decomposed as "Trait" = "Entity" + "Attribute", the entity is the part of the plant that the trait refers to e.g., for "grain colour", entity = "grain"; default: "".
#' @param mainAbbreviation character; required: FALSE; Main abbreviation for trait name. (examples: "Carotenoid content" => "CC"); default: "".
#' @param ontologyReference list; required: FALSE; The ontologyReference list should contain links to various ontology documentation (URL and type) supplied as a dataframe, an unique ontology database identifier, an ontology name and an ontology version (no specific format). In the Examples section an example on how to specify this list is provided; default: list()
#' @param status character; required: FALSE; Trait status (examples: "recommended", "obsolete", "legacy", etc.); default: "".
#' @param synonyms vector of type character; required: FALSE; Other trait names; default: "", when using multiple values supply as c("value1", "value2").
#' @param traitName character; required: FALSE; The human readable name of a trait; default: "".
#' @param xref character; required: FALSE; Cross reference of the trait to an external ontology or database term e.g., Xref to a trait ontology (TO) term; default: "".
#'
#' @details Update an existing trait
#'
#' @return data.frame
#'
#' @author brapir generator package
#'
#' @references \href{https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3#/Observation%20Variables/put_traits__traitDbId_ }{BrAPI SwaggerHub}
#'
#' @family brapi_1.3
#' @family Observation Variables
#'
#' @examples
#' \dontrun{
#'
#' # Create a connection object
#' con <- brapi_db()$testserver
#'
#' # Create an ontologyReference example list object for the traitDbId to be updated
#' # ontologyDbId should be specified as an existing one (see get /ontologies) or
#' # left empty (some servers might generate a new ontologyDbId).
#' ontologyReference <- list(
#' documentationLinks = data.frame(URL = "https://Ontology.org/s6",
#' type = "RDF"),
#' ontologyDbId = "MO_123",
#' ontologyName = "Ontology.org",
#' version = "17")
#'
#' # Make post /traits call
#' brapi_put_traits_traitDbId(con = con,
#' traitDbId = "", # retrieve from brapi_get_traits()
#' alternativeAbbreviations = c("clothSizes", "sizesCloth"),
#' attribute = "size",
#' class = "physiological trait",
#' description = "Size designation of clothes",
#' entity = "clothing",
#' mainAbbreviation = "CS",
#' ontologyReference = ontologyReference,
#' status = "legacy",
#' synonyms = c("sizeClothing", "cSizes"),
#' traitName = "clothingSize",
#' xref = "xref")
#' }
#'
#' @export
brapi_put_traits_traitDbId <- function(con = NULL, traitDbId = '', alternativeAbbreviations = '', attribute = '', class = '', description = '', entity = '', mainAbbreviation = '', ontologyReference = list(), status = '', synonyms = '', traitName = '', xref = '') {
## Create a list of used arguments
usedArgs <- brapi_usedArgs(origValues = FALSE)
## Check if BrAPI server can be reached given the connection details
brapi_checkCon(con = usedArgs[["con"]], verbose = FALSE)
## Check validity of used and required arguments
brapi_checkArgs(usedArgs, reqArgs = "traitDbId")
## Obtain the call url
callurl <- brapi_PUT_callURL(usedArgs = usedArgs,
callPath = "/traits/{traitDbId}",
reqArgs = "traitDbId",
packageName = "BrAPI",
callVersion = 1.3)
## Build the Body
callbody <- brapi_PUT_callBody(usedArgs = usedArgs,
reqArgs = "traitDbId")
try({
## Make the call and receive the response
resp <- brapi_PUT(url = callurl, body = callbody, usedArgs = usedArgs)
## Extract the content from the response object in human readable form
cont <- httr::content(x = resp, as = "text", encoding = "UTF-8")
## Convert the content object into a data.frame
out <- brapi_result2df(cont, usedArgs)
})
## Set class of output
class(out) <- c(class(out), "brapi_put_traits_traitDbId")
## Show pagination information from metadata
brapi_serverinfo_metadata(cont)
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.