R/array_sharing.R

# 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 ArraySharing
#'
#' @description ArraySharing Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field actions  list( \link{ArrayActions} ) [optional]
#'
#' @field namespace  character [optional]
#'
#' @field namespace_type  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ArraySharing <- R6::R6Class(
  'ArraySharing',
  public = list(
    `actions` = NULL,
    `namespace` = NULL,
    `namespace_type` = NULL,
    initialize = function(
        `actions`=NULL, `namespace`=NULL, `namespace_type`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`actions`)) {
        stopifnot(is.vector(`actions`), length(`actions`) != 0)
        sapply(`actions`, function(x) stopifnot(R6::is.R6(x)))
        self$`actions` <- `actions`
      }
      if (!is.null(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!is.null(`namespace_type`)) {
        stopifnot(is.character(`namespace_type`), length(`namespace_type`) == 1)
        self$`namespace_type` <- `namespace_type`
      }
    },
    toJSON = function() {
      ArraySharingObject <- list()
      if (!is.null(self$`actions`)) {
        ArraySharingObject[['actions']] <-
          lapply(self$`actions`, function(x) x$toJSON())
      }
      if (!is.null(self$`namespace`)) {
        ArraySharingObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`namespace_type`)) {
        ArraySharingObject[['namespace_type']] <-
          self$`namespace_type`
      }

      ArraySharingObject
    },
    fromJSON = function(ArraySharingJson) {
      ArraySharingObject <- jsonlite::fromJSON(ArraySharingJson)
      if (!is.null(ArraySharingObject$`actions`)) {
        self$`actions` <- ApiClient$new()$deserializeObj(ArraySharingObject$`actions`, "array[ArrayActions]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArraySharingObject$`namespace`)) {
        self$`namespace` <- ArraySharingObject$`namespace`
      }
      if (!is.null(ArraySharingObject$`namespace_type`)) {
        self$`namespace_type` <- ArraySharingObject$`namespace_type`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`actions`)) {
        sprintf(
        '"actions":
        [%s]
',
        paste(sapply(self$`actions`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`namespace_type`)) {
        sprintf(
        '"namespace_type":
          "%s"
                ',
        self$`namespace_type`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ArraySharingJson) {
      ArraySharingObject <- jsonlite::fromJSON(ArraySharingJson)
      self$`actions` <- ApiClient$new()$deserializeObj(ArraySharingObject$`actions`, "array[ArrayActions]", loadNamespace("tiledbcloud"))
      self$`namespace` <- ArraySharingObject$`namespace`
      self$`namespace_type` <- ArraySharingObject$`namespace_type`
      self
    }
  )
)
eddelbuettel/tldbclr documentation built on Sept. 25, 2022, 12:46 p.m.