R/research_purpose.R

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

#' @docType class
#' @title ResearchPurpose
#'
#' @description ResearchPurpose Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field DS  list( character ) 
#'
#' @field NMDS  character 
#'
#' @field NCTRL  character 
#'
#' @field NAGR  character 
#'
#' @field POA  character 
#'
#' @field NCU  character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ResearchPurpose <- R6::R6Class(
  'ResearchPurpose',
  public = list(
    `DS` = NULL,
    `NMDS` = NULL,
    `NCTRL` = NULL,
    `NAGR` = NULL,
    `POA` = NULL,
    `NCU` = NULL,
    initialize = function(
        `DS`, `NMDS`, `NCTRL`, `NAGR`, `POA`, `NCU`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`DS`)) {
        stopifnot(is.vector(`DS`), length(`DS`) != 0)
        sapply(`DS`, function(x) stopifnot(is.character(x)))
        self$`DS` <- `DS`
      }
      if (!missing(`NMDS`)) {
        self$`NMDS` <- `NMDS`
      }
      if (!missing(`NCTRL`)) {
        self$`NCTRL` <- `NCTRL`
      }
      if (!missing(`NAGR`)) {
        self$`NAGR` <- `NAGR`
      }
      if (!missing(`POA`)) {
        self$`POA` <- `POA`
      }
      if (!missing(`NCU`)) {
        self$`NCU` <- `NCU`
      }
    },
    toJSON = function() {
      ResearchPurposeObject <- list()
      if (!is.null(self$`DS`)) {
        ResearchPurposeObject[['DS']] <-
          self$`DS`
      }
      if (!is.null(self$`NMDS`)) {
        ResearchPurposeObject[['NMDS']] <-
          self$`NMDS`
      }
      if (!is.null(self$`NCTRL`)) {
        ResearchPurposeObject[['NCTRL']] <-
          self$`NCTRL`
      }
      if (!is.null(self$`NAGR`)) {
        ResearchPurposeObject[['NAGR']] <-
          self$`NAGR`
      }
      if (!is.null(self$`POA`)) {
        ResearchPurposeObject[['POA']] <-
          self$`POA`
      }
      if (!is.null(self$`NCU`)) {
        ResearchPurposeObject[['NCU']] <-
          self$`NCU`
      }

      ResearchPurposeObject
    },
    fromJSON = function(ResearchPurposeJson) {
      ResearchPurposeObject <- jsonlite::fromJSON(ResearchPurposeJson)
      if (!is.null(ResearchPurposeObject$`DS`)) {
        self$`DS` <- ApiClient$new()$deserializeObj(ResearchPurposeObject$`DS`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ResearchPurposeObject$`NMDS`)) {
        self$`NMDS` <- ResearchPurposeObject$`NMDS`
      }
      if (!is.null(ResearchPurposeObject$`NCTRL`)) {
        self$`NCTRL` <- ResearchPurposeObject$`NCTRL`
      }
      if (!is.null(ResearchPurposeObject$`NAGR`)) {
        self$`NAGR` <- ResearchPurposeObject$`NAGR`
      }
      if (!is.null(ResearchPurposeObject$`POA`)) {
        self$`POA` <- ResearchPurposeObject$`POA`
      }
      if (!is.null(ResearchPurposeObject$`NCU`)) {
        self$`NCU` <- ResearchPurposeObject$`NCU`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`DS`)) {
        sprintf(
        '"DS":
           [%s]
        ',
        paste(unlist(lapply(self$`DS`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`NMDS`)) {
        sprintf(
        '"NMDS":
          "%s"
                ',
        self$`NMDS`
        )},
        if (!is.null(self$`NCTRL`)) {
        sprintf(
        '"NCTRL":
          "%s"
                ',
        self$`NCTRL`
        )},
        if (!is.null(self$`NAGR`)) {
        sprintf(
        '"NAGR":
          "%s"
                ',
        self$`NAGR`
        )},
        if (!is.null(self$`POA`)) {
        sprintf(
        '"POA":
          "%s"
                ',
        self$`POA`
        )},
        if (!is.null(self$`NCU`)) {
        sprintf(
        '"NCU":
          "%s"
                ',
        self$`NCU`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ResearchPurposeJson) {
      ResearchPurposeObject <- jsonlite::fromJSON(ResearchPurposeJson)
      self$`DS` <- ApiClient$new()$deserializeObj(ResearchPurposeObject$`DS`, "array[character]", loadNamespace("openapi"))
      self$`NMDS` <- ResearchPurposeObject$`NMDS`
      self$`NCTRL` <- ResearchPurposeObject$`NCTRL`
      self$`NAGR` <- ResearchPurposeObject$`NAGR`
      self$`POA` <- ResearchPurposeObject$`POA`
      self$`NCU` <- ResearchPurposeObject$`NCU`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.