R/tool_descriptor.R

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

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

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