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


#' ApplicationParameter Class
#'
#' App parameters define the command-line arguments (flags, arguments, etc.) needed by your wrapper script in order to properly run your application code. <a href=\"http://agaveapi.co/documentation/tutorials/app-management-tutorial/#app-parameters\">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
ApplicationParameter <- R6::R6Class(
  'ApplicationParameter',
  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() {
      ApplicationParameterObject <- list()
      if (!is.null(self$`details`)) {
        ApplicationParameterObject[['details']] <- self$`details`$toJSON()
      }
      else {
        ApplicationParameterObject[['details']] <- NULL
      }
      if (!is.null(self$`id`)) {
        ApplicationParameterObject[['id']] <- self$`id`
      }
      else {
        ApplicationParameterObject[['id']] <- NULL
      }
      if (!is.null(self$`semantics`)) {
        ApplicationParameterObject[['semantics']] <- self$`semantics`$toJSON()
      }
      else {
        ApplicationParameterObject[['semantics']] <- NULL
      }
      if (!is.null(self$`value`)) {
        ApplicationParameterObject[['value']] <- self$`value`$toJSON()
      }
      else {
        ApplicationParameterObject[['value']] <- NULL
      }

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

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

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

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