R/tool_version.R

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

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

      ToolVersionObject
    },
    fromJSON = function(ToolVersionJson) {
      ToolVersionObject <- jsonlite::fromJSON(ToolVersionJson)
      if (!is.null(ToolVersionObject$`name`)) {
        self$`name` <- ToolVersionObject$`name`
      }
      if (!is.null(ToolVersionObject$`url`)) {
        self$`url` <- ToolVersionObject$`url`
      }
      if (!is.null(ToolVersionObject$`id`)) {
        self$`id` <- ToolVersionObject$`id`
      }
      if (!is.null(ToolVersionObject$`image`)) {
        self$`image` <- ToolVersionObject$`image`
      }
      if (!is.null(ToolVersionObject$`descriptor-type`)) {
        self$`descriptor-type` <- ApiClient$new()$deserializeObj(ToolVersionObject$`descriptor-type`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(ToolVersionObject$`dockerfile`)) {
        self$`dockerfile` <- ToolVersionObject$`dockerfile`
      }
      if (!is.null(ToolVersionObject$`meta-version`)) {
        self$`meta-version` <- ToolVersionObject$`meta-version`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`url`)) {
        sprintf(
        '"url":
          "%s"
                ',
        self$`url`
        )},
        if (!is.null(self$`id`)) {
        sprintf(
        '"id":
          "%s"
                ',
        self$`id`
        )},
        if (!is.null(self$`image`)) {
        sprintf(
        '"image":
          "%s"
                ',
        self$`image`
        )},
        if (!is.null(self$`descriptor-type`)) {
        sprintf(
        '"descriptor-type":
           [%s]
        ',
        paste(unlist(lapply(self$`descriptor-type`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`dockerfile`)) {
        sprintf(
        '"dockerfile":
          "%s"
                ',
        self$`dockerfile`
        )},
        if (!is.null(self$`meta-version`)) {
        sprintf(
        '"meta-version":
          "%s"
                ',
        self$`meta-version`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ToolVersionJson) {
      ToolVersionObject <- jsonlite::fromJSON(ToolVersionJson)
      self$`name` <- ToolVersionObject$`name`
      self$`url` <- ToolVersionObject$`url`
      self$`id` <- ToolVersionObject$`id`
      self$`image` <- ToolVersionObject$`image`
      self$`descriptor-type` <- ApiClient$new()$deserializeObj(ToolVersionObject$`descriptor-type`, "array[character]", loadNamespace("openapi"))
      self$`dockerfile` <- ToolVersionObject$`dockerfile`
      self$`meta-version` <- ToolVersionObject$`meta-version`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.