R/InlineResponse20045Data.r

# Dkube api server
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 2.2.1.11
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' InlineResponse20045Data Class
#'
#' @field healthy 
#' @field unhealthy 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20045Data <- R6::R6Class(
  'InlineResponse20045Data',
  public = list(
    `healthy` = NULL,
    `unhealthy` = NULL,
    initialize = function(`healthy`, `unhealthy`){
      if (!missing(`healthy`)) {
        stopifnot(is.list(`healthy`), length(`healthy`) != 0)
        lapply(`healthy`, function(x) stopifnot(R6::is.R6(x)))
        self$`healthy` <- `healthy`
      }
      if (!missing(`unhealthy`)) {
        stopifnot(is.list(`unhealthy`), length(`unhealthy`) != 0)
        lapply(`unhealthy`, function(x) stopifnot(R6::is.R6(x)))
        self$`unhealthy` <- `unhealthy`
      }
    },
    toJSON = function() {
      InlineResponse20045DataObject <- list()
      if (!is.null(self$`healthy`)) {
        InlineResponse20045DataObject[['healthy']] <- lapply(self$`healthy`, function(x) x$toJSON())
      }
      if (!is.null(self$`unhealthy`)) {
        InlineResponse20045DataObject[['unhealthy']] <- lapply(self$`unhealthy`, function(x) x$toJSON())
      }

      InlineResponse20045DataObject
    },
    fromJSON = function(InlineResponse20045DataJson) {
      InlineResponse20045DataObject <- jsonlite::fromJSON(InlineResponse20045DataJson)
      if (!is.null(InlineResponse20045DataObject$`healthy`)) {
        self$`healthy` <- lapply(InlineResponse20045DataObject$`healthy`, function(x) {
          healthyObject <- NodeCollection$new()
          healthyObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          healthyObject
        })
      }
      if (!is.null(InlineResponse20045DataObject$`unhealthy`)) {
        self$`unhealthy` <- lapply(InlineResponse20045DataObject$`unhealthy`, function(x) {
          unhealthyObject <- NodeCollection$new()
          unhealthyObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          unhealthyObject
        })
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "healthy": [%s],
           "unhealthy": [%s]
        }',
        lapply(self$`healthy`, function(x) paste(x$toJSON(), sep=",")),
        lapply(self$`unhealthy`, function(x) paste(x$toJSON(), sep=","))
      )
    },
    fromJSONString = function(InlineResponse20045DataJson) {
      InlineResponse20045DataObject <- jsonlite::fromJSON(InlineResponse20045DataJson)
      self$`healthy` <- lapply(InlineResponse20045DataObject$`healthy`, function(x) NodeCollection$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`unhealthy` <- lapply(InlineResponse20045DataObject$`unhealthy`, function(x) NodeCollection$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.