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


#' PlayerSearchResult Class
#'
#' @field id 
#' @field team 
#' @field name 
#' @field firstName 
#' @field lastName 
#' @field weight 
#' @field height 
#' @field jersey 
#' @field position 
#' @field hometown 
#' @field teamColor 
#' @field teamColorSecondary 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PlayerSearchResult <- R6::R6Class(
  'PlayerSearchResult',
  public = list(
    `id` = NULL,
    `team` = NULL,
    `name` = NULL,
    `firstName` = NULL,
    `lastName` = NULL,
    `weight` = NULL,
    `height` = NULL,
    `jersey` = NULL,
    `position` = NULL,
    `hometown` = NULL,
    `teamColor` = NULL,
    `teamColorSecondary` = NULL,
    initialize = function(`id`, `team`, `name`, `firstName`, `lastName`, `weight`, `height`, `jersey`, `position`, `hometown`, `teamColor`, `teamColorSecondary`){
      if (!missing(`id`)) {
        stopifnot(is.numeric(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`team`)) {
        stopifnot(is.character(`team`), length(`team`) == 1)
        self$`team` <- `team`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`firstName`)) {
        stopifnot(is.character(`firstName`), length(`firstName`) == 1)
        self$`firstName` <- `firstName`
      }
      if (!missing(`lastName`)) {
        stopifnot(is.character(`lastName`), length(`lastName`) == 1)
        self$`lastName` <- `lastName`
      }
      if (!missing(`weight`)) {
        stopifnot(is.numeric(`weight`), length(`weight`) == 1)
        self$`weight` <- `weight`
      }
      if (!missing(`height`)) {
        stopifnot(is.numeric(`height`), length(`height`) == 1)
        self$`height` <- `height`
      }
      if (!missing(`jersey`)) {
        stopifnot(is.numeric(`jersey`), length(`jersey`) == 1)
        self$`jersey` <- `jersey`
      }
      if (!missing(`position`)) {
        stopifnot(is.character(`position`), length(`position`) == 1)
        self$`position` <- `position`
      }
      if (!missing(`hometown`)) {
        stopifnot(is.character(`hometown`), length(`hometown`) == 1)
        self$`hometown` <- `hometown`
      }
      if (!missing(`teamColor`)) {
        stopifnot(is.character(`teamColor`), length(`teamColor`) == 1)
        self$`teamColor` <- `teamColor`
      }
      if (!missing(`teamColorSecondary`)) {
        stopifnot(is.character(`teamColorSecondary`), length(`teamColorSecondary`) == 1)
        self$`teamColorSecondary` <- `teamColorSecondary`
      }
    },
    toJSON = function() {
      PlayerSearchResultObject <- list()
      if (!is.null(self$`id`)) {
        PlayerSearchResultObject[['id']] <- self$`id`
      }
      if (!is.null(self$`team`)) {
        PlayerSearchResultObject[['team']] <- self$`team`
      }
      if (!is.null(self$`name`)) {
        PlayerSearchResultObject[['name']] <- self$`name`
      }
      if (!is.null(self$`firstName`)) {
        PlayerSearchResultObject[['firstName']] <- self$`firstName`
      }
      if (!is.null(self$`lastName`)) {
        PlayerSearchResultObject[['lastName']] <- self$`lastName`
      }
      if (!is.null(self$`weight`)) {
        PlayerSearchResultObject[['weight']] <- self$`weight`
      }
      if (!is.null(self$`height`)) {
        PlayerSearchResultObject[['height']] <- self$`height`
      }
      if (!is.null(self$`jersey`)) {
        PlayerSearchResultObject[['jersey']] <- self$`jersey`
      }
      if (!is.null(self$`position`)) {
        PlayerSearchResultObject[['position']] <- self$`position`
      }
      if (!is.null(self$`hometown`)) {
        PlayerSearchResultObject[['hometown']] <- self$`hometown`
      }
      if (!is.null(self$`teamColor`)) {
        PlayerSearchResultObject[['teamColor']] <- self$`teamColor`
      }
      if (!is.null(self$`teamColorSecondary`)) {
        PlayerSearchResultObject[['teamColorSecondary']] <- self$`teamColorSecondary`
      }

      PlayerSearchResultObject
    },
    fromJSON = function(PlayerSearchResultJson) {
      PlayerSearchResultObject <- jsonlite::fromJSON(PlayerSearchResultJson)
      if (!is.null(PlayerSearchResultObject$`id`)) {
        self$`id` <- PlayerSearchResultObject$`id`
      }
      if (!is.null(PlayerSearchResultObject$`team`)) {
        self$`team` <- PlayerSearchResultObject$`team`
      }
      if (!is.null(PlayerSearchResultObject$`name`)) {
        self$`name` <- PlayerSearchResultObject$`name`
      }
      if (!is.null(PlayerSearchResultObject$`firstName`)) {
        self$`firstName` <- PlayerSearchResultObject$`firstName`
      }
      if (!is.null(PlayerSearchResultObject$`lastName`)) {
        self$`lastName` <- PlayerSearchResultObject$`lastName`
      }
      if (!is.null(PlayerSearchResultObject$`weight`)) {
        self$`weight` <- PlayerSearchResultObject$`weight`
      }
      if (!is.null(PlayerSearchResultObject$`height`)) {
        self$`height` <- PlayerSearchResultObject$`height`
      }
      if (!is.null(PlayerSearchResultObject$`jersey`)) {
        self$`jersey` <- PlayerSearchResultObject$`jersey`
      }
      if (!is.null(PlayerSearchResultObject$`position`)) {
        self$`position` <- PlayerSearchResultObject$`position`
      }
      if (!is.null(PlayerSearchResultObject$`hometown`)) {
        self$`hometown` <- PlayerSearchResultObject$`hometown`
      }
      if (!is.null(PlayerSearchResultObject$`teamColor`)) {
        self$`teamColor` <- PlayerSearchResultObject$`teamColor`
      }
      if (!is.null(PlayerSearchResultObject$`teamColorSecondary`)) {
        self$`teamColorSecondary` <- PlayerSearchResultObject$`teamColorSecondary`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "id": %d,
           "team": %s,
           "name": %s,
           "firstName": %s,
           "lastName": %s,
           "weight": %d,
           "height": %d,
           "jersey": %d,
           "position": %s,
           "hometown": %s,
           "teamColor": %s,
           "teamColorSecondary": %s
        }',
        self$`id`,
        self$`team`,
        self$`name`,
        self$`firstName`,
        self$`lastName`,
        self$`weight`,
        self$`height`,
        self$`jersey`,
        self$`position`,
        self$`hometown`,
        self$`teamColor`,
        self$`teamColorSecondary`
      )
    },
    fromJSONString = function(PlayerSearchResultJson) {
      PlayerSearchResultObject <- jsonlite::fromJSON(PlayerSearchResultJson)
      self$`id` <- PlayerSearchResultObject$`id`
      self$`team` <- PlayerSearchResultObject$`team`
      self$`name` <- PlayerSearchResultObject$`name`
      self$`firstName` <- PlayerSearchResultObject$`firstName`
      self$`lastName` <- PlayerSearchResultObject$`lastName`
      self$`weight` <- PlayerSearchResultObject$`weight`
      self$`height` <- PlayerSearchResultObject$`height`
      self$`jersey` <- PlayerSearchResultObject$`jersey`
      self$`position` <- PlayerSearchResultObject$`position`
      self$`hometown` <- PlayerSearchResultObject$`hometown`
      self$`teamColor` <- PlayerSearchResultObject$`teamColor`
      self$`teamColorSecondary` <- PlayerSearchResultObject$`teamColorSecondary`
    }
  )
)
saiemgilani/cfbd-api-R documentation built on Feb. 16, 2021, 12:07 a.m.