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


#' ModelCatalogItemVersion Class
#'
#' @field version 
#' @field name 
#' @field publisher 
#' @field owner 
#' @field model 
#' @field serving 
#' @field training 
#' @field stage 
#' @field staged 
#' @field description 
#' @field publishedTimestamp 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ModelCatalogItemVersion <- R6::R6Class(
  'ModelCatalogItemVersion',
  public = list(
    `version` = NULL,
    `name` = NULL,
    `publisher` = NULL,
    `owner` = NULL,
    `model` = NULL,
    `serving` = NULL,
    `training` = NULL,
    `stage` = NULL,
    `staged` = NULL,
    `description` = NULL,
    `publishedTimestamp` = NULL,
    initialize = function(`version`, `name`, `publisher`, `owner`, `model`, `serving`, `training`, `stage`, `staged`, `description`, `publishedTimestamp`){
      if (!missing(`version`)) {
        stopifnot(is.character(`version`), length(`version`) == 1)
        self$`version` <- `version`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`publisher`)) {
        stopifnot(is.character(`publisher`), length(`publisher`) == 1)
        self$`publisher` <- `publisher`
      }
      if (!missing(`owner`)) {
        stopifnot(is.character(`owner`), length(`owner`) == 1)
        self$`owner` <- `owner`
      }
      if (!missing(`model`)) {
        stopifnot(R6::is.R6(`model`))
        self$`model` <- `model`
      }
      if (!missing(`serving`)) {
        stopifnot(R6::is.R6(`serving`))
        self$`serving` <- `serving`
      }
      if (!missing(`training`)) {
        stopifnot(R6::is.R6(`training`))
        self$`training` <- `training`
      }
      if (!missing(`stage`)) {
        stopifnot(is.character(`stage`), length(`stage`) == 1)
        self$`stage` <- `stage`
      }
      if (!missing(`staged`)) {
        self$`staged` <- `staged`
      }
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`publishedTimestamp`)) {
        stopifnot(R6::is.R6(`publishedTimestamp`))
        self$`publishedTimestamp` <- `publishedTimestamp`
      }
    },
    toJSON = function() {
      ModelCatalogItemVersionObject <- list()
      if (!is.null(self$`version`)) {
        ModelCatalogItemVersionObject[['version']] <- self$`version`
      }
      if (!is.null(self$`name`)) {
        ModelCatalogItemVersionObject[['name']] <- self$`name`
      }
      if (!is.null(self$`publisher`)) {
        ModelCatalogItemVersionObject[['publisher']] <- self$`publisher`
      }
      if (!is.null(self$`owner`)) {
        ModelCatalogItemVersionObject[['owner']] <- self$`owner`
      }
      if (!is.null(self$`model`)) {
        ModelCatalogItemVersionObject[['model']] <- self$`model`$toJSON()
      }
      if (!is.null(self$`serving`)) {
        ModelCatalogItemVersionObject[['serving']] <- self$`serving`$toJSON()
      }
      if (!is.null(self$`training`)) {
        ModelCatalogItemVersionObject[['training']] <- self$`training`$toJSON()
      }
      if (!is.null(self$`stage`)) {
        ModelCatalogItemVersionObject[['stage']] <- self$`stage`
      }
      if (!is.null(self$`staged`)) {
        ModelCatalogItemVersionObject[['staged']] <- self$`staged`
      }
      if (!is.null(self$`description`)) {
        ModelCatalogItemVersionObject[['description']] <- self$`description`
      }
      if (!is.null(self$`publishedTimestamp`)) {
        ModelCatalogItemVersionObject[['publishedTimestamp']] <- self$`publishedTimestamp`$toJSON()
      }

      ModelCatalogItemVersionObject
    },
    fromJSON = function(ModelCatalogItemVersionJson) {
      ModelCatalogItemVersionObject <- jsonlite::fromJSON(ModelCatalogItemVersionJson)
      if (!is.null(ModelCatalogItemVersionObject$`version`)) {
        self$`version` <- ModelCatalogItemVersionObject$`version`
      }
      if (!is.null(ModelCatalogItemVersionObject$`name`)) {
        self$`name` <- ModelCatalogItemVersionObject$`name`
      }
      if (!is.null(ModelCatalogItemVersionObject$`publisher`)) {
        self$`publisher` <- ModelCatalogItemVersionObject$`publisher`
      }
      if (!is.null(ModelCatalogItemVersionObject$`owner`)) {
        self$`owner` <- ModelCatalogItemVersionObject$`owner`
      }
      if (!is.null(ModelCatalogItemVersionObject$`model`)) {
        modelObject <- ModelTrainingInfoFeaturesets$new()
        modelObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$model, auto_unbox = TRUE))
        self$`model` <- modelObject
      }
      if (!is.null(ModelCatalogItemVersionObject$`serving`)) {
        servingObject <- ModelServingInfo$new()
        servingObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$serving, auto_unbox = TRUE))
        self$`serving` <- servingObject
      }
      if (!is.null(ModelCatalogItemVersionObject$`training`)) {
        trainingObject <- ModelTrainingInfo$new()
        trainingObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$training, auto_unbox = TRUE))
        self$`training` <- trainingObject
      }
      if (!is.null(ModelCatalogItemVersionObject$`stage`)) {
        self$`stage` <- ModelCatalogItemVersionObject$`stage`
      }
      if (!is.null(ModelCatalogItemVersionObject$`staged`)) {
        self$`staged` <- ModelCatalogItemVersionObject$`staged`
      }
      if (!is.null(ModelCatalogItemVersionObject$`description`)) {
        self$`description` <- ModelCatalogItemVersionObject$`description`
      }
      if (!is.null(ModelCatalogItemVersionObject$`publishedTimestamp`)) {
        publishedTimestampObject <- TimeStamps$new()
        publishedTimestampObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$publishedTimestamp, auto_unbox = TRUE))
        self$`publishedTimestamp` <- publishedTimestampObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "version": %s,
           "name": %s,
           "publisher": %s,
           "owner": %s,
           "model": %s,
           "serving": %s,
           "training": %s,
           "stage": %s,
           "staged": %s,
           "description": %s,
           "publishedTimestamp": %s
        }',
        self$`version`,
        self$`name`,
        self$`publisher`,
        self$`owner`,
        self$`model`$toJSON(),
        self$`serving`$toJSON(),
        self$`training`$toJSON(),
        self$`stage`,
        self$`staged`,
        self$`description`,
        self$`publishedTimestamp`$toJSON()
      )
    },
    fromJSONString = function(ModelCatalogItemVersionJson) {
      ModelCatalogItemVersionObject <- jsonlite::fromJSON(ModelCatalogItemVersionJson)
      self$`version` <- ModelCatalogItemVersionObject$`version`
      self$`name` <- ModelCatalogItemVersionObject$`name`
      self$`publisher` <- ModelCatalogItemVersionObject$`publisher`
      self$`owner` <- ModelCatalogItemVersionObject$`owner`
      ModelTrainingInfoFeaturesetsObject <- ModelTrainingInfoFeaturesets$new()
      self$`model` <- ModelTrainingInfoFeaturesetsObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$model, auto_unbox = TRUE))
      ModelServingInfoObject <- ModelServingInfo$new()
      self$`serving` <- ModelServingInfoObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$serving, auto_unbox = TRUE))
      ModelTrainingInfoObject <- ModelTrainingInfo$new()
      self$`training` <- ModelTrainingInfoObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$training, auto_unbox = TRUE))
      self$`stage` <- ModelCatalogItemVersionObject$`stage`
      self$`staged` <- ModelCatalogItemVersionObject$`staged`
      self$`description` <- ModelCatalogItemVersionObject$`description`
      TimeStampsObject <- TimeStamps$new()
      self$`publishedTimestamp` <- TimeStampsObject$fromJSON(jsonlite::toJSON(ModelCatalogItemVersionObject$publishedTimestamp, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.