R/writer.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 Writer
#'
#' @description Writer Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field checkCoordDups  character [optional]
#'
#' @field checkCoordOOB  character [optional]
#'
#' @field dedupCoords  character [optional]
#'
#' @field subarray  \link{DomainArray} [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Writer <- R6::R6Class(
  'Writer',
  public = list(
    `checkCoordDups` = NULL,
    `checkCoordOOB` = NULL,
    `dedupCoords` = NULL,
    `subarray` = NULL,
    initialize = function(
        `checkCoordDups`=NULL, `checkCoordOOB`=NULL, `dedupCoords`=NULL, `subarray`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`checkCoordDups`)) {
        self$`checkCoordDups` <- `checkCoordDups`
      }
      if (!is.null(`checkCoordOOB`)) {
        self$`checkCoordOOB` <- `checkCoordOOB`
      }
      if (!is.null(`dedupCoords`)) {
        self$`dedupCoords` <- `dedupCoords`
      }
      if (!is.null(`subarray`)) {
        stopifnot(R6::is.R6(`subarray`))
        self$`subarray` <- `subarray`
      }
    },
    toJSON = function() {
      WriterObject <- list()
      if (!is.null(self$`checkCoordDups`)) {
        WriterObject[['checkCoordDups']] <-
          self$`checkCoordDups`
      }
      if (!is.null(self$`checkCoordOOB`)) {
        WriterObject[['checkCoordOOB']] <-
          self$`checkCoordOOB`
      }
      if (!is.null(self$`dedupCoords`)) {
        WriterObject[['dedupCoords']] <-
          self$`dedupCoords`
      }
      if (!is.null(self$`subarray`)) {
        WriterObject[['subarray']] <-
          self$`subarray`$toJSON()
      }

      WriterObject
    },
    fromJSON = function(WriterJson) {
      WriterObject <- jsonlite::fromJSON(WriterJson)
      if (!is.null(WriterObject$`checkCoordDups`)) {
        self$`checkCoordDups` <- WriterObject$`checkCoordDups`
      }
      if (!is.null(WriterObject$`checkCoordOOB`)) {
        self$`checkCoordOOB` <- WriterObject$`checkCoordOOB`
      }
      if (!is.null(WriterObject$`dedupCoords`)) {
        self$`dedupCoords` <- WriterObject$`dedupCoords`
      }
      if (!is.null(WriterObject$`subarray`)) {
        subarrayObject <- DomainArray$new()
        subarrayObject$fromJSON(jsonlite::toJSON(WriterObject$subarray, auto_unbox = TRUE, digits = NA))
        self$`subarray` <- subarrayObject
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`checkCoordDups`)) {
        sprintf(
        '"checkCoordDups":
          "%s"
                ',
        self$`checkCoordDups`
        )},
        if (!is.null(self$`checkCoordOOB`)) {
        sprintf(
        '"checkCoordOOB":
          "%s"
                ',
        self$`checkCoordOOB`
        )},
        if (!is.null(self$`dedupCoords`)) {
        sprintf(
        '"dedupCoords":
          "%s"
                ',
        self$`dedupCoords`
        )},
        if (!is.null(self$`subarray`)) {
        sprintf(
        '"subarray":
        %s
        ',
        jsonlite::toJSON(self$`subarray`$toJSON(), auto_unbox=TRUE, digits = NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(WriterJson) {
      WriterObject <- jsonlite::fromJSON(WriterJson)
      self$`checkCoordDups` <- WriterObject$`checkCoordDups`
      self$`checkCoordOOB` <- WriterObject$`checkCoordOOB`
      self$`dedupCoords` <- WriterObject$`dedupCoords`
      self$`subarray` <- DomainArray$new()$fromJSON(jsonlite::toJSON(WriterObject$subarray, auto_unbox = TRUE, digits = NA))
      self
    }
  )
)
TileDB-Inc/TileDB-Cloud-R documentation built on July 18, 2024, 3:33 p.m.