R/JobHistory.r

# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' JobHistory Class
#'
#' 
#'
#' @field created The date of the event.
#' @field description A brief description of the event details.
#' @field status The status of the job after this event.
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
JobHistory <- R6::R6Class(
  'JobHistory',
  public = list(
    `created` = NULL,
    `description` = NULL,
    `status` = NULL,
    initialize = function(`created`, `description`, `status`){
      if (!missing(`created`)) {
        stopifnot(is.character(`created`), length(`created`) == 1)
        self$`created` <- `created`
      }
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      JobHistoryObject <- list()
      if (!is.null(self$`created`)) {
        JobHistoryObject[['created']] <- self$`created`
      }
      else {
        JobHistoryObject[['created']] <- NULL
      }
      if (!is.null(self$`description`)) {
        JobHistoryObject[['description']] <- self$`description`
      }
      else {
        JobHistoryObject[['description']] <- NULL
      }
      if (!is.null(self$`status`)) {
        JobHistoryObject[['status']] <- self$`status`
      }
      else {
        JobHistoryObject[['status']] <- NULL
      }

      JobHistoryObject
    },
    fromJSON = function(JobHistoryObject) {
      if (is.character(JobHistoryObject)) {
        JobHistoryObject <- jsonlite::fromJSON(JobHistoryJson)
      }

      if ("result" %in% names(JobHistoryObject)) {
        JobHistoryObject <- JobHistoryObject$result
      }

      if (!is.null(JobHistoryObject$`created`)) {
        self$`created` <- JobHistoryObject$`created`
      }
      if (!is.null(JobHistoryObject$`description`)) {
        self$`description` <- JobHistoryObject$`description`
      }
      if (!is.null(JobHistoryObject$`status`)) {
        self$`status` <- JobHistoryObject$`status`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "created": %s,
           "description": %s,
           "status": %s
        }',
        ifelse( is.null(self$`created`),"null",paste0(c('"', self$`created`, '"'))),
        ifelse( is.null(self$`description`),"null",paste0(c('"', self$`description`, '"'))),
        ifelse( is.null(self$`status`),"null",paste0(c('"', self$`status`, '"')))
      )
    },
    fromJSONString = function(JobHistoryJson) {
      JobHistoryObject <- jsonlite::fromJSON(JobHistoryJson)
      self::fromJSON(JobHistoryObject)

    }
  )
)
deardooley/agave-rlang-sdk documentation built on May 17, 2019, 10:12 p.m.