R/InlineResponse2003.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


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

      InlineResponse2003Object
    },
    fromJSON = function(InlineResponse2003Json) {
      InlineResponse2003Object <- jsonlite::fromJSON(InlineResponse2003Json)
      if (!is.null(InlineResponse2003Object$`response`)) {
        responseObject <- ApiResponse$new()
        responseObject$fromJSON(jsonlite::toJSON(InlineResponse2003Object$response, auto_unbox = TRUE))
        self$`response` <- responseObject
      }
      if (!is.null(InlineResponse2003Object$`data`)) {
        self$`data` <- lapply(InlineResponse2003Object$`data`, function(x) {
          dataObject <- Cluster$new()
          dataObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          dataObject
        })
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "response": %s,
           "data": [%s]
        }',
        self$`response`$toJSON(),
        lapply(self$`data`, function(x) paste(x$toJSON(), sep=","))
      )
    },
    fromJSONString = function(InlineResponse2003Json) {
      InlineResponse2003Object <- jsonlite::fromJSON(InlineResponse2003Json)
      ApiResponseObject <- ApiResponse$new()
      self$`response` <- ApiResponseObject$fromJSON(jsonlite::toJSON(InlineResponse2003Object$response, auto_unbox = TRUE))
      self$`data` <- lapply(InlineResponse2003Object$`data`, function(x) Cluster$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.