# College Football Data API
#
# This is an API for accessing all sorts of college football data. It currently has a wide array of data ranging from play by play to player statistics to game scores and more.
#
# OpenAPI spec version: 2.3.5
# Contact: admin@collegefootballdata.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' TeamRecord Class
#'
#' @field year
#' @field team
#' @field conference
#' @field division
#' @field total
#' @field conferenceGames
#' @field homeGames
#' @field awayGames
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TeamRecord <- R6::R6Class(
'TeamRecord',
public = list(
`year` = NULL,
`team` = NULL,
`conference` = NULL,
`division` = NULL,
`total` = NULL,
`conferenceGames` = NULL,
`homeGames` = NULL,
`awayGames` = NULL,
initialize = function(`year`, `team`, `conference`, `division`, `total`, `conferenceGames`, `homeGames`, `awayGames`){
if (!missing(`year`)) {
stopifnot(is.numeric(`year`), length(`year`) == 1)
self$`year` <- `year`
}
if (!missing(`team`)) {
stopifnot(is.character(`team`), length(`team`) == 1)
self$`team` <- `team`
}
if (!missing(`conference`)) {
stopifnot(is.character(`conference`), length(`conference`) == 1)
self$`conference` <- `conference`
}
if (!missing(`division`)) {
stopifnot(is.character(`division`), length(`division`) == 1)
self$`division` <- `division`
}
if (!missing(`total`)) {
stopifnot(R6::is.R6(`total`))
self$`total` <- `total`
}
if (!missing(`conferenceGames`)) {
stopifnot(R6::is.R6(`conferenceGames`))
self$`conferenceGames` <- `conferenceGames`
}
if (!missing(`homeGames`)) {
stopifnot(R6::is.R6(`homeGames`))
self$`homeGames` <- `homeGames`
}
if (!missing(`awayGames`)) {
stopifnot(R6::is.R6(`awayGames`))
self$`awayGames` <- `awayGames`
}
},
toJSON = function() {
TeamRecordObject <- list()
if (!is.null(self$`year`)) {
TeamRecordObject[['year']] <- self$`year`
}
if (!is.null(self$`team`)) {
TeamRecordObject[['team']] <- self$`team`
}
if (!is.null(self$`conference`)) {
TeamRecordObject[['conference']] <- self$`conference`
}
if (!is.null(self$`division`)) {
TeamRecordObject[['division']] <- self$`division`
}
if (!is.null(self$`total`)) {
TeamRecordObject[['total']] <- self$`total`$toJSON()
}
if (!is.null(self$`conferenceGames`)) {
TeamRecordObject[['conferenceGames']] <- self$`conferenceGames`$toJSON()
}
if (!is.null(self$`homeGames`)) {
TeamRecordObject[['homeGames']] <- self$`homeGames`$toJSON()
}
if (!is.null(self$`awayGames`)) {
TeamRecordObject[['awayGames']] <- self$`awayGames`$toJSON()
}
TeamRecordObject
},
fromJSON = function(TeamRecordJson) {
TeamRecordObject <- jsonlite::fromJSON(TeamRecordJson)
if (!is.null(TeamRecordObject$`year`)) {
self$`year` <- TeamRecordObject$`year`
}
if (!is.null(TeamRecordObject$`team`)) {
self$`team` <- TeamRecordObject$`team`
}
if (!is.null(TeamRecordObject$`conference`)) {
self$`conference` <- TeamRecordObject$`conference`
}
if (!is.null(TeamRecordObject$`division`)) {
self$`division` <- TeamRecordObject$`division`
}
if (!is.null(TeamRecordObject$`total`)) {
totalObject <- TeamRecordTotal$new()
totalObject$fromJSON(jsonlite::toJSON(TeamRecordObject$total, auto_unbox = TRUE))
self$`total` <- totalObject
}
if (!is.null(TeamRecordObject$`conferenceGames`)) {
conferenceGamesObject <- TeamRecordTotal$new()
conferenceGamesObject$fromJSON(jsonlite::toJSON(TeamRecordObject$conferenceGames, auto_unbox = TRUE))
self$`conferenceGames` <- conferenceGamesObject
}
if (!is.null(TeamRecordObject$`homeGames`)) {
homeGamesObject <- TeamRecordTotal$new()
homeGamesObject$fromJSON(jsonlite::toJSON(TeamRecordObject$homeGames, auto_unbox = TRUE))
self$`homeGames` <- homeGamesObject
}
if (!is.null(TeamRecordObject$`awayGames`)) {
awayGamesObject <- TeamRecordTotal$new()
awayGamesObject$fromJSON(jsonlite::toJSON(TeamRecordObject$awayGames, auto_unbox = TRUE))
self$`awayGames` <- awayGamesObject
}
},
toJSONString = function() {
sprintf(
'{
"year": %d,
"team": %s,
"conference": %s,
"division": %s,
"total": %s,
"conferenceGames": %s,
"homeGames": %s,
"awayGames": %s
}',
self$`year`,
self$`team`,
self$`conference`,
self$`division`,
self$`total`$toJSON(),
self$`conferenceGames`$toJSON(),
self$`homeGames`$toJSON(),
self$`awayGames`$toJSON()
)
},
fromJSONString = function(TeamRecordJson) {
TeamRecordObject <- jsonlite::fromJSON(TeamRecordJson)
self$`year` <- TeamRecordObject$`year`
self$`team` <- TeamRecordObject$`team`
self$`conference` <- TeamRecordObject$`conference`
self$`division` <- TeamRecordObject$`division`
TeamRecordTotalObject <- TeamRecordTotal$new()
self$`total` <- TeamRecordTotalObject$fromJSON(jsonlite::toJSON(TeamRecordObject$total, auto_unbox = TRUE))
TeamRecordTotalObject <- TeamRecordTotal$new()
self$`conferenceGames` <- TeamRecordTotalObject$fromJSON(jsonlite::toJSON(TeamRecordObject$conferenceGames, auto_unbox = TRUE))
TeamRecordTotalObject <- TeamRecordTotal$new()
self$`homeGames` <- TeamRecordTotalObject$fromJSON(jsonlite::toJSON(TeamRecordObject$homeGames, auto_unbox = TRUE))
TeamRecordTotalObject <- TeamRecordTotal$new()
self$`awayGames` <- TeamRecordTotalObject$fromJSON(jsonlite::toJSON(TeamRecordObject$awayGames, auto_unbox = TRUE))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.