# Singlearity Baseball API
#
# Baseball optimization API using machine learning
#
# The version of the OpenAPI document: 0.1.1
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title LineupPos
#'
#' @description LineupPos Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field player \link{Player}
#'
#' @field position Position character
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
LineupPos <- R6::R6Class(
'LineupPos',
public = list(
`player` = NULL,
`position` = NULL,
initialize = function(
`player`, `position`, ...
) {
local.optional.var <- list(...)
if (length(local.optional.var) > 0) {
stop(paste("Unknown argument(s) in initialize of object LineupPos:", paste(names(local.optional.var), collapse=", "), collapse=" "))
}
if (!missing(`player`)) {
stopifnot(R6::is.R6(`player`))
self$`player` <- `player`
}
if (!missing(`position`)) {
stopifnot(is.character(`position`), length(`position`) == 1)
self$`position` <- `position`
}
},
toJSON = function() {
LineupPosObject <- list()
if (!is.null(self$`player`)) {
LineupPosObject[['player']] <-
self$`player`$toJSON()
}
if (!is.null(self$`position`)) {
LineupPosObject[['position']] <-
self$`position`
}
LineupPosObject
},
fromJSON = function(LineupPosJson) {
LineupPosObject <- jsonlite::fromJSON(LineupPosJson)
if (!is.null(LineupPosObject$`player`)) {
playerObject <- Player$new()
playerObject$fromJSON(jsonlite::toJSON(LineupPosObject$player, auto_unbox = TRUE, digits = NA))
self$`player` <- playerObject
}
if (!is.null(LineupPosObject$`position`)) {
self$`position` <- LineupPosObject$`position`
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`player`)) {
sprintf(
'"player":
%s
',
jsonlite::toJSON(self$`player`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`position`)) {
sprintf(
'"position":
"%s"
',
self$`position`
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(LineupPosJson) {
LineupPosObject <- jsonlite::fromJSON(LineupPosJson)
self$`player` <- Player$new()$fromJSON(jsonlite::toJSON(LineupPosObject$player, auto_unbox = TRUE, digits = NA))
self$`position` <- LineupPosObject$`position`
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.