R/status_response_service_name.R

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

#' @docType class
#' @title StatusResponseServiceName
#'
#' @description StatusResponseServiceName Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field ok  character [optional]
#'
#' @field messages  list( character ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
StatusResponseServiceName <- R6::R6Class(
  'StatusResponseServiceName',
  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() {
      StatusResponseServiceNameObject <- list()
      if (!is.null(self$`ok`)) {
        StatusResponseServiceNameObject[['ok']] <-
          self$`ok`
      }
      if (!is.null(self$`messages`)) {
        StatusResponseServiceNameObject[['messages']] <-
          self$`messages`
      }

      StatusResponseServiceNameObject
    },
    fromJSON = function(StatusResponseServiceNameJson) {
      StatusResponseServiceNameObject <- jsonlite::fromJSON(StatusResponseServiceNameJson)
      if (!is.null(StatusResponseServiceNameObject$`ok`)) {
        self$`ok` <- StatusResponseServiceNameObject$`ok`
      }
      if (!is.null(StatusResponseServiceNameObject$`messages`)) {
        self$`messages` <- ApiClient$new()$deserializeObj(StatusResponseServiceNameObject$`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(StatusResponseServiceNameJson) {
      StatusResponseServiceNameObject <- jsonlite::fromJSON(StatusResponseServiceNameJson)
      self$`ok` <- StatusResponseServiceNameObject$`ok`
      self$`messages` <- ApiClient$new()$deserializeObj(StatusResponseServiceNameObject$`messages`, "array[character]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.