R/validated_method_configuration.R

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

#' @docType class
#' @title ValidatedMethodConfiguration
#'
#' @description ValidatedMethodConfiguration Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field validInputs  list( character ) 
#'
#' @field invalidInputs  named list( object ) 
#'
#' @field missingInputs  list( character ) 
#'
#' @field extraInputs  list( character ) 
#'
#' @field validOutputs  list( character ) 
#'
#' @field invalidOutputs  named list( object ) 
#'
#' @field methodConfiguration  \link{MethodConfiguration} 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ValidatedMethodConfiguration <- R6::R6Class(
  'ValidatedMethodConfiguration',
  public = list(
    `validInputs` = NULL,
    `invalidInputs` = NULL,
    `missingInputs` = NULL,
    `extraInputs` = NULL,
    `validOutputs` = NULL,
    `invalidOutputs` = NULL,
    `methodConfiguration` = NULL,
    initialize = function(
        `validInputs`, `invalidInputs`, `missingInputs`, `extraInputs`, `validOutputs`, `invalidOutputs`, `methodConfiguration`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`validInputs`)) {
        stopifnot(is.vector(`validInputs`), length(`validInputs`) != 0)
        sapply(`validInputs`, function(x) stopifnot(is.character(x)))
        self$`validInputs` <- `validInputs`
      }
      if (!missing(`invalidInputs`)) {
        stopifnot(is.vector(`invalidInputs`), length(`invalidInputs`) != 0)
        sapply(`invalidInputs`, function(x) stopifnot(is.character(x)))
        self$`invalidInputs` <- `invalidInputs`
      }
      if (!missing(`missingInputs`)) {
        stopifnot(is.vector(`missingInputs`), length(`missingInputs`) != 0)
        sapply(`missingInputs`, function(x) stopifnot(is.character(x)))
        self$`missingInputs` <- `missingInputs`
      }
      if (!missing(`extraInputs`)) {
        stopifnot(is.vector(`extraInputs`), length(`extraInputs`) != 0)
        sapply(`extraInputs`, function(x) stopifnot(is.character(x)))
        self$`extraInputs` <- `extraInputs`
      }
      if (!missing(`validOutputs`)) {
        stopifnot(is.vector(`validOutputs`), length(`validOutputs`) != 0)
        sapply(`validOutputs`, function(x) stopifnot(is.character(x)))
        self$`validOutputs` <- `validOutputs`
      }
      if (!missing(`invalidOutputs`)) {
        stopifnot(is.vector(`invalidOutputs`), length(`invalidOutputs`) != 0)
        sapply(`invalidOutputs`, function(x) stopifnot(is.character(x)))
        self$`invalidOutputs` <- `invalidOutputs`
      }
      if (!missing(`methodConfiguration`)) {
        stopifnot(R6::is.R6(`methodConfiguration`))
        self$`methodConfiguration` <- `methodConfiguration`
      }
    },
    toJSON = function() {
      ValidatedMethodConfigurationObject <- list()
      if (!is.null(self$`validInputs`)) {
        ValidatedMethodConfigurationObject[['validInputs']] <-
          self$`validInputs`
      }
      if (!is.null(self$`invalidInputs`)) {
        ValidatedMethodConfigurationObject[['invalidInputs']] <-
          self$`invalidInputs`
      }
      if (!is.null(self$`missingInputs`)) {
        ValidatedMethodConfigurationObject[['missingInputs']] <-
          self$`missingInputs`
      }
      if (!is.null(self$`extraInputs`)) {
        ValidatedMethodConfigurationObject[['extraInputs']] <-
          self$`extraInputs`
      }
      if (!is.null(self$`validOutputs`)) {
        ValidatedMethodConfigurationObject[['validOutputs']] <-
          self$`validOutputs`
      }
      if (!is.null(self$`invalidOutputs`)) {
        ValidatedMethodConfigurationObject[['invalidOutputs']] <-
          self$`invalidOutputs`
      }
      if (!is.null(self$`methodConfiguration`)) {
        ValidatedMethodConfigurationObject[['methodConfiguration']] <-
          self$`methodConfiguration`$toJSON()
      }

      ValidatedMethodConfigurationObject
    },
    fromJSON = function(ValidatedMethodConfigurationJson) {
      ValidatedMethodConfigurationObject <- jsonlite::fromJSON(ValidatedMethodConfigurationJson)
      if (!is.null(ValidatedMethodConfigurationObject$`validInputs`)) {
        self$`validInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`validInputs`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ValidatedMethodConfigurationObject$`invalidInputs`)) {
        self$`invalidInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`invalidInputs`, "map(object)", loadNamespace("openapi"))
      }
      if (!is.null(ValidatedMethodConfigurationObject$`missingInputs`)) {
        self$`missingInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`missingInputs`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ValidatedMethodConfigurationObject$`extraInputs`)) {
        self$`extraInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`extraInputs`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ValidatedMethodConfigurationObject$`validOutputs`)) {
        self$`validOutputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`validOutputs`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ValidatedMethodConfigurationObject$`invalidOutputs`)) {
        self$`invalidOutputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`invalidOutputs`, "map(object)", loadNamespace("openapi"))
      }
      if (!is.null(ValidatedMethodConfigurationObject$`methodConfiguration`)) {
        methodConfigurationObject <- MethodConfiguration$new()
        methodConfigurationObject$fromJSON(jsonlite::toJSON(ValidatedMethodConfigurationObject$methodConfiguration, auto_unbox = TRUE, digits = NA))
        self$`methodConfiguration` <- methodConfigurationObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`validInputs`)) {
        sprintf(
        '"validInputs":
           [%s]
        ',
        paste(unlist(lapply(self$`validInputs`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`invalidInputs`)) {
        sprintf(
        '"invalidInputs":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`invalidInputs`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )},
        if (!is.null(self$`missingInputs`)) {
        sprintf(
        '"missingInputs":
           [%s]
        ',
        paste(unlist(lapply(self$`missingInputs`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`extraInputs`)) {
        sprintf(
        '"extraInputs":
           [%s]
        ',
        paste(unlist(lapply(self$`extraInputs`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`validOutputs`)) {
        sprintf(
        '"validOutputs":
           [%s]
        ',
        paste(unlist(lapply(self$`validOutputs`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`invalidOutputs`)) {
        sprintf(
        '"invalidOutputs":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`invalidOutputs`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )},
        if (!is.null(self$`methodConfiguration`)) {
        sprintf(
        '"methodConfiguration":
        %s
        ',
        jsonlite::toJSON(self$`methodConfiguration`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ValidatedMethodConfigurationJson) {
      ValidatedMethodConfigurationObject <- jsonlite::fromJSON(ValidatedMethodConfigurationJson)
      self$`validInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`validInputs`, "array[character]", loadNamespace("openapi"))
      self$`invalidInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`invalidInputs`, "map(object)", loadNamespace("openapi"))
      self$`missingInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`missingInputs`, "array[character]", loadNamespace("openapi"))
      self$`extraInputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`extraInputs`, "array[character]", loadNamespace("openapi"))
      self$`validOutputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`validOutputs`, "array[character]", loadNamespace("openapi"))
      self$`invalidOutputs` <- ApiClient$new()$deserializeObj(ValidatedMethodConfigurationObject$`invalidOutputs`, "map(object)", loadNamespace("openapi"))
      self$`methodConfiguration` <- MethodConfiguration$new()$fromJSON(jsonlite::toJSON(ValidatedMethodConfigurationObject$methodConfiguration, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.