R/research_purpose_request.R

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

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

      ResearchPurposeRequestObject
    },
    fromJSON = function(ResearchPurposeRequestJson) {
      ResearchPurposeRequestObject <- jsonlite::fromJSON(ResearchPurposeRequestJson)
      if (!is.null(ResearchPurposeRequestObject$`DS`)) {
        self$`DS` <- ApiClient$new()$deserializeObj(ResearchPurposeRequestObject$`DS`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ResearchPurposeRequestObject$`NMDS`)) {
        self$`NMDS` <- ResearchPurposeRequestObject$`NMDS`
      }
      if (!is.null(ResearchPurposeRequestObject$`NCTRL`)) {
        self$`NCTRL` <- ResearchPurposeRequestObject$`NCTRL`
      }
      if (!is.null(ResearchPurposeRequestObject$`NAGR`)) {
        self$`NAGR` <- ResearchPurposeRequestObject$`NAGR`
      }
      if (!is.null(ResearchPurposeRequestObject$`POA`)) {
        self$`POA` <- ResearchPurposeRequestObject$`POA`
      }
      if (!is.null(ResearchPurposeRequestObject$`NCU`)) {
        self$`NCU` <- ResearchPurposeRequestObject$`NCU`
      }
      if (!is.null(ResearchPurposeRequestObject$`prefix`)) {
        self$`prefix` <- ResearchPurposeRequestObject$`prefix`
      }
      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`
        )},
        if (!is.null(self$`prefix`)) {
        sprintf(
        '"prefix":
          "%s"
                ',
        self$`prefix`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ResearchPurposeRequestJson) {
      ResearchPurposeRequestObject <- jsonlite::fromJSON(ResearchPurposeRequestJson)
      self$`DS` <- ApiClient$new()$deserializeObj(ResearchPurposeRequestObject$`DS`, "array[character]", loadNamespace("openapi"))
      self$`NMDS` <- ResearchPurposeRequestObject$`NMDS`
      self$`NCTRL` <- ResearchPurposeRequestObject$`NCTRL`
      self$`NAGR` <- ResearchPurposeRequestObject$`NAGR`
      self$`POA` <- ResearchPurposeRequestObject$`POA`
      self$`NCU` <- ResearchPurposeRequestObject$`NCU`
      self$`prefix` <- ResearchPurposeRequestObject$`prefix`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.