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


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

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