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


#' EmptySystemResponse Class
#'
#' 
#'
#' @field message success or failure
#' @field result empty result
#' @field status success or failure
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
EmptySystemResponse <- R6::R6Class(
  'EmptySystemResponse',
  public = list(
    `message` = NULL,
    `result` = NULL,
    `status` = NULL,
    initialize = function(`message`, `result`, `status`){
      if (!missing(`message`)) {
        stopifnot(is.character(`message`), length(`message`) == 1)
        self$`message` <- `message`
      }
      if (!missing(`result`)) {
        stopifnot(is.character(`result`), length(`result`) == 1)
        self$`result` <- `result`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      EmptySystemResponseObject <- list()
      if (!is.null(self$`message`)) {
        EmptySystemResponseObject[['message']] <- self$`message`
      }
      else {
        EmptySystemResponseObject[['message']] <- NULL
      }
      if (!is.null(self$`result`)) {
        EmptySystemResponseObject[['result']] <- self$`result`
      }
      else {
        EmptySystemResponseObject[['result']] <- NULL
      }
      if (!is.null(self$`status`)) {
        EmptySystemResponseObject[['status']] <- self$`status`
      }
      else {
        EmptySystemResponseObject[['status']] <- NULL
      }

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

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

      if (!is.null(EmptySystemResponseObject$`message`)) {
        self$`message` <- EmptySystemResponseObject$`message`
      }
      if (!is.null(EmptySystemResponseObject$`result`)) {
        self$`result` <- EmptySystemResponseObject$`result`
      }
      if (!is.null(EmptySystemResponseObject$`status`)) {
        self$`status` <- EmptySystemResponseObject$`status`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "message": %s,
           "result": %s,
           "status": %s
        }',
        ifelse( is.null(self$`message`),"null",paste0(c('"', self$`message`, '"'))),
        ifelse( is.null(self$`result`),"null",paste0(c('"', self$`result`, '"'))),
        ifelse( is.null(self$`status`),"null",paste0(c('"', self$`status`, '"')))
      )
    },
    fromJSONString = function(EmptySystemResponseJson) {
      EmptySystemResponseObject <- jsonlite::fromJSON(EmptySystemResponseJson)
      self::fromJSON(EmptySystemResponseObject)

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