# TileDB Storage Platform API
#
# TileDB Storage Platform REST API
#
# The version of the OpenAPI document: 2.2.19
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title Subarray
#'
#' @description Subarray Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field layout \link{Layout} [optional]
#'
#' @field ranges list( \link{SubarrayRanges} ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Subarray <- R6::R6Class(
'Subarray',
public = list(
`layout` = NULL,
`ranges` = NULL,
initialize = function(
`layout`=NULL, `ranges`=NULL, ...
) {
local.optional.var <- list(...)
if (!is.null(`layout`)) {
stopifnot(R6::is.R6(`layout`))
self$`layout` <- `layout`
}
if (!is.null(`ranges`)) {
stopifnot(is.vector(`ranges`), length(`ranges`) != 0)
sapply(`ranges`, function(x) stopifnot(R6::is.R6(x)))
self$`ranges` <- `ranges`
}
},
toJSON = function() {
SubarrayObject <- list()
if (!is.null(self$`layout`)) {
SubarrayObject[['layout']] <-
self$`layout`$toJSON()
}
if (!is.null(self$`ranges`)) {
SubarrayObject[['ranges']] <-
lapply(self$`ranges`, function(x) x$toJSON())
}
SubarrayObject
},
fromJSON = function(SubarrayJson) {
SubarrayObject <- jsonlite::fromJSON(SubarrayJson)
if (!is.null(SubarrayObject$`layout`)) {
# MANUAL EDIT AFTER OPENAPI AUTOGEN
# For enums, OpenAPI autogen (1) generates a constructor which requires being called
# with one arguent; (2) generates callsites (such as here) that calls that constructor
# with zero arguments.
#
#layoutObject <- Layout$new()
#layoutObject$fromJSON(jsonlite::toJSON(SubarrayObject$layout, auto_unbox = TRUE, digits = NA))
layoutObject <- Layout$new(SubarrayObject$layout)
self$`layout` <- layoutObject
}
if (!is.null(SubarrayObject$`ranges`)) {
self$`ranges` <- ApiClient$new()$deserializeObj(SubarrayObject$`ranges`, "array[SubarrayRanges]", loadNamespace("tiledbcloud"))
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`layout`)) {
sprintf(
'"layout":
%s
',
jsonlite::toJSON(self$`layout`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`ranges`)) {
sprintf(
'"ranges":
[%s]
',
paste(sapply(self$`ranges`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(SubarrayJson) {
SubarrayObject <- jsonlite::fromJSON(SubarrayJson)
self$`layout` <- Layout$new()$fromJSON(jsonlite::toJSON(SubarrayObject$layout, auto_unbox = TRUE, digits = NA))
self$`ranges` <- ApiClient$new()$deserializeObj(SubarrayObject$`ranges`, "array[SubarrayRanges]", loadNamespace("tiledbcloud"))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.