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


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

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

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

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

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