R/notebook_favorite.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 NotebookFavorite
#'
#' @description NotebookFavorite Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field notebook_uuid  character [optional]
#'
#' @field namespace  character [optional]
#'
#' @field name  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
NotebookFavorite <- R6::R6Class(
  'NotebookFavorite',
  public = list(
    `notebook_uuid` = NULL,
    `namespace` = NULL,
    `name` = NULL,
    initialize = function(
        `notebook_uuid`=NULL, `namespace`=NULL, `name`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`notebook_uuid`)) {
        stopifnot(is.character(`notebook_uuid`), length(`notebook_uuid`) == 1)
        self$`notebook_uuid` <- `notebook_uuid`
      }
      if (!is.null(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!is.null(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
    },
    toJSON = function() {
      NotebookFavoriteObject <- list()
      if (!is.null(self$`notebook_uuid`)) {
        NotebookFavoriteObject[['notebook_uuid']] <-
          self$`notebook_uuid`
      }
      if (!is.null(self$`namespace`)) {
        NotebookFavoriteObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`name`)) {
        NotebookFavoriteObject[['name']] <-
          self$`name`
      }

      NotebookFavoriteObject
    },
    fromJSON = function(NotebookFavoriteJson) {
      NotebookFavoriteObject <- jsonlite::fromJSON(NotebookFavoriteJson)
      if (!is.null(NotebookFavoriteObject$`notebook_uuid`)) {
        self$`notebook_uuid` <- NotebookFavoriteObject$`notebook_uuid`
      }
      if (!is.null(NotebookFavoriteObject$`namespace`)) {
        self$`namespace` <- NotebookFavoriteObject$`namespace`
      }
      if (!is.null(NotebookFavoriteObject$`name`)) {
        self$`name` <- NotebookFavoriteObject$`name`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`notebook_uuid`)) {
        sprintf(
        '"notebook_uuid":
          "%s"
                ',
        self$`notebook_uuid`
        )},
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(NotebookFavoriteJson) {
      NotebookFavoriteObject <- jsonlite::fromJSON(NotebookFavoriteJson)
      self$`notebook_uuid` <- NotebookFavoriteObject$`notebook_uuid`
      self$`namespace` <- NotebookFavoriteObject$`namespace`
      self$`name` <- NotebookFavoriteObject$`name`
      self
    }
  )
)
eddelbuettel/tldbclr documentation built on Sept. 25, 2022, 12:46 p.m.