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


#' PlayStatType Class
#'
#' @field id 
#' @field name 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PlayStatType <- R6::R6Class(
  'PlayStatType',
  public = list(
    `id` = NULL,
    `name` = NULL,
    initialize = function(`id`, `name`){
      if (!missing(`id`)) {
        stopifnot(is.numeric(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
    },
    toJSON = function() {
      PlayStatTypeObject <- list()
      if (!is.null(self$`id`)) {
        PlayStatTypeObject[['id']] <- self$`id`
      }
      if (!is.null(self$`name`)) {
        PlayStatTypeObject[['name']] <- self$`name`
      }

      PlayStatTypeObject
    },
    fromJSON = function(PlayStatTypeJson) {
      PlayStatTypeObject <- jsonlite::fromJSON(PlayStatTypeJson)
      if (!is.null(PlayStatTypeObject$`id`)) {
        self$`id` <- PlayStatTypeObject$`id`
      }
      if (!is.null(PlayStatTypeObject$`name`)) {
        self$`name` <- PlayStatTypeObject$`name`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "id": %d,
           "name": %s
        }',
        self$`id`,
        self$`name`
      )
    },
    fromJSONString = function(PlayStatTypeJson) {
      PlayStatTypeObject <- jsonlite::fromJSON(PlayStatTypeJson)
      self$`id` <- PlayStatTypeObject$`id`
      self$`name` <- PlayStatTypeObject$`name`
    }
  )
)
saiemgilani/cfbd-api-R documentation built on Feb. 16, 2021, 12:07 a.m.