R/group_entry.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 GroupEntry
#'
#' @description GroupEntry Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field member_id  character [optional]
#'
#' @field group  \link{GroupInfo} [optional]
#'
#' @field array  \link{ArrayInfo} [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
GroupEntry <- R6::R6Class(
  'GroupEntry',
  public = list(
    `member_id` = NULL,
    `group` = NULL,
    `array` = NULL,
    initialize = function(
        `member_id`=NULL, `group`=NULL, `array`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`member_id`)) {
        stopifnot(is.character(`member_id`), length(`member_id`) == 1)
        self$`member_id` <- `member_id`
      }
      if (!is.null(`group`)) {
        stopifnot(R6::is.R6(`group`))
        self$`group` <- `group`
      }
      if (!is.null(`array`)) {
        stopifnot(R6::is.R6(`array`))
        self$`array` <- `array`
      }
    },
    toJSON = function() {
      GroupEntryObject <- list()
      if (!is.null(self$`member_id`)) {
        GroupEntryObject[['member_id']] <-
          self$`member_id`
      }
      if (!is.null(self$`group`)) {
        GroupEntryObject[['group']] <-
          self$`group`$toJSON()
      }
      if (!is.null(self$`array`)) {
        GroupEntryObject[['array']] <-
          self$`array`$toJSON()
      }

      GroupEntryObject
    },
    fromJSON = function(GroupEntryJson) {
      GroupEntryObject <- jsonlite::fromJSON(GroupEntryJson)
      if (!is.null(GroupEntryObject$`member_id`)) {
        self$`member_id` <- GroupEntryObject$`member_id`
      }
      if (!is.null(GroupEntryObject$`group`)) {
        groupObject <- GroupInfo$new()
        groupObject$fromJSON(jsonlite::toJSON(GroupEntryObject$group, auto_unbox = TRUE, digits = NA))
        self$`group` <- groupObject
      }
      if (!is.null(GroupEntryObject$`array`)) {
        arrayObject <- ArrayInfo$new()
        arrayObject$fromJSON(jsonlite::toJSON(GroupEntryObject$array, auto_unbox = TRUE, digits = NA))
        self$`array` <- arrayObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`member_id`)) {
        sprintf(
        '"member_id":
          "%s"
                ',
        self$`member_id`
        )},
        if (!is.null(self$`group`)) {
        sprintf(
        '"group":
        %s
        ',
        jsonlite::toJSON(self$`group`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`array`)) {
        sprintf(
        '"array":
        %s
        ',
        jsonlite::toJSON(self$`array`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(GroupEntryJson) {
      GroupEntryObject <- jsonlite::fromJSON(GroupEntryJson)
      self$`member_id` <- GroupEntryObject$`member_id`
      self$`group` <- GroupInfo$new()$fromJSON(jsonlite::toJSON(GroupEntryObject$group, auto_unbox = TRUE, digits = NA))
      self$`array` <- ArrayInfo$new()$fromJSON(jsonlite::toJSON(GroupEntryObject$array, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
TileDB-Inc/TileDB-Cloud-R documentation built on July 18, 2024, 3:33 p.m.