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


#' PluginModelGenerated Class
#'
#' @field uuid 
#' @field user 
#' @field status 
#' @field timestamps 
#' @field service_name 
#' @field service_port 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PluginModelGenerated <- R6::R6Class(
  'PluginModelGenerated',
  public = list(
    `uuid` = NULL,
    `user` = NULL,
    `status` = NULL,
    `timestamps` = NULL,
    `service_name` = NULL,
    `service_port` = NULL,
    initialize = function(`uuid`, `user`, `status`, `timestamps`, `service_name`, `service_port`){
      if (!missing(`uuid`)) {
        stopifnot(is.character(`uuid`), length(`uuid`) == 1)
        self$`uuid` <- `uuid`
      }
      if (!missing(`user`)) {
        stopifnot(is.character(`user`), length(`user`) == 1)
        self$`user` <- `user`
      }
      if (!missing(`status`)) {
        stopifnot(R6::is.R6(`status`))
        self$`status` <- `status`
      }
      if (!missing(`timestamps`)) {
        stopifnot(R6::is.R6(`timestamps`))
        self$`timestamps` <- `timestamps`
      }
      if (!missing(`service_name`)) {
        stopifnot(is.character(`service_name`), length(`service_name`) == 1)
        self$`service_name` <- `service_name`
      }
      if (!missing(`service_port`)) {
        stopifnot(is.character(`service_port`), length(`service_port`) == 1)
        self$`service_port` <- `service_port`
      }
    },
    toJSON = function() {
      PluginModelGeneratedObject <- list()
      if (!is.null(self$`uuid`)) {
        PluginModelGeneratedObject[['uuid']] <- self$`uuid`
      }
      if (!is.null(self$`user`)) {
        PluginModelGeneratedObject[['user']] <- self$`user`
      }
      if (!is.null(self$`status`)) {
        PluginModelGeneratedObject[['status']] <- self$`status`$toJSON()
      }
      if (!is.null(self$`timestamps`)) {
        PluginModelGeneratedObject[['timestamps']] <- self$`timestamps`$toJSON()
      }
      if (!is.null(self$`service_name`)) {
        PluginModelGeneratedObject[['service_name']] <- self$`service_name`
      }
      if (!is.null(self$`service_port`)) {
        PluginModelGeneratedObject[['service_port']] <- self$`service_port`
      }

      PluginModelGeneratedObject
    },
    fromJSON = function(PluginModelGeneratedJson) {
      PluginModelGeneratedObject <- jsonlite::fromJSON(PluginModelGeneratedJson)
      if (!is.null(PluginModelGeneratedObject$`uuid`)) {
        self$`uuid` <- PluginModelGeneratedObject$`uuid`
      }
      if (!is.null(PluginModelGeneratedObject$`user`)) {
        self$`user` <- PluginModelGeneratedObject$`user`
      }
      if (!is.null(PluginModelGeneratedObject$`status`)) {
        statusObject <- PluginStatusModel$new()
        statusObject$fromJSON(jsonlite::toJSON(PluginModelGeneratedObject$status, auto_unbox = TRUE))
        self$`status` <- statusObject
      }
      if (!is.null(PluginModelGeneratedObject$`timestamps`)) {
        timestampsObject <- TimeStamps$new()
        timestampsObject$fromJSON(jsonlite::toJSON(PluginModelGeneratedObject$timestamps, auto_unbox = TRUE))
        self$`timestamps` <- timestampsObject
      }
      if (!is.null(PluginModelGeneratedObject$`service_name`)) {
        self$`service_name` <- PluginModelGeneratedObject$`service_name`
      }
      if (!is.null(PluginModelGeneratedObject$`service_port`)) {
        self$`service_port` <- PluginModelGeneratedObject$`service_port`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "uuid": %s,
           "user": %s,
           "status": %s,
           "timestamps": %s,
           "service_name": %s,
           "service_port": %s
        }',
        self$`uuid`,
        self$`user`,
        self$`status`$toJSON(),
        self$`timestamps`$toJSON(),
        self$`service_name`,
        self$`service_port`
      )
    },
    fromJSONString = function(PluginModelGeneratedJson) {
      PluginModelGeneratedObject <- jsonlite::fromJSON(PluginModelGeneratedJson)
      self$`uuid` <- PluginModelGeneratedObject$`uuid`
      self$`user` <- PluginModelGeneratedObject$`user`
      PluginStatusModelObject <- PluginStatusModel$new()
      self$`status` <- PluginStatusModelObject$fromJSON(jsonlite::toJSON(PluginModelGeneratedObject$status, auto_unbox = TRUE))
      TimeStampsObject <- TimeStamps$new()
      self$`timestamps` <- TimeStampsObject$fromJSON(jsonlite::toJSON(PluginModelGeneratedObject$timestamps, auto_unbox = TRUE))
      self$`service_name` <- PluginModelGeneratedObject$`service_name`
      self$`service_port` <- PluginModelGeneratedObject$`service_port`
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.