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


#' TransformDecoder Class
#'
#' 
#'
#' @field description The description of what this decoder is and what it does.
#' @field name The decoder name.
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TransformDecoder <- R6::R6Class(
  'TransformDecoder',
  public = list(
    `description` = NULL,
    `name` = NULL,
    initialize = function(`description`, `name`){
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      TransformDecoderObject <- list()
      if (!is.null(self$`description`)) {
        TransformDecoderObject[['description']] <- self$`description`
      }
      else {
        TransformDecoderObject[['description']] <- NULL
      }
      if (!is.null(self$`name`)) {
        TransformDecoderObject[['name']] <- self$`name`
      }
      else {
        TransformDecoderObject[['name']] <- NULL
      }

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

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

      if (!is.null(TransformDecoderObject$`description`)) {
        self$`description` <- TransformDecoderObject$`description`
      }
      if (!is.null(TransformDecoderObject$`name`)) {
        self$`name` <- TransformDecoderObject$`name`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "description": %s,
           "name": %s
        }',
        ifelse( is.null(self$`description`),"null",paste0(c('"', self$`description`, '"'))),
        ifelse( is.null(self$`name`),"null",paste0(c('"', self$`name`, '"')))
      )
    },
    fromJSONString = function(TransformDecoderJson) {
      TransformDecoderObject <- jsonlite::fromJSON(TransformDecoderJson)
      self::fromJSON(TransformDecoderObject)

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