R/submission_validation_value.R

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

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

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