R/fire_cloud_permission.R

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

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

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