# 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 BodyGetGameSimGameSimPost
#'
#' @description BodyGetGameSimGameSimPost Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field game \link{Game}
#'
#' @field start_state Start State \link{State} [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BodyGetGameSimGameSimPost <- R6::R6Class(
'BodyGetGameSimGameSimPost',
public = list(
`game` = NULL,
`start_state` = NULL,
initialize = function(
`game`, `start_state`=NULL, ...
) {
local.optional.var <- list(...)
if (length(local.optional.var) > 0) {
stop(paste("Unknown argument(s) in initialize of object BodyGetGameSimGameSimPost:", paste(names(local.optional.var), collapse=", "), collapse=" "))
}
if (!missing(`game`)) {
stopifnot(R6::is.R6(`game`))
self$`game` <- `game`
}
if (!is.null(`start_state`)) {
stopifnot(R6::is.R6(`start_state`))
self$`start_state` <- `start_state`
}
},
toJSON = function() {
BodyGetGameSimGameSimPostObject <- list()
if (!is.null(self$`game`)) {
BodyGetGameSimGameSimPostObject[['game']] <-
self$`game`$toJSON()
}
if (!is.null(self$`start_state`)) {
BodyGetGameSimGameSimPostObject[['start_state']] <-
self$`start_state`$toJSON()
}
BodyGetGameSimGameSimPostObject
},
fromJSON = function(BodyGetGameSimGameSimPostJson) {
BodyGetGameSimGameSimPostObject <- jsonlite::fromJSON(BodyGetGameSimGameSimPostJson)
if (!is.null(BodyGetGameSimGameSimPostObject$`game`)) {
gameObject <- Game$new()
gameObject$fromJSON(jsonlite::toJSON(BodyGetGameSimGameSimPostObject$game, auto_unbox = TRUE, digits = NA))
self$`game` <- gameObject
}
if (!is.null(BodyGetGameSimGameSimPostObject$`start_state`)) {
start_stateObject <- State$new()
start_stateObject$fromJSON(jsonlite::toJSON(BodyGetGameSimGameSimPostObject$start_state, auto_unbox = TRUE, digits = NA))
self$`start_state` <- start_stateObject
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`game`)) {
sprintf(
'"game":
%s
',
jsonlite::toJSON(self$`game`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`start_state`)) {
sprintf(
'"start_state":
%s
',
jsonlite::toJSON(self$`start_state`$toJSON(), auto_unbox=TRUE, digits = NA)
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(BodyGetGameSimGameSimPostJson) {
BodyGetGameSimGameSimPostObject <- jsonlite::fromJSON(BodyGetGameSimGameSimPostJson)
self$`game` <- Game$new()$fromJSON(jsonlite::toJSON(BodyGetGameSimGameSimPostObject$game, auto_unbox = TRUE, digits = NA))
self$`start_state` <- State$new()$fromJSON(jsonlite::toJSON(BodyGetGameSimGameSimPostObject$start_state, auto_unbox = TRUE, digits = NA))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.