R/tool_output_parameter.R

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

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

      ToolOutputParameterObject
    },
    fromJSON = function(ToolOutputParameterJson) {
      ToolOutputParameterObject <- jsonlite::fromJSON(ToolOutputParameterJson)
      if (!is.null(ToolOutputParameterObject$`name`)) {
        self$`name` <- ToolOutputParameterObject$`name`
      }
      if (!is.null(ToolOutputParameterObject$`valueType`)) {
        valueTypeObject <- ValueType$new()
        valueTypeObject$fromJSON(jsonlite::toJSON(ToolOutputParameterObject$valueType, auto_unbox = TRUE, digits = NA))
        self$`valueType` <- valueTypeObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`valueType`)) {
        sprintf(
        '"valueType":
        %s
        ',
        jsonlite::toJSON(self$`valueType`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ToolOutputParameterJson) {
      ToolOutputParameterObject <- jsonlite::fromJSON(ToolOutputParameterJson)
      self$`name` <- ToolOutputParameterObject$`name`
      self$`valueType` <- ValueType$new()$fromJSON(jsonlite::toJSON(ToolOutputParameterObject$valueType, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.