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


#' JobStatusSummary Class
#'
#' 
#'
#' @field id The unique id of the job.
#' @field status The status of the job. Possible values are: PENDING, STAGING_INPUTS, CLEANING_UP, ARCHIVING, STAGING_JOB, FINISHED, KILLED, FAILED, STOPPED, RUNNING, PAUSED, QUEUED, SUBMITTING, STAGED, PROCESSING_INPUTS, ARCHIVING_FINISHED, ARCHIVING_FAILED
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
JobStatusSummary <- R6::R6Class(
  'JobStatusSummary',
  public = list(
    `id` = NULL,
    `status` = NULL,
    initialize = function(`id`, `status`){
      if (!missing(`id`)) {
        stopifnot(is.numeric(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      JobStatusSummaryObject <- list()
      if (!is.null(self$`id`)) {
        JobStatusSummaryObject[['id']] <- self$`id`
      }
      else {
        JobStatusSummaryObject[['id']] <- NULL
      }
      if (!is.null(self$`status`)) {
        JobStatusSummaryObject[['status']] <- self$`status`
      }
      else {
        JobStatusSummaryObject[['status']] <- NULL
      }

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

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

      if (!is.null(JobStatusSummaryObject$`id`)) {
        self$`id` <- JobStatusSummaryObject$`id`
      }
      if (!is.null(JobStatusSummaryObject$`status`)) {
        self$`status` <- JobStatusSummaryObject$`status`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "id": %d,
           "status": %s
        }',
        ifelse( is.null(self$`id`),"null",paste0(c('"', self$`id`, '"'))),
        ifelse( is.null(self$`status`),"null",paste0(c('"', self$`status`, '"')))
      )
    },
    fromJSONString = function(JobStatusSummaryJson) {
      JobStatusSummaryObject <- jsonlite::fromJSON(JobStatusSummaryJson)
      self::fromJSON(JobStatusSummaryObject)

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