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


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

      InlineResponse20022DataObject
    },
    fromJSON = function(InlineResponse20022DataJson) {
      InlineResponse20022DataObject <- jsonlite::fromJSON(InlineResponse20022DataJson)
      if (!is.null(InlineResponse20022DataObject$`owner`)) {
        self$`owner` <- InlineResponse20022DataObject$`owner`
      }
      if (!is.null(InlineResponse20022DataObject$`datums`)) {
        self$`datums` <- lapply(InlineResponse20022DataObject$`datums`, function(x) {
          datumsObject <- InlineResponse20022Datums$new()
          datumsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))
          datumsObject
        })
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "owner": %s,
           "datums": [%s]
        }',
        self$`owner`,
        lapply(self$`datums`, function(x) paste(x$toJSON(), sep=","))
      )
    },
    fromJSONString = function(InlineResponse20022DataJson) {
      InlineResponse20022DataObject <- jsonlite::fromJSON(InlineResponse20022DataJson)
      self$`owner` <- InlineResponse20022DataObject$`owner`
      self$`datums` <- lapply(InlineResponse20022DataObject$`datums`, function(x) InlineResponse20022Datums$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.