R/TeamMatchupGames.r

# 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


#' TeamMatchupGames Class
#'
#' @field season 
#' @field week 
#' @field season_type 
#' @field date 
#' @field neutralSite 
#' @field venue 
#' @field homeTeam 
#' @field homeScore 
#' @field awayTeam 
#' @field awayScore 
#' @field winner 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TeamMatchupGames <- R6::R6Class(
  'TeamMatchupGames',
  public = list(
    `season` = NULL,
    `week` = NULL,
    `season_type` = NULL,
    `date` = NULL,
    `neutralSite` = NULL,
    `venue` = NULL,
    `homeTeam` = NULL,
    `homeScore` = NULL,
    `awayTeam` = NULL,
    `awayScore` = NULL,
    `winner` = NULL,
    initialize = function(`season`, `week`, `season_type`, `date`, `neutralSite`, `venue`, `homeTeam`, `homeScore`, `awayTeam`, `awayScore`, `winner`){
      if (!missing(`season`)) {
        stopifnot(is.numeric(`season`), length(`season`) == 1)
        self$`season` <- `season`
      }
      if (!missing(`week`)) {
        stopifnot(is.numeric(`week`), length(`week`) == 1)
        self$`week` <- `week`
      }
      if (!missing(`season_type`)) {
        stopifnot(is.character(`season_type`), length(`season_type`) == 1)
        self$`season_type` <- `season_type`
      }
      if (!missing(`date`)) {
        stopifnot(is.character(`date`), length(`date`) == 1)
        self$`date` <- `date`
      }
      if (!missing(`neutralSite`)) {
        self$`neutralSite` <- `neutralSite`
      }
      if (!missing(`venue`)) {
        stopifnot(is.character(`venue`), length(`venue`) == 1)
        self$`venue` <- `venue`
      }
      if (!missing(`homeTeam`)) {
        stopifnot(is.character(`homeTeam`), length(`homeTeam`) == 1)
        self$`homeTeam` <- `homeTeam`
      }
      if (!missing(`homeScore`)) {
        stopifnot(is.numeric(`homeScore`), length(`homeScore`) == 1)
        self$`homeScore` <- `homeScore`
      }
      if (!missing(`awayTeam`)) {
        stopifnot(is.character(`awayTeam`), length(`awayTeam`) == 1)
        self$`awayTeam` <- `awayTeam`
      }
      if (!missing(`awayScore`)) {
        stopifnot(is.numeric(`awayScore`), length(`awayScore`) == 1)
        self$`awayScore` <- `awayScore`
      }
      if (!missing(`winner`)) {
        stopifnot(is.character(`winner`), length(`winner`) == 1)
        self$`winner` <- `winner`
      }
    },
    toJSON = function() {
      TeamMatchupGamesObject <- list()
      if (!is.null(self$`season`)) {
        TeamMatchupGamesObject[['season']] <- self$`season`
      }
      if (!is.null(self$`week`)) {
        TeamMatchupGamesObject[['week']] <- self$`week`
      }
      if (!is.null(self$`season_type`)) {
        TeamMatchupGamesObject[['season_type']] <- self$`season_type`
      }
      if (!is.null(self$`date`)) {
        TeamMatchupGamesObject[['date']] <- self$`date`
      }
      if (!is.null(self$`neutralSite`)) {
        TeamMatchupGamesObject[['neutralSite']] <- self$`neutralSite`
      }
      if (!is.null(self$`venue`)) {
        TeamMatchupGamesObject[['venue']] <- self$`venue`
      }
      if (!is.null(self$`homeTeam`)) {
        TeamMatchupGamesObject[['homeTeam']] <- self$`homeTeam`
      }
      if (!is.null(self$`homeScore`)) {
        TeamMatchupGamesObject[['homeScore']] <- self$`homeScore`
      }
      if (!is.null(self$`awayTeam`)) {
        TeamMatchupGamesObject[['awayTeam']] <- self$`awayTeam`
      }
      if (!is.null(self$`awayScore`)) {
        TeamMatchupGamesObject[['awayScore']] <- self$`awayScore`
      }
      if (!is.null(self$`winner`)) {
        TeamMatchupGamesObject[['winner']] <- self$`winner`
      }

      TeamMatchupGamesObject
    },
    fromJSON = function(TeamMatchupGamesJson) {
      TeamMatchupGamesObject <- jsonlite::fromJSON(TeamMatchupGamesJson)
      if (!is.null(TeamMatchupGamesObject$`season`)) {
        self$`season` <- TeamMatchupGamesObject$`season`
      }
      if (!is.null(TeamMatchupGamesObject$`week`)) {
        self$`week` <- TeamMatchupGamesObject$`week`
      }
      if (!is.null(TeamMatchupGamesObject$`season_type`)) {
        self$`season_type` <- TeamMatchupGamesObject$`season_type`
      }
      if (!is.null(TeamMatchupGamesObject$`date`)) {
        self$`date` <- TeamMatchupGamesObject$`date`
      }
      if (!is.null(TeamMatchupGamesObject$`neutralSite`)) {
        self$`neutralSite` <- TeamMatchupGamesObject$`neutralSite`
      }
      if (!is.null(TeamMatchupGamesObject$`venue`)) {
        self$`venue` <- TeamMatchupGamesObject$`venue`
      }
      if (!is.null(TeamMatchupGamesObject$`homeTeam`)) {
        self$`homeTeam` <- TeamMatchupGamesObject$`homeTeam`
      }
      if (!is.null(TeamMatchupGamesObject$`homeScore`)) {
        self$`homeScore` <- TeamMatchupGamesObject$`homeScore`
      }
      if (!is.null(TeamMatchupGamesObject$`awayTeam`)) {
        self$`awayTeam` <- TeamMatchupGamesObject$`awayTeam`
      }
      if (!is.null(TeamMatchupGamesObject$`awayScore`)) {
        self$`awayScore` <- TeamMatchupGamesObject$`awayScore`
      }
      if (!is.null(TeamMatchupGamesObject$`winner`)) {
        self$`winner` <- TeamMatchupGamesObject$`winner`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "season": %d,
           "week": %d,
           "season_type": %s,
           "date": %s,
           "neutralSite": %s,
           "venue": %s,
           "homeTeam": %s,
           "homeScore": %d,
           "awayTeam": %s,
           "awayScore": %d,
           "winner": %s
        }',
        self$`season`,
        self$`week`,
        self$`season_type`,
        self$`date`,
        self$`neutralSite`,
        self$`venue`,
        self$`homeTeam`,
        self$`homeScore`,
        self$`awayTeam`,
        self$`awayScore`,
        self$`winner`
      )
    },
    fromJSONString = function(TeamMatchupGamesJson) {
      TeamMatchupGamesObject <- jsonlite::fromJSON(TeamMatchupGamesJson)
      self$`season` <- TeamMatchupGamesObject$`season`
      self$`week` <- TeamMatchupGamesObject$`week`
      self$`season_type` <- TeamMatchupGamesObject$`season_type`
      self$`date` <- TeamMatchupGamesObject$`date`
      self$`neutralSite` <- TeamMatchupGamesObject$`neutralSite`
      self$`venue` <- TeamMatchupGamesObject$`venue`
      self$`homeTeam` <- TeamMatchupGamesObject$`homeTeam`
      self$`homeScore` <- TeamMatchupGamesObject$`homeScore`
      self$`awayTeam` <- TeamMatchupGamesObject$`awayTeam`
      self$`awayScore` <- TeamMatchupGamesObject$`awayScore`
      self$`winner` <- TeamMatchupGamesObject$`winner`
    }
  )
)
saiemgilani/cfbd-api-R documentation built on Feb. 16, 2021, 12:07 a.m.