R/method_definition.R

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

#' @docType class
#' @title MethodDefinition
#'
#' @description MethodDefinition Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field namespace  character [optional]
#'
#' @field name  character [optional]
#'
#' @field synopsis  character [optional]
#'
#' @field managers  list( character ) [optional]
#'
#' @field public  character [optional]
#'
#' @field numConfigurations  integer [optional]
#'
#' @field numSnapshots  integer [optional]
#'
#' @field entityType  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
MethodDefinition <- R6::R6Class(
  'MethodDefinition',
  public = list(
    `namespace` = NULL,
    `name` = NULL,
    `synopsis` = NULL,
    `managers` = NULL,
    `public` = NULL,
    `numConfigurations` = NULL,
    `numSnapshots` = NULL,
    `entityType` = NULL,
    initialize = function(
        `namespace`=NULL, `name`=NULL, `synopsis`=NULL, `managers`=NULL, `public`=NULL, `numConfigurations`=NULL, `numSnapshots`=NULL, `entityType`='Workflow', ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!is.null(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!is.null(`synopsis`)) {
        stopifnot(is.character(`synopsis`), length(`synopsis`) == 1)
        self$`synopsis` <- `synopsis`
      }
      if (!is.null(`managers`)) {
        stopifnot(is.vector(`managers`), length(`managers`) != 0)
        sapply(`managers`, function(x) stopifnot(is.character(x)))
        self$`managers` <- `managers`
      }
      if (!is.null(`public`)) {
        self$`public` <- `public`
      }
      if (!is.null(`numConfigurations`)) {
        stopifnot(is.numeric(`numConfigurations`), length(`numConfigurations`) == 1)
        self$`numConfigurations` <- `numConfigurations`
      }
      if (!is.null(`numSnapshots`)) {
        stopifnot(is.numeric(`numSnapshots`), length(`numSnapshots`) == 1)
        self$`numSnapshots` <- `numSnapshots`
      }
      if (!is.null(`entityType`)) {
        stopifnot(is.character(`entityType`), length(`entityType`) == 1)
        self$`entityType` <- `entityType`
      }
    },
    toJSON = function() {
      MethodDefinitionObject <- list()
      if (!is.null(self$`namespace`)) {
        MethodDefinitionObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`name`)) {
        MethodDefinitionObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`synopsis`)) {
        MethodDefinitionObject[['synopsis']] <-
          self$`synopsis`
      }
      if (!is.null(self$`managers`)) {
        MethodDefinitionObject[['managers']] <-
          self$`managers`
      }
      if (!is.null(self$`public`)) {
        MethodDefinitionObject[['public']] <-
          self$`public`
      }
      if (!is.null(self$`numConfigurations`)) {
        MethodDefinitionObject[['numConfigurations']] <-
          self$`numConfigurations`
      }
      if (!is.null(self$`numSnapshots`)) {
        MethodDefinitionObject[['numSnapshots']] <-
          self$`numSnapshots`
      }
      if (!is.null(self$`entityType`)) {
        MethodDefinitionObject[['entityType']] <-
          self$`entityType`
      }

      MethodDefinitionObject
    },
    fromJSON = function(MethodDefinitionJson) {
      MethodDefinitionObject <- jsonlite::fromJSON(MethodDefinitionJson)
      if (!is.null(MethodDefinitionObject$`namespace`)) {
        self$`namespace` <- MethodDefinitionObject$`namespace`
      }
      if (!is.null(MethodDefinitionObject$`name`)) {
        self$`name` <- MethodDefinitionObject$`name`
      }
      if (!is.null(MethodDefinitionObject$`synopsis`)) {
        self$`synopsis` <- MethodDefinitionObject$`synopsis`
      }
      if (!is.null(MethodDefinitionObject$`managers`)) {
        self$`managers` <- ApiClient$new()$deserializeObj(MethodDefinitionObject$`managers`, "array[character]", loadNamespace("openapi"))
      }
      if (!is.null(MethodDefinitionObject$`public`)) {
        self$`public` <- MethodDefinitionObject$`public`
      }
      if (!is.null(MethodDefinitionObject$`numConfigurations`)) {
        self$`numConfigurations` <- MethodDefinitionObject$`numConfigurations`
      }
      if (!is.null(MethodDefinitionObject$`numSnapshots`)) {
        self$`numSnapshots` <- MethodDefinitionObject$`numSnapshots`
      }
      if (!is.null(MethodDefinitionObject$`entityType`)) {
        self$`entityType` <- MethodDefinitionObject$`entityType`
      }
      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$`synopsis`)) {
        sprintf(
        '"synopsis":
          "%s"
                ',
        self$`synopsis`
        )},
        if (!is.null(self$`managers`)) {
        sprintf(
        '"managers":
           [%s]
        ',
        paste(unlist(lapply(self$`managers`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`public`)) {
        sprintf(
        '"public":
          "%s"
                ',
        self$`public`
        )},
        if (!is.null(self$`numConfigurations`)) {
        sprintf(
        '"numConfigurations":
          %d
                ',
        self$`numConfigurations`
        )},
        if (!is.null(self$`numSnapshots`)) {
        sprintf(
        '"numSnapshots":
          %d
                ',
        self$`numSnapshots`
        )},
        if (!is.null(self$`entityType`)) {
        sprintf(
        '"entityType":
          "%s"
                ',
        self$`entityType`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(MethodDefinitionJson) {
      MethodDefinitionObject <- jsonlite::fromJSON(MethodDefinitionJson)
      self$`namespace` <- MethodDefinitionObject$`namespace`
      self$`name` <- MethodDefinitionObject$`name`
      self$`synopsis` <- MethodDefinitionObject$`synopsis`
      self$`managers` <- ApiClient$new()$deserializeObj(MethodDefinitionObject$`managers`, "array[character]", loadNamespace("openapi"))
      self$`public` <- MethodDefinitionObject$`public`
      self$`numConfigurations` <- MethodDefinitionObject$`numConfigurations`
      self$`numSnapshots` <- MethodDefinitionObject$`numSnapshots`
      self$`entityType` <- MethodDefinitionObject$`entityType`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.