R/namespace.R

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

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

      NamespaceObject
    },
    fromJSON = function(NamespaceJson) {
      NamespaceObject <- jsonlite::fromJSON(NamespaceJson)
      if (!is.null(NamespaceObject$`namespace`)) {
        self$`namespace` <- NamespaceObject$`namespace`
      }
      if (!is.null(NamespaceObject$`name`)) {
        self$`name` <- NamespaceObject$`name`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(NamespaceJson) {
      NamespaceObject <- jsonlite::fromJSON(NamespaceJson)
      self$`namespace` <- NamespaceObject$`namespace`
      self$`name` <- NamespaceObject$`name`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.