R/v1_categorical_field_detail_all_of.R

# HCA Matrix Service
#
# Human Cell Atlas Matrix Service API
#
# The version of the OpenAPI document: 1.0.0
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title V1CategoricalFieldDetailAllOf
#' @description V1CategoricalFieldDetailAllOf Class
#' @format An \code{R6Class} generator object
#' @field cell_counts    named list(integer)   
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
V1CategoricalFieldDetailAllOf <- R6::R6Class(
  'V1CategoricalFieldDetailAllOf',
  public = list(
    `cell_counts` = NULL,
    initialize = function(`cell_counts`, ...){
      local.optional.var <- list(...)
      if (!missing(`cell_counts`)) {
        stopifnot(is.vector(`cell_counts`), length(`cell_counts`) != 0)
        sapply(`cell_counts`, function(x) stopifnot(is.character(x)))
        self$`cell_counts` <- `cell_counts`
      }
    },
    toJSON = function() {
      V1CategoricalFieldDetailAllOfObject <- list()
      if (!is.null(self$`cell_counts`)) {
        V1CategoricalFieldDetailAllOfObject[['cell_counts']] <-
          self$`cell_counts`
      }

      V1CategoricalFieldDetailAllOfObject
    },
    fromJSON = function(V1CategoricalFieldDetailAllOfJson) {
      V1CategoricalFieldDetailAllOfObject <- jsonlite::fromJSON(V1CategoricalFieldDetailAllOfJson)
      if (!is.null(V1CategoricalFieldDetailAllOfObject$`cell_counts`)) {
        self$`cell_counts` <- ApiClient$new()$deserializeObj(V1CategoricalFieldDetailAllOfObject$`cell_counts`, "map(integer)", "package:hcamatrixapi")
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`cell_counts`)) {
        sprintf(
        '"cell_counts":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`cell_counts`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(V1CategoricalFieldDetailAllOfJson) {
      V1CategoricalFieldDetailAllOfObject <- jsonlite::fromJSON(V1CategoricalFieldDetailAllOfJson)
      self$`cell_counts` <- ApiClient$new()$deserializeObj(V1CategoricalFieldDetailAllOfObject$`cell_counts`, "map(integer)","package:hcamatrixapi")
      self
    }
  )
)
Bioconductor/hcamatrixapi documentation built on Nov. 6, 2019, 12:10 a.m.