R/array_info.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 ArrayInfo
#'
#' @description ArrayInfo Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field id  character [optional]
#'
#' @field file_type  \link{FileType} [optional]
#'
#' @field file_properties  named list( character ) [optional]
#'
#' @field uri  character [optional]
#'
#' @field namespace  character [optional]
#'
#' @field size  numeric [optional]
#'
#' @field last_accessed  character [optional]
#'
#' @field description  character [optional]
#'
#' @field name  character [optional]
#'
#' @field allowed_actions  list( \link{ArrayActions} ) [optional]
#'
#' @field pricing  list( \link{Pricing} ) [optional]
#'
#' @field subscriptions  list( \link{Subscription} ) [optional]
#'
#' @field logo  character [optional]
#'
#' @field access_credentials_name  character [optional]
#'
#' @field type  character [optional]
#'
#' @field share_count  numeric [optional]
#'
#' @field public_share  character [optional]
#'
#' @field namespace_subscribed  character [optional]
#'
#' @field tiledb_uri  character [optional]
#'
#' @field tags  list( character ) [optional]
#'
#' @field license_id  character [optional]
#'
#' @field license_text  character [optional]
#'
#' @field read_only  character [optional]
#'
#' @field is_favorite  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ArrayInfo <- R6::R6Class(
  'ArrayInfo',
  public = list(
    `id` = NULL,
    `file_type` = NULL,
    `file_properties` = NULL,
    `uri` = NULL,
    `namespace` = NULL,
    `size` = NULL,
    `last_accessed` = NULL,
    `description` = NULL,
    `name` = NULL,
    `allowed_actions` = NULL,
    `pricing` = NULL,
    `subscriptions` = NULL,
    `logo` = NULL,
    `access_credentials_name` = NULL,
    `type` = NULL,
    `share_count` = NULL,
    `public_share` = NULL,
    `namespace_subscribed` = NULL,
    `tiledb_uri` = NULL,
    `tags` = NULL,
    `license_id` = NULL,
    `license_text` = NULL,
    `read_only` = NULL,
    `is_favorite` = NULL,
    initialize = function(
        `id`=NULL, `file_type`=NULL, `file_properties`=NULL, `uri`=NULL, `namespace`=NULL, `size`=NULL, `last_accessed`=NULL, `description`=NULL, `name`=NULL, `allowed_actions`=NULL, `pricing`=NULL, `subscriptions`=NULL, `logo`=NULL, `access_credentials_name`=NULL, `type`=NULL, `share_count`=NULL, `public_share`=NULL, `namespace_subscribed`=NULL, `tiledb_uri`=NULL, `tags`=NULL, `license_id`=NULL, `license_text`=NULL, `read_only`=NULL, `is_favorite`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!is.null(`file_type`)) {
        stopifnot(R6::is.R6(`file_type`))
        self$`file_type` <- `file_type`
      }
      if (!is.null(`file_properties`)) {
        stopifnot(is.vector(`file_properties`), length(`file_properties`) != 0)
        sapply(`file_properties`, function(x) stopifnot(is.character(x)))
        self$`file_properties` <- `file_properties`
      }
      if (!is.null(`uri`)) {
        stopifnot(is.character(`uri`), length(`uri`) == 1)
        self$`uri` <- `uri`
      }
      if (!is.null(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!is.null(`size`)) {
        self$`size` <- `size`
      }
      if (!is.null(`last_accessed`)) {
        stopifnot(is.character(`last_accessed`), length(`last_accessed`) == 1)
        self$`last_accessed` <- `last_accessed`
      }
      if (!is.null(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!is.null(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!is.null(`allowed_actions`)) {
        stopifnot(is.vector(`allowed_actions`), length(`allowed_actions`) != 0)
        sapply(`allowed_actions`, function(x) stopifnot(R6::is.R6(x)))
        self$`allowed_actions` <- `allowed_actions`
      }
      if (!is.null(`pricing`)) {
        stopifnot(is.vector(`pricing`), length(`pricing`) != 0)
        sapply(`pricing`, function(x) stopifnot(R6::is.R6(x)))
        self$`pricing` <- `pricing`
      }
      if (!is.null(`subscriptions`)) {
        stopifnot(is.vector(`subscriptions`), length(`subscriptions`) != 0)
        sapply(`subscriptions`, function(x) stopifnot(R6::is.R6(x)))
        self$`subscriptions` <- `subscriptions`
      }
      if (!is.null(`logo`)) {
        stopifnot(is.character(`logo`), length(`logo`) == 1)
        self$`logo` <- `logo`
      }
      if (!is.null(`access_credentials_name`)) {
        stopifnot(is.character(`access_credentials_name`), length(`access_credentials_name`) == 1)
        self$`access_credentials_name` <- `access_credentials_name`
      }
      if (!is.null(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!is.null(`share_count`)) {
        self$`share_count` <- `share_count`
      }
      if (!is.null(`public_share`)) {
        self$`public_share` <- `public_share`
      }
      if (!is.null(`namespace_subscribed`)) {
        self$`namespace_subscribed` <- `namespace_subscribed`
      }
      if (!is.null(`tiledb_uri`)) {
        stopifnot(is.character(`tiledb_uri`), length(`tiledb_uri`) == 1)
        self$`tiledb_uri` <- `tiledb_uri`
      }
      if (!is.null(`tags`)) {
        stopifnot(is.vector(`tags`), length(`tags`) != 0)
        sapply(`tags`, function(x) stopifnot(is.character(x)))
        self$`tags` <- `tags`
      }
      if (!is.null(`license_id`)) {
        stopifnot(is.character(`license_id`), length(`license_id`) == 1)
        self$`license_id` <- `license_id`
      }
      if (!is.null(`license_text`)) {
        stopifnot(is.character(`license_text`), length(`license_text`) == 1)
        self$`license_text` <- `license_text`
      }
      if (!is.null(`read_only`)) {
        self$`read_only` <- `read_only`
      }
      if (!is.null(`is_favorite`)) {
        self$`is_favorite` <- `is_favorite`
      }
    },
    toJSON = function() {
      ArrayInfoObject <- list()
      if (!is.null(self$`id`)) {
        ArrayInfoObject[['id']] <-
          self$`id`
      }
      if (!is.null(self$`file_type`)) {
        ArrayInfoObject[['file_type']] <-
          self$`file_type`$toJSON()
      }
      if (!is.null(self$`file_properties`)) {
        ArrayInfoObject[['file_properties']] <-
          self$`file_properties`
      }
      if (!is.null(self$`uri`)) {
        ArrayInfoObject[['uri']] <-
          self$`uri`
      }
      if (!is.null(self$`namespace`)) {
        ArrayInfoObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`size`)) {
        ArrayInfoObject[['size']] <-
          self$`size`
      }
      if (!is.null(self$`last_accessed`)) {
        ArrayInfoObject[['last_accessed']] <-
          self$`last_accessed`
      }
      if (!is.null(self$`description`)) {
        ArrayInfoObject[['description']] <-
          self$`description`
      }
      if (!is.null(self$`name`)) {
        ArrayInfoObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`allowed_actions`)) {
        ArrayInfoObject[['allowed_actions']] <-
          lapply(self$`allowed_actions`, function(x) x$toJSON())
      }
      if (!is.null(self$`pricing`)) {
        ArrayInfoObject[['pricing']] <-
          lapply(self$`pricing`, function(x) x$toJSON())
      }
      if (!is.null(self$`subscriptions`)) {
        ArrayInfoObject[['subscriptions']] <-
          lapply(self$`subscriptions`, function(x) x$toJSON())
      }
      if (!is.null(self$`logo`)) {
        ArrayInfoObject[['logo']] <-
          self$`logo`
      }
      if (!is.null(self$`access_credentials_name`)) {
        ArrayInfoObject[['access_credentials_name']] <-
          self$`access_credentials_name`
      }
      if (!is.null(self$`type`)) {
        ArrayInfoObject[['type']] <-
          self$`type`
      }
      if (!is.null(self$`share_count`)) {
        ArrayInfoObject[['share_count']] <-
          self$`share_count`
      }
      if (!is.null(self$`public_share`)) {
        ArrayInfoObject[['public_share']] <-
          self$`public_share`
      }
      if (!is.null(self$`namespace_subscribed`)) {
        ArrayInfoObject[['namespace_subscribed']] <-
          self$`namespace_subscribed`
      }
      if (!is.null(self$`tiledb_uri`)) {
        ArrayInfoObject[['tiledb_uri']] <-
          self$`tiledb_uri`
      }
      if (!is.null(self$`tags`)) {
        ArrayInfoObject[['tags']] <-
          self$`tags`
      }
      if (!is.null(self$`license_id`)) {
        ArrayInfoObject[['license_id']] <-
          self$`license_id`
      }
      if (!is.null(self$`license_text`)) {
        ArrayInfoObject[['license_text']] <-
          self$`license_text`
      }
      if (!is.null(self$`read_only`)) {
        ArrayInfoObject[['read_only']] <-
          self$`read_only`
      }
      if (!is.null(self$`is_favorite`)) {
        ArrayInfoObject[['is_favorite']] <-
          self$`is_favorite`
      }

      ArrayInfoObject
    },
    fromJSON = function(ArrayInfoJson) {
      ArrayInfoObject <- jsonlite::fromJSON(ArrayInfoJson)
      if (!is.null(ArrayInfoObject$`id`)) {
        self$`id` <- ArrayInfoObject$`id`
      }
      if (!is.null(ArrayInfoObject$`file_type`)) {
        # 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.
        #
        #file_typeObject <- FileType$new()
        #file_typeObject$fromJSON(jsonlite::toJSON(ArrayInfoObject$file_type, auto_unbox = TRUE, digits = NA))
        file_typeObject <- FileType$new(ArrayInfoObject$file_type)
        self$`file_type` <- file_typeObject
      }
      if (!is.null(ArrayInfoObject$`file_properties`)) {
        self$`file_properties` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`file_properties`, "map(character)", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoObject$`uri`)) {
        self$`uri` <- ArrayInfoObject$`uri`
      }
      if (!is.null(ArrayInfoObject$`namespace`)) {
        self$`namespace` <- ArrayInfoObject$`namespace`
      }
      if (!is.null(ArrayInfoObject$`size`)) {
        self$`size` <- ArrayInfoObject$`size`
      }
      if (!is.null(ArrayInfoObject$`last_accessed`)) {
        self$`last_accessed` <- ArrayInfoObject$`last_accessed`
      }
      if (!is.null(ArrayInfoObject$`description`)) {
        self$`description` <- ArrayInfoObject$`description`
      }
      if (!is.null(ArrayInfoObject$`name`)) {
        self$`name` <- ArrayInfoObject$`name`
      }
      if (!is.null(ArrayInfoObject$`allowed_actions`)) {
        self$`allowed_actions` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`allowed_actions`, "array[ArrayActions]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoObject$`pricing`)) {
        self$`pricing` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`pricing`, "array[Pricing]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoObject$`subscriptions`)) {
        self$`subscriptions` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`subscriptions`, "array[Subscription]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoObject$`logo`)) {
        self$`logo` <- ArrayInfoObject$`logo`
      }
      if (!is.null(ArrayInfoObject$`access_credentials_name`)) {
        self$`access_credentials_name` <- ArrayInfoObject$`access_credentials_name`
      }
      if (!is.null(ArrayInfoObject$`type`)) {
        self$`type` <- ArrayInfoObject$`type`
      }
      if (!is.null(ArrayInfoObject$`share_count`)) {
        self$`share_count` <- ArrayInfoObject$`share_count`
      }
      if (!is.null(ArrayInfoObject$`public_share`)) {
        self$`public_share` <- ArrayInfoObject$`public_share`
      }
      if (!is.null(ArrayInfoObject$`namespace_subscribed`)) {
        self$`namespace_subscribed` <- ArrayInfoObject$`namespace_subscribed`
      }
      if (!is.null(ArrayInfoObject$`tiledb_uri`)) {
        self$`tiledb_uri` <- ArrayInfoObject$`tiledb_uri`
      }
      if (!is.null(ArrayInfoObject$`tags`)) {
        self$`tags` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoObject$`license_id`)) {
        self$`license_id` <- ArrayInfoObject$`license_id`
      }
      if (!is.null(ArrayInfoObject$`license_text`)) {
        self$`license_text` <- ArrayInfoObject$`license_text`
      }
      if (!is.null(ArrayInfoObject$`read_only`)) {
        self$`read_only` <- ArrayInfoObject$`read_only`
      }
      if (!is.null(ArrayInfoObject$`is_favorite`)) {
        self$`is_favorite` <- ArrayInfoObject$`is_favorite`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`id`)) {
        sprintf(
        '"id":
          "%s"
                ',
        self$`id`
        )},
        if (!is.null(self$`file_type`)) {
        sprintf(
        '"file_type":
        %s
        ',
        jsonlite::toJSON(self$`file_type`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`file_properties`)) {
        sprintf(
        '"file_properties":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`file_properties`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )},
        if (!is.null(self$`uri`)) {
        sprintf(
        '"uri":
          "%s"
                ',
        self$`uri`
        )},
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`size`)) {
        sprintf(
        '"size":
          %d
                ',
        self$`size`
        )},
        if (!is.null(self$`last_accessed`)) {
        sprintf(
        '"last_accessed":
          "%s"
                ',
        self$`last_accessed`
        )},
        if (!is.null(self$`description`)) {
        sprintf(
        '"description":
          "%s"
                ',
        self$`description`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`allowed_actions`)) {
        sprintf(
        '"allowed_actions":
        [%s]
',
        paste(sapply(self$`allowed_actions`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`pricing`)) {
        sprintf(
        '"pricing":
        [%s]
',
        paste(sapply(self$`pricing`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`subscriptions`)) {
        sprintf(
        '"subscriptions":
        [%s]
',
        paste(sapply(self$`subscriptions`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`logo`)) {
        sprintf(
        '"logo":
          "%s"
                ',
        self$`logo`
        )},
        if (!is.null(self$`access_credentials_name`)) {
        sprintf(
        '"access_credentials_name":
          "%s"
                ',
        self$`access_credentials_name`
        )},
        if (!is.null(self$`type`)) {
        sprintf(
        '"type":
          "%s"
                ',
        self$`type`
        )},
        if (!is.null(self$`share_count`)) {
        sprintf(
        '"share_count":
          %d
                ',
        self$`share_count`
        )},
        if (!is.null(self$`public_share`)) {
        sprintf(
        '"public_share":
          "%s"
                ',
        self$`public_share`
        )},
        if (!is.null(self$`namespace_subscribed`)) {
        sprintf(
        '"namespace_subscribed":
          "%s"
                ',
        self$`namespace_subscribed`
        )},
        if (!is.null(self$`tiledb_uri`)) {
        sprintf(
        '"tiledb_uri":
          "%s"
                ',
        self$`tiledb_uri`
        )},
        if (!is.null(self$`tags`)) {
        sprintf(
        '"tags":
           [%s]
        ',
        paste(unlist(lapply(self$`tags`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`license_id`)) {
        sprintf(
        '"license_id":
          "%s"
                ',
        self$`license_id`
        )},
        if (!is.null(self$`license_text`)) {
        sprintf(
        '"license_text":
          "%s"
                ',
        self$`license_text`
        )},
        if (!is.null(self$`read_only`)) {
        sprintf(
        '"read_only":
          "%s"
                ',
        self$`read_only`
        )},
        if (!is.null(self$`is_favorite`)) {
        sprintf(
        '"is_favorite":
          "%s"
                ',
        self$`is_favorite`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ArrayInfoJson) {
      ArrayInfoObject <- jsonlite::fromJSON(ArrayInfoJson)
      self$`id` <- ArrayInfoObject$`id`
      self$`file_type` <- FileType$new()$fromJSON(jsonlite::toJSON(ArrayInfoObject$file_type, auto_unbox = TRUE, digits = NA))
      self$`file_properties` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`file_properties`, "map(character)", loadNamespace("tiledbcloud"))
      self$`uri` <- ArrayInfoObject$`uri`
      self$`namespace` <- ArrayInfoObject$`namespace`
      self$`size` <- ArrayInfoObject$`size`
      self$`last_accessed` <- ArrayInfoObject$`last_accessed`
      self$`description` <- ArrayInfoObject$`description`
      self$`name` <- ArrayInfoObject$`name`
      self$`allowed_actions` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`allowed_actions`, "array[ArrayActions]", loadNamespace("tiledbcloud"))
      self$`pricing` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`pricing`, "array[Pricing]", loadNamespace("tiledbcloud"))
      self$`subscriptions` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`subscriptions`, "array[Subscription]", loadNamespace("tiledbcloud"))
      self$`logo` <- ArrayInfoObject$`logo`
      self$`access_credentials_name` <- ArrayInfoObject$`access_credentials_name`
      self$`type` <- ArrayInfoObject$`type`
      self$`share_count` <- ArrayInfoObject$`share_count`
      self$`public_share` <- ArrayInfoObject$`public_share`
      self$`namespace_subscribed` <- ArrayInfoObject$`namespace_subscribed`
      self$`tiledb_uri` <- ArrayInfoObject$`tiledb_uri`
      self$`tags` <- ApiClient$new()$deserializeObj(ArrayInfoObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      self$`license_id` <- ArrayInfoObject$`license_id`
      self$`license_text` <- ArrayInfoObject$`license_text`
      self$`read_only` <- ArrayInfoObject$`read_only`
      self$`is_favorite` <- ArrayInfoObject$`is_favorite`
      self
    }
  )
)
TileDB-Inc/TileDB-Cloud-R documentation built on July 18, 2024, 3:33 p.m.