R/workspace_list_response.R

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

#' @docType class
#' @title WorkspaceListResponse
#'
#' @description WorkspaceListResponse Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field accessLevel  \link{WorkspaceAccessLevel} [optional]
#'
#' @field public  character [optional]
#'
#' @field workspace  \link{WorkspaceDetails} [optional]
#'
#' @field workspaceSubmissionStats  \link{WorkspaceSubmissionStats} [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
WorkspaceListResponse <- R6::R6Class(
  'WorkspaceListResponse',
  public = list(
    `accessLevel` = NULL,
    `public` = NULL,
    `workspace` = NULL,
    `workspaceSubmissionStats` = NULL,
    initialize = function(
        `accessLevel`=NULL, `public`=NULL, `workspace`=NULL, `workspaceSubmissionStats`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`accessLevel`)) {
        stopifnot(R6::is.R6(`accessLevel`))
        self$`accessLevel` <- `accessLevel`
      }
      if (!is.null(`public`)) {
        self$`public` <- `public`
      }
      if (!is.null(`workspace`)) {
        stopifnot(R6::is.R6(`workspace`))
        self$`workspace` <- `workspace`
      }
      if (!is.null(`workspaceSubmissionStats`)) {
        stopifnot(R6::is.R6(`workspaceSubmissionStats`))
        self$`workspaceSubmissionStats` <- `workspaceSubmissionStats`
      }
    },
    toJSON = function() {
      WorkspaceListResponseObject <- list()
      if (!is.null(self$`accessLevel`)) {
        WorkspaceListResponseObject[['accessLevel']] <-
          self$`accessLevel`$toJSON()
      }
      if (!is.null(self$`public`)) {
        WorkspaceListResponseObject[['public']] <-
          self$`public`
      }
      if (!is.null(self$`workspace`)) {
        WorkspaceListResponseObject[['workspace']] <-
          self$`workspace`$toJSON()
      }
      if (!is.null(self$`workspaceSubmissionStats`)) {
        WorkspaceListResponseObject[['workspaceSubmissionStats']] <-
          self$`workspaceSubmissionStats`$toJSON()
      }

      WorkspaceListResponseObject
    },
    fromJSON = function(WorkspaceListResponseJson) {
      WorkspaceListResponseObject <- jsonlite::fromJSON(WorkspaceListResponseJson)
      if (!is.null(WorkspaceListResponseObject$`accessLevel`)) {
        accessLevelObject <- WorkspaceAccessLevel$new()
        accessLevelObject$fromJSON(jsonlite::toJSON(WorkspaceListResponseObject$accessLevel, auto_unbox = TRUE, digits = NA))
        self$`accessLevel` <- accessLevelObject
      }
      if (!is.null(WorkspaceListResponseObject$`public`)) {
        self$`public` <- WorkspaceListResponseObject$`public`
      }
      if (!is.null(WorkspaceListResponseObject$`workspace`)) {
        workspaceObject <- WorkspaceDetails$new()
        workspaceObject$fromJSON(jsonlite::toJSON(WorkspaceListResponseObject$workspace, auto_unbox = TRUE, digits = NA))
        self$`workspace` <- workspaceObject
      }
      if (!is.null(WorkspaceListResponseObject$`workspaceSubmissionStats`)) {
        workspaceSubmissionStatsObject <- WorkspaceSubmissionStats$new()
        workspaceSubmissionStatsObject$fromJSON(jsonlite::toJSON(WorkspaceListResponseObject$workspaceSubmissionStats, auto_unbox = TRUE, digits = NA))
        self$`workspaceSubmissionStats` <- workspaceSubmissionStatsObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`accessLevel`)) {
        sprintf(
        '"accessLevel":
        %s
        ',
        jsonlite::toJSON(self$`accessLevel`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`public`)) {
        sprintf(
        '"public":
          "%s"
                ',
        self$`public`
        )},
        if (!is.null(self$`workspace`)) {
        sprintf(
        '"workspace":
        %s
        ',
        jsonlite::toJSON(self$`workspace`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`workspaceSubmissionStats`)) {
        sprintf(
        '"workspaceSubmissionStats":
        %s
        ',
        jsonlite::toJSON(self$`workspaceSubmissionStats`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(WorkspaceListResponseJson) {
      WorkspaceListResponseObject <- jsonlite::fromJSON(WorkspaceListResponseJson)
      self$`accessLevel` <- WorkspaceAccessLevel$new()$fromJSON(jsonlite::toJSON(WorkspaceListResponseObject$accessLevel, auto_unbox = TRUE, digits = NA))
      self$`public` <- WorkspaceListResponseObject$`public`
      self$`workspace` <- WorkspaceDetails$new()$fromJSON(jsonlite::toJSON(WorkspaceListResponseObject$workspace, auto_unbox = TRUE, digits = NA))
      self$`workspaceSubmissionStats` <- WorkspaceSubmissionStats$new()$fromJSON(jsonlite::toJSON(WorkspaceListResponseObject$workspaceSubmissionStats, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.