R/array_info_update.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 ArrayInfoUpdate
#'
#' @description ArrayInfoUpdate Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field description  character [optional]
#'
#' @field name  character [optional]
#'
#' @field uri  character [optional]
#'
#' @field file_type  \link{FileType} [optional]
#'
#' @field file_properties  named list( character ) [optional]
#'
#' @field access_credentials_name  character [optional]
#'
#' @field logo  character [optional]
#'
#' @field tags  list( character ) [optional]
#'
#' @field license_id  character [optional]
#'
#' @field license_text  character [optional]
#'
#' @field read_only  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ArrayInfoUpdate <- R6::R6Class(
  'ArrayInfoUpdate',
  public = list(
    `description` = NULL,
    `name` = NULL,
    `uri` = NULL,
    `file_type` = NULL,
    `file_properties` = NULL,
    `access_credentials_name` = NULL,
    `logo` = NULL,
    `tags` = NULL,
    `license_id` = NULL,
    `license_text` = NULL,
    `read_only` = NULL,
    initialize = function(
        `description`=NULL, `name`=NULL, `uri`=NULL, `file_type`=NULL, `file_properties`=NULL, `access_credentials_name`=NULL, `logo`=NULL, `tags`=NULL, `license_id`=NULL, `license_text`=NULL, `read_only`=NULL, ...
    ) {
      local.optional.var <- list(...)
      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(`uri`)) {
        stopifnot(is.character(`uri`), length(`uri`) == 1)
        self$`uri` <- `uri`
      }
      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(`access_credentials_name`)) {
        stopifnot(is.character(`access_credentials_name`), length(`access_credentials_name`) == 1)
        self$`access_credentials_name` <- `access_credentials_name`
      }
      if (!is.null(`logo`)) {
        stopifnot(is.character(`logo`), length(`logo`) == 1)
        self$`logo` <- `logo`
      }
      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`
      }
    },
    toJSON = function() {
      ArrayInfoUpdateObject <- list()
      if (!is.null(self$`description`)) {
        ArrayInfoUpdateObject[['description']] <-
          self$`description`
      }
      if (!is.null(self$`name`)) {
        ArrayInfoUpdateObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`uri`)) {
        ArrayInfoUpdateObject[['uri']] <-
          self$`uri`
      }
      if (!is.null(self$`file_type`)) {
        ArrayInfoUpdateObject[['file_type']] <-
          self$`file_type`$toJSON()
      }
      if (!is.null(self$`file_properties`)) {
        ArrayInfoUpdateObject[['file_properties']] <-
          self$`file_properties`
      }
      if (!is.null(self$`access_credentials_name`)) {
        ArrayInfoUpdateObject[['access_credentials_name']] <-
          self$`access_credentials_name`
      }
      if (!is.null(self$`logo`)) {
        ArrayInfoUpdateObject[['logo']] <-
          self$`logo`
      }
      if (!is.null(self$`tags`)) {
        ArrayInfoUpdateObject[['tags']] <-
          self$`tags`
      }
      if (!is.null(self$`license_id`)) {
        ArrayInfoUpdateObject[['license_id']] <-
          self$`license_id`
      }
      if (!is.null(self$`license_text`)) {
        ArrayInfoUpdateObject[['license_text']] <-
          self$`license_text`
      }
      if (!is.null(self$`read_only`)) {
        ArrayInfoUpdateObject[['read_only']] <-
          self$`read_only`
      }

      ArrayInfoUpdateObject
    },
    fromJSON = function(ArrayInfoUpdateJson) {
      ArrayInfoUpdateObject <- jsonlite::fromJSON(ArrayInfoUpdateJson)
      if (!is.null(ArrayInfoUpdateObject$`description`)) {
        self$`description` <- ArrayInfoUpdateObject$`description`
      }
      if (!is.null(ArrayInfoUpdateObject$`name`)) {
        self$`name` <- ArrayInfoUpdateObject$`name`
      }
      if (!is.null(ArrayInfoUpdateObject$`uri`)) {
        self$`uri` <- ArrayInfoUpdateObject$`uri`
      }
      if (!is.null(ArrayInfoUpdateObject$`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(ArrayInfoUpdateObject$file_type, auto_unbox = TRUE, digits = NA))
        file_typeObject <- FileType$new(ArrayInfoUpdateObject$file_type)
        self$`file_type` <- file_typeObject
      }
      if (!is.null(ArrayInfoUpdateObject$`file_properties`)) {
        self$`file_properties` <- ApiClient$new()$deserializeObj(ArrayInfoUpdateObject$`file_properties`, "map(character)", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoUpdateObject$`access_credentials_name`)) {
        self$`access_credentials_name` <- ArrayInfoUpdateObject$`access_credentials_name`
      }
      if (!is.null(ArrayInfoUpdateObject$`logo`)) {
        self$`logo` <- ArrayInfoUpdateObject$`logo`
      }
      if (!is.null(ArrayInfoUpdateObject$`tags`)) {
        self$`tags` <- ApiClient$new()$deserializeObj(ArrayInfoUpdateObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(ArrayInfoUpdateObject$`license_id`)) {
        self$`license_id` <- ArrayInfoUpdateObject$`license_id`
      }
      if (!is.null(ArrayInfoUpdateObject$`license_text`)) {
        self$`license_text` <- ArrayInfoUpdateObject$`license_text`
      }
      if (!is.null(ArrayInfoUpdateObject$`read_only`)) {
        self$`read_only` <- ArrayInfoUpdateObject$`read_only`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`description`)) {
        sprintf(
        '"description":
          "%s"
                ',
        self$`description`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`uri`)) {
        sprintf(
        '"uri":
          "%s"
                ',
        self$`uri`
        )},
        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$`access_credentials_name`)) {
        sprintf(
        '"access_credentials_name":
          "%s"
                ',
        self$`access_credentials_name`
        )},
        if (!is.null(self$`logo`)) {
        sprintf(
        '"logo":
          "%s"
                ',
        self$`logo`
        )},
        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`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ArrayInfoUpdateJson) {
      ArrayInfoUpdateObject <- jsonlite::fromJSON(ArrayInfoUpdateJson)
      self$`description` <- ArrayInfoUpdateObject$`description`
      self$`name` <- ArrayInfoUpdateObject$`name`
      self$`uri` <- ArrayInfoUpdateObject$`uri`
      self$`file_type` <- FileType$new()$fromJSON(jsonlite::toJSON(ArrayInfoUpdateObject$file_type, auto_unbox = TRUE, digits = NA))
      self$`file_properties` <- ApiClient$new()$deserializeObj(ArrayInfoUpdateObject$`file_properties`, "map(character)", loadNamespace("tiledbcloud"))
      self$`access_credentials_name` <- ArrayInfoUpdateObject$`access_credentials_name`
      self$`logo` <- ArrayInfoUpdateObject$`logo`
      self$`tags` <- ApiClient$new()$deserializeObj(ArrayInfoUpdateObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      self$`license_id` <- ArrayInfoUpdateObject$`license_id`
      self$`license_text` <- ArrayInfoUpdateObject$`license_text`
      self$`read_only` <- ArrayInfoUpdateObject$`read_only`
      self
    }
  )
)
eddelbuettel/tldbclr documentation built on Sept. 25, 2022, 12:46 p.m.