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


#' ApplicationOutput Class
#'
#' In addition to describing the inputs and parameters that your wrapper script requires, it is often helpful to provide the expected outputs when running your app. This is the purpose of the outputs attribute. App outputs specify an array of JSON objects describing the data that should be present when your app completes. It is entirely optional and provided, at this point in time, for reference purpose only.  <a href=\"http://agaveapi.co/documentation/tutorials/app-management-tutorial/#app-outputs\">Read more.</a>
#'
#' @field details 
#' @field id The id of this argument. This will be the replacement string in your wrapper scripts.
#' @field semantics 
#' @field value 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ApplicationOutput <- R6::R6Class(
  'ApplicationOutput',
  public = list(
    `details` = NULL,
    `id` = NULL,
    `semantics` = NULL,
    `value` = NULL,
    initialize = function(`details`, `id`, `semantics`, `value`){
      if (!missing(`details`)) {
        stopifnot(R6::is.R6(`details`))
        self$`details` <- `details`
      }
      if (!missing(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!missing(`semantics`)) {
        stopifnot(R6::is.R6(`semantics`))
        self$`semantics` <- `semantics`
      }
      if (!missing(`value`)) {
        stopifnot(R6::is.R6(`value`))
        self$`value` <- `value`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      ApplicationOutputObject <- list()
      if (!is.null(self$`details`)) {
        ApplicationOutputObject[['details']] <- self$`details`$toJSON()
      }
      else {
        ApplicationOutputObject[['details']] <- NULL
      }
      if (!is.null(self$`id`)) {
        ApplicationOutputObject[['id']] <- self$`id`
      }
      else {
        ApplicationOutputObject[['id']] <- NULL
      }
      if (!is.null(self$`semantics`)) {
        ApplicationOutputObject[['semantics']] <- self$`semantics`$toJSON()
      }
      else {
        ApplicationOutputObject[['semantics']] <- NULL
      }
      if (!is.null(self$`value`)) {
        ApplicationOutputObject[['value']] <- self$`value`$toJSON()
      }
      else {
        ApplicationOutputObject[['value']] <- NULL
      }

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

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

      if (!is.null(ApplicationOutputObject$`details`)) {
        detailsObject <- ApplicationArgumentDetails$new()
        detailsObject$fromJSON(jsonlite::toJSON(ApplicationOutputObject$details, auto_unbox = TRUE))
        self$`details` <- detailsObject
      }
      if (!is.null(ApplicationOutputObject$`id`)) {
        self$`id` <- ApplicationOutputObject$`id`
      }
      if (!is.null(ApplicationOutputObject$`semantics`)) {
        semanticsObject <- ApplicationArgumentSemantics$new()
        semanticsObject$fromJSON(jsonlite::toJSON(ApplicationOutputObject$semantics, auto_unbox = TRUE))
        self$`semantics` <- semanticsObject
      }
      if (!is.null(ApplicationOutputObject$`value`)) {
        valueObject <- ApplicationArgumentValue$new()
        valueObject$fromJSON(jsonlite::toJSON(ApplicationOutputObject$value, auto_unbox = TRUE))
        self$`value` <- valueObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "details": %s,
           "id": %s,
           "semantics": %s,
           "value": %s
        }',
        self$`details`$toJSON(),
        ifelse( is.null(self$`id`),"null",paste0(c('"', self$`id`, '"'))),
        self$`semantics`$toJSON(),
        self$`value`$toJSON()
      )
    },
    fromJSONString = function(ApplicationOutputJson) {
      ApplicationOutputObject <- jsonlite::fromJSON(ApplicationOutputJson)
      self::fromJSON(ApplicationOutputObject)

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