R/failure_message.R

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

#' @docType class
#' @title FailureMessage
#'
#' @description FailureMessage Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field failure  character 
#'
#' @field timestamp  character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
FailureMessage <- R6::R6Class(
  'FailureMessage',
  public = list(
    `failure` = NULL,
    `timestamp` = NULL,
    initialize = function(
        `failure`, `timestamp`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`failure`)) {
        stopifnot(is.character(`failure`), length(`failure`) == 1)
        self$`failure` <- `failure`
      }
      if (!missing(`timestamp`)) {
        stopifnot(is.character(`timestamp`), length(`timestamp`) == 1)
        self$`timestamp` <- `timestamp`
      }
    },
    toJSON = function() {
      FailureMessageObject <- list()
      if (!is.null(self$`failure`)) {
        FailureMessageObject[['failure']] <-
          self$`failure`
      }
      if (!is.null(self$`timestamp`)) {
        FailureMessageObject[['timestamp']] <-
          self$`timestamp`
      }

      FailureMessageObject
    },
    fromJSON = function(FailureMessageJson) {
      FailureMessageObject <- jsonlite::fromJSON(FailureMessageJson)
      if (!is.null(FailureMessageObject$`failure`)) {
        self$`failure` <- FailureMessageObject$`failure`
      }
      if (!is.null(FailureMessageObject$`timestamp`)) {
        self$`timestamp` <- FailureMessageObject$`timestamp`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`failure`)) {
        sprintf(
        '"failure":
          "%s"
                ',
        self$`failure`
        )},
        if (!is.null(self$`timestamp`)) {
        sprintf(
        '"timestamp":
          "%s"
                ',
        self$`timestamp`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(FailureMessageJson) {
      FailureMessageObject <- jsonlite::fromJSON(FailureMessageJson)
      self$`failure` <- FailureMessageObject$`failure`
      self$`timestamp` <- FailureMessageObject$`timestamp`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.