R/submission_validation_header.R

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

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

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