R/PlayWP.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


#' PlayWP Class
#'
#' @field gamesId 
#' @field playId 
#' @field playText 
#' @field homeId 
#' @field home 
#' @field awayId 
#' @field away 
#' @field spread 
#' @field homeBall 
#' @field homeScore 
#' @field awayScore 
#' @field timeRemaining 
#' @field yardLine 
#' @field down 
#' @field distance 
#' @field homeWinProb 
#' @field playNumber 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PlayWP <- R6::R6Class(
  'PlayWP',
  public = list(
    `gamesId` = NULL,
    `playId` = NULL,
    `playText` = NULL,
    `homeId` = NULL,
    `home` = NULL,
    `awayId` = NULL,
    `away` = NULL,
    `spread` = NULL,
    `homeBall` = NULL,
    `homeScore` = NULL,
    `awayScore` = NULL,
    `timeRemaining` = NULL,
    `yardLine` = NULL,
    `down` = NULL,
    `distance` = NULL,
    `homeWinProb` = NULL,
    `playNumber` = NULL,
    initialize = function(`gamesId`, `playId`, `playText`, `homeId`, `home`, `awayId`, `away`, `spread`, `homeBall`, `homeScore`, `awayScore`, `timeRemaining`, `yardLine`, `down`, `distance`, `homeWinProb`, `playNumber`){
      if (!missing(`gamesId`)) {
        stopifnot(is.numeric(`gamesId`), length(`gamesId`) == 1)
        self$`gamesId` <- `gamesId`
      }
      if (!missing(`playId`)) {
        stopifnot(is.numeric(`playId`), length(`playId`) == 1)
        self$`playId` <- `playId`
      }
      if (!missing(`playText`)) {
        stopifnot(is.character(`playText`), length(`playText`) == 1)
        self$`playText` <- `playText`
      }
      if (!missing(`homeId`)) {
        stopifnot(is.numeric(`homeId`), length(`homeId`) == 1)
        self$`homeId` <- `homeId`
      }
      if (!missing(`home`)) {
        stopifnot(is.character(`home`), length(`home`) == 1)
        self$`home` <- `home`
      }
      if (!missing(`awayId`)) {
        stopifnot(is.numeric(`awayId`), length(`awayId`) == 1)
        self$`awayId` <- `awayId`
      }
      if (!missing(`away`)) {
        stopifnot(is.character(`away`), length(`away`) == 1)
        self$`away` <- `away`
      }
      if (!missing(`spread`)) {
        self$`spread` <- `spread`
      }
      if (!missing(`homeBall`)) {
        self$`homeBall` <- `homeBall`
      }
      if (!missing(`homeScore`)) {
        stopifnot(is.numeric(`homeScore`), length(`homeScore`) == 1)
        self$`homeScore` <- `homeScore`
      }
      if (!missing(`awayScore`)) {
        stopifnot(is.numeric(`awayScore`), length(`awayScore`) == 1)
        self$`awayScore` <- `awayScore`
      }
      if (!missing(`timeRemaining`)) {
        stopifnot(is.numeric(`timeRemaining`), length(`timeRemaining`) == 1)
        self$`timeRemaining` <- `timeRemaining`
      }
      if (!missing(`yardLine`)) {
        stopifnot(is.numeric(`yardLine`), length(`yardLine`) == 1)
        self$`yardLine` <- `yardLine`
      }
      if (!missing(`down`)) {
        stopifnot(is.numeric(`down`), length(`down`) == 1)
        self$`down` <- `down`
      }
      if (!missing(`distance`)) {
        stopifnot(is.numeric(`distance`), length(`distance`) == 1)
        self$`distance` <- `distance`
      }
      if (!missing(`homeWinProb`)) {
        self$`homeWinProb` <- `homeWinProb`
      }
      if (!missing(`playNumber`)) {
        stopifnot(is.numeric(`playNumber`), length(`playNumber`) == 1)
        self$`playNumber` <- `playNumber`
      }
    },
    toJSON = function() {
      PlayWPObject <- list()
      if (!is.null(self$`gamesId`)) {
        PlayWPObject[['gamesId']] <- self$`gamesId`
      }
      if (!is.null(self$`playId`)) {
        PlayWPObject[['playId']] <- self$`playId`
      }
      if (!is.null(self$`playText`)) {
        PlayWPObject[['playText']] <- self$`playText`
      }
      if (!is.null(self$`homeId`)) {
        PlayWPObject[['homeId']] <- self$`homeId`
      }
      if (!is.null(self$`home`)) {
        PlayWPObject[['home']] <- self$`home`
      }
      if (!is.null(self$`awayId`)) {
        PlayWPObject[['awayId']] <- self$`awayId`
      }
      if (!is.null(self$`away`)) {
        PlayWPObject[['away']] <- self$`away`
      }
      if (!is.null(self$`spread`)) {
        PlayWPObject[['spread']] <- self$`spread`
      }
      if (!is.null(self$`homeBall`)) {
        PlayWPObject[['homeBall']] <- self$`homeBall`
      }
      if (!is.null(self$`homeScore`)) {
        PlayWPObject[['homeScore']] <- self$`homeScore`
      }
      if (!is.null(self$`awayScore`)) {
        PlayWPObject[['awayScore']] <- self$`awayScore`
      }
      if (!is.null(self$`timeRemaining`)) {
        PlayWPObject[['timeRemaining']] <- self$`timeRemaining`
      }
      if (!is.null(self$`yardLine`)) {
        PlayWPObject[['yardLine']] <- self$`yardLine`
      }
      if (!is.null(self$`down`)) {
        PlayWPObject[['down']] <- self$`down`
      }
      if (!is.null(self$`distance`)) {
        PlayWPObject[['distance']] <- self$`distance`
      }
      if (!is.null(self$`homeWinProb`)) {
        PlayWPObject[['homeWinProb']] <- self$`homeWinProb`
      }
      if (!is.null(self$`playNumber`)) {
        PlayWPObject[['playNumber']] <- self$`playNumber`
      }

      PlayWPObject
    },
    fromJSON = function(PlayWPJson) {
      PlayWPObject <- jsonlite::fromJSON(PlayWPJson)
      if (!is.null(PlayWPObject$`gamesId`)) {
        self$`gamesId` <- PlayWPObject$`gamesId`
      }
      if (!is.null(PlayWPObject$`playId`)) {
        self$`playId` <- PlayWPObject$`playId`
      }
      if (!is.null(PlayWPObject$`playText`)) {
        self$`playText` <- PlayWPObject$`playText`
      }
      if (!is.null(PlayWPObject$`homeId`)) {
        self$`homeId` <- PlayWPObject$`homeId`
      }
      if (!is.null(PlayWPObject$`home`)) {
        self$`home` <- PlayWPObject$`home`
      }
      if (!is.null(PlayWPObject$`awayId`)) {
        self$`awayId` <- PlayWPObject$`awayId`
      }
      if (!is.null(PlayWPObject$`away`)) {
        self$`away` <- PlayWPObject$`away`
      }
      if (!is.null(PlayWPObject$`spread`)) {
        self$`spread` <- PlayWPObject$`spread`
      }
      if (!is.null(PlayWPObject$`homeBall`)) {
        self$`homeBall` <- PlayWPObject$`homeBall`
      }
      if (!is.null(PlayWPObject$`homeScore`)) {
        self$`homeScore` <- PlayWPObject$`homeScore`
      }
      if (!is.null(PlayWPObject$`awayScore`)) {
        self$`awayScore` <- PlayWPObject$`awayScore`
      }
      if (!is.null(PlayWPObject$`timeRemaining`)) {
        self$`timeRemaining` <- PlayWPObject$`timeRemaining`
      }
      if (!is.null(PlayWPObject$`yardLine`)) {
        self$`yardLine` <- PlayWPObject$`yardLine`
      }
      if (!is.null(PlayWPObject$`down`)) {
        self$`down` <- PlayWPObject$`down`
      }
      if (!is.null(PlayWPObject$`distance`)) {
        self$`distance` <- PlayWPObject$`distance`
      }
      if (!is.null(PlayWPObject$`homeWinProb`)) {
        self$`homeWinProb` <- PlayWPObject$`homeWinProb`
      }
      if (!is.null(PlayWPObject$`playNumber`)) {
        self$`playNumber` <- PlayWPObject$`playNumber`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "gamesId": %d,
           "playId": %d,
           "playText": %s,
           "homeId": %d,
           "home": %s,
           "awayId": %d,
           "away": %s,
           "spread": %s,
           "homeBall": %s,
           "homeScore": %d,
           "awayScore": %d,
           "timeRemaining": %d,
           "yardLine": %d,
           "down": %d,
           "distance": %d,
           "homeWinProb": %s,
           "playNumber": %d
        }',
        self$`gamesId`,
        self$`playId`,
        self$`playText`,
        self$`homeId`,
        self$`home`,
        self$`awayId`,
        self$`away`,
        self$`spread`,
        self$`homeBall`,
        self$`homeScore`,
        self$`awayScore`,
        self$`timeRemaining`,
        self$`yardLine`,
        self$`down`,
        self$`distance`,
        self$`homeWinProb`,
        self$`playNumber`
      )
    },
    fromJSONString = function(PlayWPJson) {
      PlayWPObject <- jsonlite::fromJSON(PlayWPJson)
      self$`gamesId` <- PlayWPObject$`gamesId`
      self$`playId` <- PlayWPObject$`playId`
      self$`playText` <- PlayWPObject$`playText`
      self$`homeId` <- PlayWPObject$`homeId`
      self$`home` <- PlayWPObject$`home`
      self$`awayId` <- PlayWPObject$`awayId`
      self$`away` <- PlayWPObject$`away`
      self$`spread` <- PlayWPObject$`spread`
      self$`homeBall` <- PlayWPObject$`homeBall`
      self$`homeScore` <- PlayWPObject$`homeScore`
      self$`awayScore` <- PlayWPObject$`awayScore`
      self$`timeRemaining` <- PlayWPObject$`timeRemaining`
      self$`yardLine` <- PlayWPObject$`yardLine`
      self$`down` <- PlayWPObject$`down`
      self$`distance` <- PlayWPObject$`distance`
      self$`homeWinProb` <- PlayWPObject$`homeWinProb`
      self$`playNumber` <- PlayWPObject$`playNumber`
    }
  )
)
saiemgilani/cfbd-api-R documentation built on Feb. 16, 2021, 12:07 a.m.