R/dataset_permission.R

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

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

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