R/task_graph_log.R

# TileDB Storage Platform API
#
# TileDB Storage Platform REST API
#
# The version of the OpenAPI document: 2.2.19
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title TaskGraphLog
#'
#' @description TaskGraphLog Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field uuid  character [optional]
#'
#' @field namespace  character [optional]
#'
#' @field created_by  character [optional]
#'
#' @field name  character [optional]
#'
#' @field created_at  character [optional]
#'
#' @field start_time  character [optional]
#'
#' @field end_time  character [optional]
#'
#' @field status  \link{TaskGraphLogStatus} [optional]
#'
#' @field nodes  list( \link{TaskGraphNodeMetadata} ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TaskGraphLog <- R6::R6Class(
  'TaskGraphLog',
  public = list(
    `uuid` = NULL,
    `namespace` = NULL,
    `created_by` = NULL,
    `name` = NULL,
    `created_at` = NULL,
    `start_time` = NULL,
    `end_time` = NULL,
    `status` = NULL,
    `nodes` = NULL,
    initialize = function(
        `uuid`=NULL, `namespace`=NULL, `created_by`=NULL, `name`=NULL, `created_at`=NULL, `start_time`=NULL, `end_time`=NULL, `status`=NULL, `nodes`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`uuid`)) {
        stopifnot(is.character(`uuid`), length(`uuid`) == 1)
        self$`uuid` <- `uuid`
      }
      if (!is.null(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!is.null(`created_by`)) {
        stopifnot(is.character(`created_by`), length(`created_by`) == 1)
        self$`created_by` <- `created_by`
      }
      if (!is.null(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!is.null(`created_at`)) {
        stopifnot(is.character(`created_at`), length(`created_at`) == 1)
        self$`created_at` <- `created_at`
      }
      if (!is.null(`start_time`)) {
        stopifnot(is.character(`start_time`), length(`start_time`) == 1)
        self$`start_time` <- `start_time`
      }
      if (!is.null(`end_time`)) {
        stopifnot(is.character(`end_time`), length(`end_time`) == 1)
        self$`end_time` <- `end_time`
      }
      if (!is.null(`status`)) {
        stopifnot(R6::is.R6(`status`))
        self$`status` <- `status`
      }
      if (!is.null(`nodes`)) {
        stopifnot(is.vector(`nodes`), length(`nodes`) != 0)
        sapply(`nodes`, function(x) stopifnot(R6::is.R6(x)))
        self$`nodes` <- `nodes`
      }
    },
    toJSON = function() {
      TaskGraphLogObject <- list()
      if (!is.null(self$`uuid`)) {
        TaskGraphLogObject[['uuid']] <-
          self$`uuid`
      }
      if (!is.null(self$`namespace`)) {
        TaskGraphLogObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`created_by`)) {
        TaskGraphLogObject[['created_by']] <-
          self$`created_by`
      }
      if (!is.null(self$`name`)) {
        TaskGraphLogObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`created_at`)) {
        TaskGraphLogObject[['created_at']] <-
          self$`created_at`
      }
      if (!is.null(self$`start_time`)) {
        TaskGraphLogObject[['start_time']] <-
          self$`start_time`
      }
      if (!is.null(self$`end_time`)) {
        TaskGraphLogObject[['end_time']] <-
          self$`end_time`
      }
      if (!is.null(self$`status`)) {
        TaskGraphLogObject[['status']] <-
          self$`status`$toJSON()
      }
      if (!is.null(self$`nodes`)) {
        TaskGraphLogObject[['nodes']] <-
          lapply(self$`nodes`, function(x) x$toJSON())
      }

      TaskGraphLogObject
    },
    fromJSON = function(TaskGraphLogJson) {
      TaskGraphLogObject <- jsonlite::fromJSON(TaskGraphLogJson)
      if (!is.null(TaskGraphLogObject$`uuid`)) {
        self$`uuid` <- TaskGraphLogObject$`uuid`
      }
      if (!is.null(TaskGraphLogObject$`namespace`)) {
        self$`namespace` <- TaskGraphLogObject$`namespace`
      }
      if (!is.null(TaskGraphLogObject$`created_by`)) {
        self$`created_by` <- TaskGraphLogObject$`created_by`
      }
      if (!is.null(TaskGraphLogObject$`name`)) {
        self$`name` <- TaskGraphLogObject$`name`
      }
      if (!is.null(TaskGraphLogObject$`created_at`)) {
        self$`created_at` <- TaskGraphLogObject$`created_at`
      }
      if (!is.null(TaskGraphLogObject$`start_time`)) {
        self$`start_time` <- TaskGraphLogObject$`start_time`
      }
      if (!is.null(TaskGraphLogObject$`end_time`)) {
        self$`end_time` <- TaskGraphLogObject$`end_time`
      }
      if (!is.null(TaskGraphLogObject$`status`)) {
        statusObject <- TaskGraphLogStatus$new()
        statusObject$fromJSON(jsonlite::toJSON(TaskGraphLogObject$status, auto_unbox = TRUE, digits = NA))
        self$`status` <- statusObject
      }
      if (!is.null(TaskGraphLogObject$`nodes`)) {
        self$`nodes` <- ApiClient$new()$deserializeObj(TaskGraphLogObject$`nodes`, "array[TaskGraphNodeMetadata]", loadNamespace("tiledbcloud"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`uuid`)) {
        sprintf(
        '"uuid":
          "%s"
                ',
        self$`uuid`
        )},
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`created_by`)) {
        sprintf(
        '"created_by":
          "%s"
                ',
        self$`created_by`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`created_at`)) {
        sprintf(
        '"created_at":
          "%s"
                ',
        self$`created_at`
        )},
        if (!is.null(self$`start_time`)) {
        sprintf(
        '"start_time":
          "%s"
                ',
        self$`start_time`
        )},
        if (!is.null(self$`end_time`)) {
        sprintf(
        '"end_time":
          "%s"
                ',
        self$`end_time`
        )},
        if (!is.null(self$`status`)) {
        sprintf(
        '"status":
        %s
        ',
        jsonlite::toJSON(self$`status`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`nodes`)) {
        sprintf(
        '"nodes":
        [%s]
',
        paste(sapply(self$`nodes`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(TaskGraphLogJson) {
      TaskGraphLogObject <- jsonlite::fromJSON(TaskGraphLogJson)
      self$`uuid` <- TaskGraphLogObject$`uuid`
      self$`namespace` <- TaskGraphLogObject$`namespace`
      self$`created_by` <- TaskGraphLogObject$`created_by`
      self$`name` <- TaskGraphLogObject$`name`
      self$`created_at` <- TaskGraphLogObject$`created_at`
      self$`start_time` <- TaskGraphLogObject$`start_time`
      self$`end_time` <- TaskGraphLogObject$`end_time`
      self$`status` <- TaskGraphLogStatus$new()$fromJSON(jsonlite::toJSON(TaskGraphLogObject$status, auto_unbox = TRUE, digits = NA))
      self$`nodes` <- ApiClient$new()$deserializeObj(TaskGraphLogObject$`nodes`, "array[TaskGraphNodeMetadata]", loadNamespace("tiledbcloud"))
      self
    }
  )
)
eddelbuettel/tldbclr documentation built on Sept. 25, 2022, 12:46 p.m.