R/v0_matrix_post_response.R

# HCA Matrix Service
#
# Human Cell Atlas Matrix Service API
#
# The version of the OpenAPI document: 1.0.0
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title V0MatrixPostResponse
#' @description V0MatrixPostResponse Class
#' @format An \code{R6Class} generator object
#' @field request_id   character  [optional]
#'
#' @field non_human_request_ids    named list(character)   [optional]
#'
#' @field status   \link[hcamatrixapi:v0_MatrixRequestStatus]{  V0MatrixRequestStatus  }  [optional]
#'
#' @field message   character  [optional]
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
V0MatrixPostResponse <- R6::R6Class(
  'V0MatrixPostResponse',
  public = list(
    `request_id` = NULL,
    `non_human_request_ids` = NULL,
    `status` = NULL,
    `message` = NULL,
    initialize = function(`request_id`=NULL, `non_human_request_ids`=NULL, `status`=NULL, `message`=NULL, ...){
      local.optional.var <- list(...)
      if (!is.null(`request_id`)) {
        stopifnot(is.character(`request_id`), length(`request_id`) == 1)
        self$`request_id` <- `request_id`
      }
      if (!is.null(`non_human_request_ids`)) {
        stopifnot(is.vector(`non_human_request_ids`), length(`non_human_request_ids`) != 0)
        sapply(`non_human_request_ids`, function(x) stopifnot(is.character(x)))
        self$`non_human_request_ids` <- `non_human_request_ids`
      }
      if (!is.null(`status`)) {
        stopifnot(R6::is.R6(`status`))
        self$`status` <- `status`
      }
      if (!is.null(`message`)) {
        stopifnot(is.character(`message`), length(`message`) == 1)
        self$`message` <- `message`
      }
    },
    toJSON = function() {
      V0MatrixPostResponseObject <- list()
      if (!is.null(self$`request_id`)) {
        V0MatrixPostResponseObject[['request_id']] <-
          self$`request_id`
      }
      if (!is.null(self$`non_human_request_ids`)) {
        V0MatrixPostResponseObject[['non_human_request_ids']] <-
          self$`non_human_request_ids`
      }
      if (!is.null(self$`status`)) {
        V0MatrixPostResponseObject[['status']] <-
          self$`status`$toJSON()
      }
      if (!is.null(self$`message`)) {
        V0MatrixPostResponseObject[['message']] <-
          self$`message`
      }

      V0MatrixPostResponseObject
    },
    fromJSON = function(V0MatrixPostResponseJson) {
      V0MatrixPostResponseObject <- jsonlite::fromJSON(V0MatrixPostResponseJson)
      if (!is.null(V0MatrixPostResponseObject$`request_id`)) {
        self$`request_id` <- V0MatrixPostResponseObject$`request_id`
      }
      if (!is.null(V0MatrixPostResponseObject$`non_human_request_ids`)) {
        self$`non_human_request_ids` <- ApiClient$new()$deserializeObj(V0MatrixPostResponseObject$`non_human_request_ids`, "map(character)", "package:hcamatrixapi")
      }
      if (!is.null(V0MatrixPostResponseObject$`status`)) {
        statusObject <- V0MatrixRequestStatus$new()
        statusObject$fromJSON(jsonlite::toJSON(V0MatrixPostResponseObject$status, auto_unbox = TRUE, digits = NA))
        self$`status` <- statusObject
      }
      if (!is.null(V0MatrixPostResponseObject$`message`)) {
        self$`message` <- V0MatrixPostResponseObject$`message`
      }
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`request_id`)) {
        sprintf(
        '"request_id":
          "%s"
                ',
        self$`request_id`
        )},
        if (!is.null(self$`non_human_request_ids`)) {
        sprintf(
        '"non_human_request_ids":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`non_human_request_ids`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )},
        if (!is.null(self$`status`)) {
        sprintf(
        '"status":
        %s
        ',
        jsonlite::toJSON(self$`status`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`message`)) {
        sprintf(
        '"message":
          "%s"
                ',
        self$`message`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(V0MatrixPostResponseJson) {
      V0MatrixPostResponseObject <- jsonlite::fromJSON(V0MatrixPostResponseJson)
      self$`request_id` <- V0MatrixPostResponseObject$`request_id`
      self$`non_human_request_ids` <- ApiClient$new()$deserializeObj(V0MatrixPostResponseObject$`non_human_request_ids`, "map(character)","package:hcamatrixapi")
      self$`status` <- V0MatrixRequestStatus$new()$fromJSON(jsonlite::toJSON(V0MatrixPostResponseObject$status, auto_unbox = TRUE, digits = NA))
      self$`message` <- V0MatrixPostResponseObject$`message`
      self
    }
  )
)
Bioconductor/hcamatrixapi documentation built on Nov. 6, 2019, 12:10 a.m.