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


#' JobAction Class
#'
#' Requests that a management action take place against a job.
#'
#' @field action 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
JobAction <- R6::R6Class(
  'JobAction',
  public = list(
    `action` = NULL,
    initialize = function(`action`){
      if (!missing(`action`)) {
        stopifnot(R6::is.R6(`action`))
        self$`action` <- `action`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      JobActionObject <- list()
      if (!is.null(self$`action`)) {
        JobActionObject[['action']] <- self$`action`$toJSON()
      }
      else {
        JobActionObject[['action']] <- NULL
      }

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

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

      if (!is.null(JobActionObject$`action`)) {
        actionObject <- JobActionType$new()
        actionObject$fromJSON(jsonlite::toJSON(JobActionObject$action, auto_unbox = TRUE))
        self$`action` <- actionObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "action": %s
        }',
        self$`action`$toJSON()
      )
    },
    fromJSONString = function(JobActionJson) {
      JobActionObject <- jsonlite::fromJSON(JobActionJson)
      self::fromJSON(JobActionObject)

    }
  )
)
agaveplatform/r-sdk documentation built on May 13, 2019, 8:20 a.m.