R/rawls_me.R

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

#' @docType class
#' @title RawlsMe
#'
#' @description RawlsMe Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field userInfo  \link{UserInfo} [optional]
#'
#' @field enabled  \link{ExtendedEnabled} [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
RawlsMe <- R6::R6Class(
  'RawlsMe',
  public = list(
    `userInfo` = NULL,
    `enabled` = NULL,
    initialize = function(
        `userInfo`=NULL, `enabled`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`userInfo`)) {
        stopifnot(R6::is.R6(`userInfo`))
        self$`userInfo` <- `userInfo`
      }
      if (!is.null(`enabled`)) {
        stopifnot(R6::is.R6(`enabled`))
        self$`enabled` <- `enabled`
      }
    },
    toJSON = function() {
      RawlsMeObject <- list()
      if (!is.null(self$`userInfo`)) {
        RawlsMeObject[['userInfo']] <-
          self$`userInfo`$toJSON()
      }
      if (!is.null(self$`enabled`)) {
        RawlsMeObject[['enabled']] <-
          self$`enabled`$toJSON()
      }

      RawlsMeObject
    },
    fromJSON = function(RawlsMeJson) {
      RawlsMeObject <- jsonlite::fromJSON(RawlsMeJson)
      if (!is.null(RawlsMeObject$`userInfo`)) {
        userInfoObject <- UserInfo$new()
        userInfoObject$fromJSON(jsonlite::toJSON(RawlsMeObject$userInfo, auto_unbox = TRUE, digits = NA))
        self$`userInfo` <- userInfoObject
      }
      if (!is.null(RawlsMeObject$`enabled`)) {
        enabledObject <- ExtendedEnabled$new()
        enabledObject$fromJSON(jsonlite::toJSON(RawlsMeObject$enabled, auto_unbox = TRUE, digits = NA))
        self$`enabled` <- enabledObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`userInfo`)) {
        sprintf(
        '"userInfo":
        %s
        ',
        jsonlite::toJSON(self$`userInfo`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`enabled`)) {
        sprintf(
        '"enabled":
        %s
        ',
        jsonlite::toJSON(self$`enabled`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(RawlsMeJson) {
      RawlsMeObject <- jsonlite::fromJSON(RawlsMeJson)
      self$`userInfo` <- UserInfo$new()$fromJSON(jsonlite::toJSON(RawlsMeObject$userInfo, auto_unbox = TRUE, digits = NA))
      self$`enabled` <- ExtendedEnabled$new()$fromJSON(jsonlite::toJSON(RawlsMeObject$enabled, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.