R/method_config_rename.R

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

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

      MethodConfigRenameObject
    },
    fromJSON = function(MethodConfigRenameJson) {
      MethodConfigRenameObject <- jsonlite::fromJSON(MethodConfigRenameJson)
      if (!is.null(MethodConfigRenameObject$`namespace`)) {
        self$`namespace` <- MethodConfigRenameObject$`namespace`
      }
      if (!is.null(MethodConfigRenameObject$`name`)) {
        self$`name` <- MethodConfigRenameObject$`name`
      }
      if (!is.null(MethodConfigRenameObject$`workspaceName`)) {
        self$`workspaceName` <- ApiClient$new()$deserializeObj(MethodConfigRenameObject$`workspaceName`, "map(character)", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`namespace`)) {
        sprintf(
        '"namespace":
          "%s"
                ',
        self$`namespace`
        )},
        if (!is.null(self$`name`)) {
        sprintf(
        '"name":
          "%s"
                ',
        self$`name`
        )},
        if (!is.null(self$`workspaceName`)) {
        sprintf(
        '"workspaceName":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`workspaceName`, function(x){ x }), auto_unbox = TRUE, digits=NA)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(MethodConfigRenameJson) {
      MethodConfigRenameObject <- jsonlite::fromJSON(MethodConfigRenameJson)
      self$`namespace` <- MethodConfigRenameObject$`namespace`
      self$`name` <- MethodConfigRenameObject$`name`
      self$`workspaceName` <- ApiClient$new()$deserializeObj(MethodConfigRenameObject$`workspaceName`, "map(character)", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.