# Netherlands Biodiversity API
#
# Access to the digitised Natural History collection at the Naturalis Biodiversity Center
#
# OpenAPI spec version: v2
# Contact: support@naturalis.nl
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#'
#' @docType class
#'
#' @format R6 class
#'
#' @usage
#' # SummaryScientificName$new()
#'
#' @format
#' R6 class
#'
#' @title SummaryScientificName Class
#'
#' @description
#' For more information on the NBA object model, please refer to the
#' official NBA documentation at
#' \href{https://docs.biodiversitydata.nl}{https://docs.biodiversitydata.nl} and
#' the NBA model and endpoints reference at
#' \href{https://docs.biodiversitydata.nl/endpoints-reference}{https://docs.biodiversitydata.nl/endpoints-reference}.
#'
#' @details Model class for SummaryScientificName objects.
#'
#'
#' @field fullScientificName character
#'
#' @field taxonomicStatus character
#'
#' @field genusOrMonomial character
#'
#' @field subgenus character
#'
#' @field specificEpithet character
#'
#' @field infraspecificEpithet character
#'
#' @field authorshipVerbatim character
#'
#'
#'
#' @section Methods:
#' \describe{
#'
#' \item{\code{$new()}}{
#'
#' Constructor SummaryScientificName object.
#'
#' }
#' \item{\code{$fromList(SummaryScientificNameList)}}{
#'
#' Create SummaryScientificName object from list.
#'
#' }
#'
#' \item{\code{$toList()}}{
#'
#' Get list representation of SummaryScientificName.
#'
#' }
#' \item{\code{fromJSONString(SummaryScientificNameJson)}}{
#'
#' Create SummaryScientificName object from JSON.
#'
#' }
#' \item{\code{toJSONString(pretty=TRUE)}}{
#'
#' Get JSON representation of SummaryScientificName.
#'
#' }
#' }
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SummaryScientificName <- R6::R6Class(
"SummaryScientificName",
public = list(
`fullScientificName` = NULL,
`taxonomicStatus` = NULL,
`genusOrMonomial` = NULL,
`subgenus` = NULL,
`specificEpithet` = NULL,
`infraspecificEpithet` = NULL,
`authorshipVerbatim` = NULL,
initialize = function(
`fullScientificName`,
`taxonomicStatus`,
`genusOrMonomial`,
`subgenus`,
`specificEpithet`,
`infraspecificEpithet`,
`authorshipVerbatim`) {
if (!missing(`fullScientificName`)) {
stopifnot(
is.character(`fullScientificName`),
length(`fullScientificName`) == 1
)
self[["fullScientificName"]] <- `fullScientificName`
}
if (!missing(`taxonomicStatus`)) {
stopifnot(
is.character(`taxonomicStatus`),
length(`taxonomicStatus`) == 1
)
self[["taxonomicStatus"]] <- `taxonomicStatus`
}
if (!missing(`genusOrMonomial`)) {
stopifnot(
is.character(`genusOrMonomial`),
length(`genusOrMonomial`) == 1
)
self[["genusOrMonomial"]] <- `genusOrMonomial`
}
if (!missing(`subgenus`)) {
stopifnot(
is.character(`subgenus`),
length(`subgenus`) == 1
)
self[["subgenus"]] <- `subgenus`
}
if (!missing(`specificEpithet`)) {
stopifnot(
is.character(`specificEpithet`),
length(`specificEpithet`) == 1
)
self[["specificEpithet"]] <- `specificEpithet`
}
if (!missing(`infraspecificEpithet`)) {
stopifnot(
is.character(`infraspecificEpithet`),
length(`infraspecificEpithet`) == 1
)
self[["infraspecificEpithet"]] <- `infraspecificEpithet`
}
if (!missing(`authorshipVerbatim`)) {
stopifnot(
is.character(`authorshipVerbatim`),
length(`authorshipVerbatim`) == 1
)
self[["authorshipVerbatim"]] <- `authorshipVerbatim`
}
},
toList = function() {
SummaryScientificNameList <- list()
if (!is.null(self[["fullScientificName"]])) {
SummaryScientificNameList[["fullScientificName"]] <-
self[["fullScientificName"]]
}
if (!is.null(self[["taxonomicStatus"]])) {
SummaryScientificNameList[["taxonomicStatus"]] <-
self[["taxonomicStatus"]]
}
if (!is.null(self[["genusOrMonomial"]])) {
SummaryScientificNameList[["genusOrMonomial"]] <-
self[["genusOrMonomial"]]
}
if (!is.null(self[["subgenus"]])) {
SummaryScientificNameList[["subgenus"]] <-
self[["subgenus"]]
}
if (!is.null(self[["specificEpithet"]])) {
SummaryScientificNameList[["specificEpithet"]] <-
self[["specificEpithet"]]
}
if (!is.null(self[["infraspecificEpithet"]])) {
SummaryScientificNameList[["infraspecificEpithet"]] <-
self[["infraspecificEpithet"]]
}
if (!is.null(self[["authorshipVerbatim"]])) {
SummaryScientificNameList[["authorshipVerbatim"]] <-
self[["authorshipVerbatim"]]
}
## omit empty nested lists in returned list
SummaryScientificNameList[vapply(
SummaryScientificNameList,
length,
FUN.VALUE = integer(1)
) > 0]
},
fromList = function(SummaryScientificNameList,
typeMapping = NULL) {
self[["fullScientificName"]] <-
SummaryScientificNameList[["fullScientificName"]]
self[["taxonomicStatus"]] <-
SummaryScientificNameList[["taxonomicStatus"]]
self[["genusOrMonomial"]] <-
SummaryScientificNameList[["genusOrMonomial"]]
self[["subgenus"]] <-
SummaryScientificNameList[["subgenus"]]
self[["specificEpithet"]] <-
SummaryScientificNameList[["specificEpithet"]]
self[["infraspecificEpithet"]] <-
SummaryScientificNameList[["infraspecificEpithet"]]
self[["authorshipVerbatim"]] <-
SummaryScientificNameList[["authorshipVerbatim"]]
invisible(self)
},
toJSONString = function(pretty = TRUE) {
jsonlite::toJSON(
self$toList(),
simplifyVector = TRUE,
auto_unbox = TRUE,
pretty = pretty
)
},
fromJSONString = function(SummaryScientificNameJson,
typeMapping = NULL) {
SummaryScientificNameList <- jsonlite::fromJSON(
SummaryScientificNameJson,
simplifyVector = FALSE
)
self <- self$fromList(SummaryScientificNameList)
invisible(self)
},
print = function(...) {
## print class name
cat("<SummaryScientificName>\n")
## print all members with values
cat("Fields:\n")
if (typeof(self$fullScientificName) == "environment") {
cat("\tfullScientificName:\tobject of class", paste0("<", class(self$fullScientificName)[1], ">"), "\n")
}
else if (typeof(self$fullScientificName) == "list") {
cat("\tfullScientificName:\tlist of length", length(self$fullScientificName), "\n")
}
else {
cat("\tfullScientificName:\t", self$fullScientificName, "\n")
}
if (typeof(self$taxonomicStatus) == "environment") {
cat("\ttaxonomicStatus:\tobject of class", paste0("<", class(self$taxonomicStatus)[1], ">"), "\n")
}
else if (typeof(self$taxonomicStatus) == "list") {
cat("\ttaxonomicStatus:\tlist of length", length(self$taxonomicStatus), "\n")
}
else {
cat("\ttaxonomicStatus:\t", self$taxonomicStatus, "\n")
}
if (typeof(self$genusOrMonomial) == "environment") {
cat("\tgenusOrMonomial:\tobject of class", paste0("<", class(self$genusOrMonomial)[1], ">"), "\n")
}
else if (typeof(self$genusOrMonomial) == "list") {
cat("\tgenusOrMonomial:\tlist of length", length(self$genusOrMonomial), "\n")
}
else {
cat("\tgenusOrMonomial:\t", self$genusOrMonomial, "\n")
}
if (typeof(self$subgenus) == "environment") {
cat("\tsubgenus:\tobject of class", paste0("<", class(self$subgenus)[1], ">"), "\n")
}
else if (typeof(self$subgenus) == "list") {
cat("\tsubgenus:\tlist of length", length(self$subgenus), "\n")
}
else {
cat("\tsubgenus:\t", self$subgenus, "\n")
}
if (typeof(self$specificEpithet) == "environment") {
cat("\tspecificEpithet:\tobject of class", paste0("<", class(self$specificEpithet)[1], ">"), "\n")
}
else if (typeof(self$specificEpithet) == "list") {
cat("\tspecificEpithet:\tlist of length", length(self$specificEpithet), "\n")
}
else {
cat("\tspecificEpithet:\t", self$specificEpithet, "\n")
}
if (typeof(self$infraspecificEpithet) == "environment") {
cat("\tinfraspecificEpithet:\tobject of class", paste0("<", class(self$infraspecificEpithet)[1], ">"), "\n")
}
else if (typeof(self$infraspecificEpithet) == "list") {
cat("\tinfraspecificEpithet:\tlist of length", length(self$infraspecificEpithet), "\n")
}
else {
cat("\tinfraspecificEpithet:\t", self$infraspecificEpithet, "\n")
}
if (typeof(self$authorshipVerbatim) == "environment") {
cat("\tauthorshipVerbatim:\tobject of class", paste0("<", class(self$authorshipVerbatim)[1], ">"), "\n")
}
else if (typeof(self$authorshipVerbatim) == "list") {
cat("\tauthorshipVerbatim:\tlist of length", length(self$authorshipVerbatim), "\n")
}
else {
cat("\tauthorshipVerbatim:\t", self$authorshipVerbatim, "\n")
}
## print all methods
cat("Methods:\n")
cat("\tfromJSONString\n")
cat("\ttoJSONString\n")
cat("\tfromList\n")
cat("\ttoList\n")
cat("\tprint\n")
invisible(self)
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.