R/subsystem_status.R

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

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

      SubsystemStatusObject
    },
    fromJSON = function(SubsystemStatusJson) {
      SubsystemStatusObject <- jsonlite::fromJSON(SubsystemStatusJson)
      if (!is.null(SubsystemStatusObject$`ok`)) {
        self$`ok` <- SubsystemStatusObject$`ok`
      }
      if (!is.null(SubsystemStatusObject$`messages`)) {
        self$`messages` <- ApiClient$new()$deserializeObj(SubsystemStatusObject$`messages`, "array[character]", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`ok`)) {
        sprintf(
        '"ok":
          "%s"
                ',
        self$`ok`
        )},
        if (!is.null(self$`messages`)) {
        sprintf(
        '"messages":
           [%s]
        ',
        paste(unlist(lapply(self$`messages`, function(x) paste0('"', x, '"'))), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SubsystemStatusJson) {
      SubsystemStatusObject <- jsonlite::fromJSON(SubsystemStatusJson)
      self$`ok` <- SubsystemStatusObject$`ok`
      self$`messages` <- ApiClient$new()$deserializeObj(SubsystemStatusObject$`messages`, "array[character]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.