R/submission_validation_entity_inputs.R

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

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

      SubmissionValidationEntityInputsObject
    },
    fromJSON = function(SubmissionValidationEntityInputsJson) {
      SubmissionValidationEntityInputsObject <- jsonlite::fromJSON(SubmissionValidationEntityInputsJson)
      if (!is.null(SubmissionValidationEntityInputsObject$`entityName`)) {
        self$`entityName` <- SubmissionValidationEntityInputsObject$`entityName`
      }
      if (!is.null(SubmissionValidationEntityInputsObject$`inputResolutions`)) {
        self$`inputResolutions` <- ApiClient$new()$deserializeObj(SubmissionValidationEntityInputsObject$`inputResolutions`, "array[SubmissionValidationValue]", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`entityName`)) {
        sprintf(
        '"entityName":
          "%s"
                ',
        self$`entityName`
        )},
        if (!is.null(self$`inputResolutions`)) {
        sprintf(
        '"inputResolutions":
        [%s]
',
        paste(sapply(self$`inputResolutions`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SubmissionValidationEntityInputsJson) {
      SubmissionValidationEntityInputsObject <- jsonlite::fromJSON(SubmissionValidationEntityInputsJson)
      self$`entityName` <- SubmissionValidationEntityInputsObject$`entityName`
      self$`inputResolutions` <- ApiClient$new()$deserializeObj(SubmissionValidationEntityInputsObject$`inputResolutions`, "array[SubmissionValidationValue]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.