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


#' InlineResponse20021Data Class
#'
#' @field datum 
#' @field owner 
#' @field versions 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20021Data <- R6::R6Class(
  'InlineResponse20021Data',
  public = list(
    `datum` = NULL,
    `owner` = NULL,
    `versions` = NULL,
    initialize = function(`datum`, `owner`, `versions`){
      if (!missing(`datum`)) {
        stopifnot(R6::is.R6(`datum`))
        self$`datum` <- `datum`
      }
      if (!missing(`owner`)) {
        stopifnot(is.character(`owner`), length(`owner`) == 1)
        self$`owner` <- `owner`
      }
      if (!missing(`versions`)) {
        stopifnot(is.list(`versions`), length(`versions`) != 0)
        lapply(`versions`, function(x) stopifnot(R6::is.R6(x)))
        self$`versions` <- `versions`
      }
    },
    toJSON = function() {
      InlineResponse20021DataObject <- list()
      if (!is.null(self$`datum`)) {
        InlineResponse20021DataObject[['datum']] <- self$`datum`$toJSON()
      }
      if (!is.null(self$`owner`)) {
        InlineResponse20021DataObject[['owner']] <- self$`owner`
      }
      if (!is.null(self$`versions`)) {
        InlineResponse20021DataObject[['versions']] <- lapply(self$`versions`, function(x) x$toJSON())
      }

      InlineResponse20021DataObject
    },
    fromJSON = function(InlineResponse20021DataJson) {
      InlineResponse20021DataObject <- jsonlite::fromJSON(InlineResponse20021DataJson)
      if (!is.null(InlineResponse20021DataObject$`datum`)) {
        datumObject <- DatumModel$new()
        datumObject$fromJSON(jsonlite::toJSON(InlineResponse20021DataObject$datum, auto_unbox = TRUE))
        self$`datum` <- datumObject
      }
      if (!is.null(InlineResponse20021DataObject$`owner`)) {
        self$`owner` <- InlineResponse20021DataObject$`owner`
      }
      if (!is.null(InlineResponse20021DataObject$`versions`)) {
        self$`versions` <- lapply(InlineResponse20021DataObject$`versions`, function(x) {
          versionsObject <- InlineResponse20021DataVersions$new()
          versionsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          versionsObject
        })
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "datum": %s,
           "owner": %s,
           "versions": [%s]
        }',
        self$`datum`$toJSON(),
        self$`owner`,
        lapply(self$`versions`, function(x) paste(x$toJSON(), sep=","))
      )
    },
    fromJSONString = function(InlineResponse20021DataJson) {
      InlineResponse20021DataObject <- jsonlite::fromJSON(InlineResponse20021DataJson)
      DatumModelObject <- DatumModel$new()
      self$`datum` <- DatumModelObject$fromJSON(jsonlite::toJSON(InlineResponse20021DataObject$datum, auto_unbox = TRUE))
      self$`owner` <- InlineResponse20021DataObject$`owner`
      self$`versions` <- lapply(InlineResponse20021DataObject$`versions`, function(x) InlineResponse20021DataVersions$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.