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


#' ApplicationParameterStringValue Class
#'
#' An ApplicationParameter representing a string value
#'
#' @field defaultValue The default value for this parameter. The type will be determined by the value.type field.
#' @field enquote Whether the argument value should be surrounded by quotation marks before injection into the wrapper template at runtime
#' @field order The order in which this parameter should be printed when generating an execution command for forked execution. This will also be the order in which paramters are returned in the response json.
#' @field required Is this parameter required? If visible is false, this must be true.
#' @field validator The regular expression used to validate this parameter value. For enumerations, separate values with |
#' @field visible Should this parameter be visible? If not, there must be a default and it will be required.
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ApplicationParameterStringValue <- R6::R6Class(
  'ApplicationParameterStringValue',
  public = list(
    `defaultValue` = NULL,
    `enquote` = NULL,
    `order` = NULL,
    `required` = NULL,
    `validator` = NULL,
    `visible` = NULL,
    initialize = function(`defaultValue`, `enquote`, `order`, `required`, `validator`, `visible`){
      if (!missing(`defaultValue`)) {
        stopifnot(is.list(`defaultValue`), length(`defaultValue`) != 0)
        lapply(`defaultValue`, function(x) stopifnot(is.character(x)))
        self$`defaultValue` <- `defaultValue`
      }
      if (!missing(`enquote`)) {
        self$`enquote` <- `enquote`
      }
      if (!missing(`order`)) {
        stopifnot(is.numeric(`order`), length(`order`) == 1)
        self$`order` <- `order`
      }
      if (!missing(`required`)) {
        self$`required` <- `required`
      }
      if (!missing(`validator`)) {
        stopifnot(is.character(`validator`), length(`validator`) == 1)
        self$`validator` <- `validator`
      }
      if (!missing(`visible`)) {
        self$`visible` <- `visible`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      ApplicationParameterStringValueObject <- list()
      if (!is.null(self$`defaultValue`)) {
        ApplicationParameterStringValueObject[['defaultValue']] <- self$`defaultValue`
      }
      else {
        ApplicationParameterStringValueObject[['defaultValue']] <- NULL
      }
      if (!is.null(self$`enquote`)) {
        ApplicationParameterStringValueObject[['enquote']] <- self$`enquote`
      }
      else {
        ApplicationParameterStringValueObject[['enquote']] <- NULL
      }
      if (!is.null(self$`order`)) {
        ApplicationParameterStringValueObject[['order']] <- self$`order`
      }
      else {
        ApplicationParameterStringValueObject[['order']] <- NULL
      }
      if (!is.null(self$`required`)) {
        ApplicationParameterStringValueObject[['required']] <- self$`required`
      }
      else {
        ApplicationParameterStringValueObject[['required']] <- NULL
      }
      if (!is.null(self$`validator`)) {
        ApplicationParameterStringValueObject[['validator']] <- self$`validator`
      }
      else {
        ApplicationParameterStringValueObject[['validator']] <- NULL
      }
      if (!is.null(self$`visible`)) {
        ApplicationParameterStringValueObject[['visible']] <- self$`visible`
      }
      else {
        ApplicationParameterStringValueObject[['visible']] <- NULL
      }

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

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

      if (!is.null(ApplicationParameterStringValueObject$`defaultValue`)) {
        self$`defaultValue` <- ApplicationParameterStringValueObject$`defaultValue`
      }
      if (!is.null(ApplicationParameterStringValueObject$`enquote`)) {
        self$`enquote` <- ApplicationParameterStringValueObject$`enquote`
      }
      if (!is.null(ApplicationParameterStringValueObject$`order`)) {
        self$`order` <- ApplicationParameterStringValueObject$`order`
      }
      if (!is.null(ApplicationParameterStringValueObject$`required`)) {
        self$`required` <- ApplicationParameterStringValueObject$`required`
      }
      if (!is.null(ApplicationParameterStringValueObject$`validator`)) {
        self$`validator` <- ApplicationParameterStringValueObject$`validator`
      }
      if (!is.null(ApplicationParameterStringValueObject$`visible`)) {
        self$`visible` <- ApplicationParameterStringValueObject$`visible`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "defaultValue": [%s],
           "enquote": %s,
           "order": %d,
           "required": %s,
           "validator": %s,
           "visible": %s
        }',
        lapply(self$`defaultValue`, function(x) paste(paste0('"', x, '"'), sep=",")),
        ifelse( is.null(self$`enquote`),"null",paste0(c('"', self$`enquote`, '"'))),
        ifelse( is.null(self$`order`),"null",paste0(c('"', self$`order`, '"'))),
        ifelse( is.null(self$`required`),"null",paste0(c('"', self$`required`, '"'))),
        ifelse( is.null(self$`validator`),"null",paste0(c('"', self$`validator`, '"'))),
        ifelse( is.null(self$`visible`),"null",paste0(c('"', self$`visible`, '"')))
      )
    },
    fromJSONString = function(ApplicationParameterStringValueJson) {
      ApplicationParameterStringValueObject <- jsonlite::fromJSON(ApplicationParameterStringValueJson)
      self::fromJSON(ApplicationParameterStringValueObject)

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