R/system_status.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

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

      SystemStatusObject
    },
    fromJSON = function(SystemStatusJson) {
      SystemStatusObject <- jsonlite::fromJSON(SystemStatusJson)
      if (!is.null(SystemStatusObject$`ok`)) {
        self$`ok` <- SystemStatusObject$`ok`
      }
      if (!is.null(SystemStatusObject$`systems`)) {
        self$`systems` <- ApiClient$new()$deserializeObj(SystemStatusObject$`systems`, "map(object)", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`ok`)) {
        sprintf(
        '"ok":
          "%s"
                ',
        self$`ok`
        )},
        if (!is.null(self$`systems`)) {
        sprintf(
        '"systems":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`systems`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SystemStatusJson) {
      SystemStatusObject <- jsonlite::fromJSON(SystemStatusJson)
      self$`ok` <- SystemStatusObject$`ok`
      self$`systems` <- ApiClient$new()$deserializeObj(SystemStatusObject$`systems`, "map(object)", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.