R/submission_validation_report.R

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

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

      SubmissionValidationReportObject
    },
    fromJSON = function(SubmissionValidationReportJson) {
      SubmissionValidationReportObject <- jsonlite::fromJSON(SubmissionValidationReportJson)
      if (!is.null(SubmissionValidationReportObject$`header`)) {
        headerObject <- SubmissionValidationHeader$new()
        headerObject$fromJSON(jsonlite::toJSON(SubmissionValidationReportObject$header, auto_unbox = TRUE, digits = NA))
        self$`header` <- headerObject
      }
      if (!is.null(SubmissionValidationReportObject$`validEntities`)) {
        self$`validEntities` <- ApiClient$new()$deserializeObj(SubmissionValidationReportObject$`validEntities`, "array[SubmissionValidationEntityInputs]", loadNamespace("openapi"))
      }
      if (!is.null(SubmissionValidationReportObject$`invalidEntities`)) {
        self$`invalidEntities` <- ApiClient$new()$deserializeObj(SubmissionValidationReportObject$`invalidEntities`, "array[SubmissionValidationEntityInputs]", loadNamespace("openapi"))
      }
      if (!is.null(SubmissionValidationReportObject$`request`)) {
        requestObject <- SubmissionRequest$new()
        requestObject$fromJSON(jsonlite::toJSON(SubmissionValidationReportObject$request, auto_unbox = TRUE, digits = NA))
        self$`request` <- requestObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`header`)) {
        sprintf(
        '"header":
        %s
        ',
        jsonlite::toJSON(self$`header`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`validEntities`)) {
        sprintf(
        '"validEntities":
        [%s]
',
        paste(sapply(self$`validEntities`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`invalidEntities`)) {
        sprintf(
        '"invalidEntities":
        [%s]
',
        paste(sapply(self$`invalidEntities`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`request`)) {
        sprintf(
        '"request":
        %s
        ',
        jsonlite::toJSON(self$`request`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SubmissionValidationReportJson) {
      SubmissionValidationReportObject <- jsonlite::fromJSON(SubmissionValidationReportJson)
      self$`header` <- SubmissionValidationHeader$new()$fromJSON(jsonlite::toJSON(SubmissionValidationReportObject$header, auto_unbox = TRUE, digits = NA))
      self$`validEntities` <- ApiClient$new()$deserializeObj(SubmissionValidationReportObject$`validEntities`, "array[SubmissionValidationEntityInputs]", loadNamespace("openapi"))
      self$`invalidEntities` <- ApiClient$new()$deserializeObj(SubmissionValidationReportObject$`invalidEntities`, "array[SubmissionValidationEntityInputs]", loadNamespace("openapi"))
      self$`request` <- SubmissionRequest$new()$fromJSON(jsonlite::toJSON(SubmissionValidationReportObject$request, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.