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


#' ModelCatalogMetricsInner Class
#'
#' @field name 
#' @field metrics 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ModelCatalogMetricsInner <- R6::R6Class(
  'ModelCatalogMetricsInner',
  public = list(
    `name` = NULL,
    `metrics` = NULL,
    initialize = function(`name`, `metrics`){
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`metrics`)) {
        stopifnot(R6::is.R6(`metrics`))
        self$`metrics` <- `metrics`
      }
    },
    toJSON = function() {
      ModelCatalogMetricsInnerObject <- list()
      if (!is.null(self$`name`)) {
        ModelCatalogMetricsInnerObject[['name']] <- self$`name`
      }
      if (!is.null(self$`metrics`)) {
        ModelCatalogMetricsInnerObject[['metrics']] <- self$`metrics`$toJSON()
      }

      ModelCatalogMetricsInnerObject
    },
    fromJSON = function(ModelCatalogMetricsInnerJson) {
      ModelCatalogMetricsInnerObject <- jsonlite::fromJSON(ModelCatalogMetricsInnerJson)
      if (!is.null(ModelCatalogMetricsInnerObject$`name`)) {
        self$`name` <- ModelCatalogMetricsInnerObject$`name`
      }
      if (!is.null(ModelCatalogMetricsInnerObject$`metrics`)) {
        metricsObject <- Metrics$new()
        metricsObject$fromJSON(jsonlite::toJSON(ModelCatalogMetricsInnerObject$metrics, auto_unbox = TRUE))
        self$`metrics` <- metricsObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "name": %s,
           "metrics": %s
        }',
        self$`name`,
        self$`metrics`$toJSON()
      )
    },
    fromJSONString = function(ModelCatalogMetricsInnerJson) {
      ModelCatalogMetricsInnerObject <- jsonlite::fromJSON(ModelCatalogMetricsInnerJson)
      self$`name` <- ModelCatalogMetricsInnerObject$`name`
      MetricsObject <- Metrics$new()
      self$`metrics` <- MetricsObject$fromJSON(jsonlite::toJSON(ModelCatalogMetricsInnerObject$metrics, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.