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

      GroupCreateObject
    },
    fromJSON = function(GroupCreateJson) {
      GroupCreateObject <- jsonlite::fromJSON(GroupCreateJson)
      if (!is.null(GroupCreateObject$`description`)) {
        self$`description` <- GroupCreateObject$`description`
      }
      if (!is.null(GroupCreateObject$`name`)) {
        self$`name` <- GroupCreateObject$`name`
      }
      if (!is.null(GroupCreateObject$`parent`)) {
        self$`parent` <- GroupCreateObject$`parent`
      }
      if (!is.null(GroupCreateObject$`uri`)) {
        self$`uri` <- GroupCreateObject$`uri`
      }
      if (!is.null(GroupCreateObject$`logo`)) {
        self$`logo` <- GroupCreateObject$`logo`
      }
      if (!is.null(GroupCreateObject$`access_credentials_name`)) {
        self$`access_credentials_name` <- GroupCreateObject$`access_credentials_name`
      }
      if (!is.null(GroupCreateObject$`tags`)) {
        self$`tags` <- ApiClient$new()$deserializeObj(GroupCreateObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(GroupCreateObject$`license_id`)) {
        self$`license_id` <- GroupCreateObject$`license_id`
      }
      if (!is.null(GroupCreateObject$`license_text`)) {
        self$`license_text` <- GroupCreateObject$`license_text`
      }
      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$`parent`)) {
        sprintf(
        '"parent":
          "%s"
                ',
        self$`parent`
        )},
        if (!is.null(self$`uri`)) {
        sprintf(
        '"uri":
          "%s"
                ',
        self$`uri`
        )},
        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$`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`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(GroupCreateJson) {
      GroupCreateObject <- jsonlite::fromJSON(GroupCreateJson)
      self$`description` <- GroupCreateObject$`description`
      self$`name` <- GroupCreateObject$`name`
      self$`parent` <- GroupCreateObject$`parent`
      self$`uri` <- GroupCreateObject$`uri`
      self$`logo` <- GroupCreateObject$`logo`
      self$`access_credentials_name` <- GroupCreateObject$`access_credentials_name`
      self$`tags` <- ApiClient$new()$deserializeObj(GroupCreateObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      self$`license_id` <- GroupCreateObject$`license_id`
      self$`license_text` <- GroupCreateObject$`license_text`
      self
    }
  )
)
TileDB-Inc/TileDB-Cloud-R documentation built on July 18, 2024, 3:33 p.m.