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


#' ApplicationInput Class
#'
#' App inputs describe data inputs supported by your app. Each input can represent one or more files or folders. Inptus can be optional or required and may physically reside anywhere accessible using any of the data protocols supported by Agave.  <a href=\"http://agaveapi.co/documentation/tutorials/app-management-tutorial/#app-inputs\">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
ApplicationInput <- R6::R6Class(
  'ApplicationInput',
  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() {
      ApplicationInputObject <- list()
      if (!is.null(self$`details`)) {
        ApplicationInputObject[['details']] <- self$`details`$toJSON()
      }
      else {
        ApplicationInputObject[['details']] <- NULL
      }
      if (!is.null(self$`id`)) {
        ApplicationInputObject[['id']] <- self$`id`
      }
      else {
        ApplicationInputObject[['id']] <- NULL
      }
      if (!is.null(self$`semantics`)) {
        ApplicationInputObject[['semantics']] <- self$`semantics`$toJSON()
      }
      else {
        ApplicationInputObject[['semantics']] <- NULL
      }
      if (!is.null(self$`value`)) {
        ApplicationInputObject[['value']] <- self$`value`$toJSON()
      }
      else {
        ApplicationInputObject[['value']] <- NULL
      }

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

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

      if (!is.null(ApplicationInputObject$`details`)) {
        detailsObject <- ApplicationArgumentDetails$new()
        detailsObject$fromJSON(jsonlite::toJSON(ApplicationInputObject$details, auto_unbox = TRUE))
        self$`details` <- detailsObject
      }
      if (!is.null(ApplicationInputObject$`id`)) {
        self$`id` <- ApplicationInputObject$`id`
      }
      if (!is.null(ApplicationInputObject$`semantics`)) {
        semanticsObject <- ApplicationArgumentSemantics$new()
        semanticsObject$fromJSON(jsonlite::toJSON(ApplicationInputObject$semantics, auto_unbox = TRUE))
        self$`semantics` <- semanticsObject
      }
      if (!is.null(ApplicationInputObject$`value`)) {
        valueObject <- ApplicationArgumentValue$new()
        valueObject$fromJSON(jsonlite::toJSON(ApplicationInputObject$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(ApplicationInputJson) {
      ApplicationInputObject <- jsonlite::fromJSON(ApplicationInputJson)
      self::fromJSON(ApplicationInputObject)

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