R/workspace_tag.R

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

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

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