R/permission_report_request.R

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

#' @docType class
#' @title PermissionReportRequest
#'
#' @description PermissionReportRequest Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field users  list( character ) [optional]
#'
#' @field configs  list( \link{MethodConfigurationName} ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PermissionReportRequest <- R6::R6Class(
  'PermissionReportRequest',
  public = list(
    `users` = NULL,
    `configs` = NULL,
    initialize = function(
        `users`=NULL, `configs`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`users`)) {
        stopifnot(is.vector(`users`), length(`users`) != 0)
        sapply(`users`, function(x) stopifnot(is.character(x)))
        self$`users` <- `users`
      }
      if (!is.null(`configs`)) {
        stopifnot(is.vector(`configs`), length(`configs`) != 0)
        sapply(`configs`, function(x) stopifnot(R6::is.R6(x)))
        self$`configs` <- `configs`
      }
    },
    toJSON = function() {
      PermissionReportRequestObject <- list()
      if (!is.null(self$`users`)) {
        PermissionReportRequestObject[['users']] <-
          self$`users`
      }
      if (!is.null(self$`configs`)) {
        PermissionReportRequestObject[['configs']] <-
          lapply(self$`configs`, function(x) x$toJSON())
      }

      PermissionReportRequestObject
    },
    fromJSON = function(PermissionReportRequestJson) {
      PermissionReportRequestObject <- jsonlite::fromJSON(PermissionReportRequestJson)
      if (!is.null(PermissionReportRequestObject$`users`)) {
        self$`users` <- ApiClient$new()$deserializeObj(PermissionReportRequestObject$`users`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(PermissionReportRequestObject$`configs`)) {
        self$`configs` <- ApiClient$new()$deserializeObj(PermissionReportRequestObject$`configs`, "array[MethodConfigurationName]", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`users`)) {
        sprintf(
        '"users":
           [%s]
        ',
        paste(unlist(lapply(self$`users`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`configs`)) {
        sprintf(
        '"configs":
        [%s]
',
        paste(sapply(self$`configs`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(PermissionReportRequestJson) {
      PermissionReportRequestObject <- jsonlite::fromJSON(PermissionReportRequestJson)
      self$`users` <- ApiClient$new()$deserializeObj(PermissionReportRequestObject$`users`, "array[character]", loadNamespace("openapi"))
      self$`configs` <- ApiClient$new()$deserializeObj(PermissionReportRequestObject$`configs`, "array[MethodConfigurationName]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.