R/group_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 GroupUpdate
#'
#' @description GroupUpdate Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field description  character [optional]
#'
#' @field name  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
GroupUpdate <- R6::R6Class(
  'GroupUpdate',
  public = list(
    `description` = NULL,
    `name` = NULL,
    `logo` = NULL,
    `access_credentials_name` = NULL,
    `tags` = NULL,
    `license_id` = NULL,
    `license_text` = NULL,
    initialize = function(
        `description`=NULL, `name`=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(`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() {
      GroupUpdateObject <- list()
      if (!is.null(self$`description`)) {
        GroupUpdateObject[['description']] <-
          self$`description`
      }
      if (!is.null(self$`name`)) {
        GroupUpdateObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`logo`)) {
        GroupUpdateObject[['logo']] <-
          self$`logo`
      }
      if (!is.null(self$`access_credentials_name`)) {
        GroupUpdateObject[['access_credentials_name']] <-
          self$`access_credentials_name`
      }
      if (!is.null(self$`tags`)) {
        GroupUpdateObject[['tags']] <-
          self$`tags`
      }
      if (!is.null(self$`license_id`)) {
        GroupUpdateObject[['license_id']] <-
          self$`license_id`
      }
      if (!is.null(self$`license_text`)) {
        GroupUpdateObject[['license_text']] <-
          self$`license_text`
      }

      GroupUpdateObject
    },
    fromJSON = function(GroupUpdateJson) {
      GroupUpdateObject <- jsonlite::fromJSON(GroupUpdateJson)
      if (!is.null(GroupUpdateObject$`description`)) {
        self$`description` <- GroupUpdateObject$`description`
      }
      if (!is.null(GroupUpdateObject$`name`)) {
        self$`name` <- GroupUpdateObject$`name`
      }
      if (!is.null(GroupUpdateObject$`logo`)) {
        self$`logo` <- GroupUpdateObject$`logo`
      }
      if (!is.null(GroupUpdateObject$`access_credentials_name`)) {
        self$`access_credentials_name` <- GroupUpdateObject$`access_credentials_name`
      }
      if (!is.null(GroupUpdateObject$`tags`)) {
        self$`tags` <- ApiClient$new()$deserializeObj(GroupUpdateObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      }
      if (!is.null(GroupUpdateObject$`license_id`)) {
        self$`license_id` <- GroupUpdateObject$`license_id`
      }
      if (!is.null(GroupUpdateObject$`license_text`)) {
        self$`license_text` <- GroupUpdateObject$`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$`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(GroupUpdateJson) {
      GroupUpdateObject <- jsonlite::fromJSON(GroupUpdateJson)
      self$`description` <- GroupUpdateObject$`description`
      self$`name` <- GroupUpdateObject$`name`
      self$`logo` <- GroupUpdateObject$`logo`
      self$`access_credentials_name` <- GroupUpdateObject$`access_credentials_name`
      self$`tags` <- ApiClient$new()$deserializeObj(GroupUpdateObject$`tags`, "array[character]", loadNamespace("tiledbcloud"))
      self$`license_id` <- GroupUpdateObject$`license_id`
      self$`license_text` <- GroupUpdateObject$`license_text`
      self
    }
  )
)
eddelbuettel/tldbclr documentation built on Sept. 25, 2022, 12:46 p.m.