R/tool_class.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title ToolClass
#'
#' @description ToolClass Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field id  character [optional]
#'
#' @field name  character [optional]
#'
#' @field description  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ToolClass <- R6::R6Class(
  'ToolClass',
  public = list(
    `id` = NULL,
    `name` = NULL,
    `description` = NULL,
    initialize = function(
        `id`=NULL, `name`=NULL, `description`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
      if (!is.null(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!is.null(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
    },
    toJSON = function() {
      ToolClassObject <- list()
      if (!is.null(self$`id`)) {
        ToolClassObject[['id']] <-
          self$`id`
      }
      if (!is.null(self$`name`)) {
        ToolClassObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`description`)) {
        ToolClassObject[['description']] <-
          self$`description`
      }

      ToolClassObject
    },
    fromJSON = function(ToolClassJson) {
      ToolClassObject <- jsonlite::fromJSON(ToolClassJson)
      if (!is.null(ToolClassObject$`id`)) {
        self$`id` <- ToolClassObject$`id`
      }
      if (!is.null(ToolClassObject$`name`)) {
        self$`name` <- ToolClassObject$`name`
      }
      if (!is.null(ToolClassObject$`description`)) {
        self$`description` <- ToolClassObject$`description`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`id`)) {
        sprintf(
        '"id":
          "%s"
                ',
        self$`id`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`description`)) {
        sprintf(
        '"description":
          "%s"
                ',
        self$`description`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ToolClassJson) {
      ToolClassObject <- jsonlite::fromJSON(ToolClassJson)
      self$`id` <- ToolClassObject$`id`
      self$`name` <- ToolClassObject$`name`
      self$`description` <- ToolClassObject$`description`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.