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


#' UUIDRequest Class
#'
#' Request object to create a new UUID
#'
#' @field type The resource type for which the UUID should be created.
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
UUIDRequest <- R6::R6Class(
  'UUIDRequest',
  public = list(
    `type` = NULL,
    initialize = function(`type`){
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      UUIDRequestObject <- list()
      if (!is.null(self$`type`)) {
        UUIDRequestObject[['type']] <- self$`type`
      }
      else {
        UUIDRequestObject[['type']] <- NULL
      }

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

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

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

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