R/configuration_payload.R

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

#' @docType class
#' @title ConfigurationPayload
#'
#' @description ConfigurationPayload Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field name  character [optional]
#'
#' @field namespace  character [optional]
#'
#' @field methodRepoMethod  \link{ConfigurationPayloadMethodRepoMethod} [optional]
#'
#' @field outputs  named list( character ) [optional]
#'
#' @field inputs  named list( character ) [optional]
#'
#' @field rootEntityType  character [optional]
#'
#' @field prerequisites  named list( character ) [optional]
#'
#' @field methodConfigVersion  integer [optional]
#'
#' @field deleted  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ConfigurationPayload <- R6::R6Class(
  'ConfigurationPayload',
  public = list(
    `name` = NULL,
    `namespace` = NULL,
    `methodRepoMethod` = NULL,
    `outputs` = NULL,
    `inputs` = NULL,
    `rootEntityType` = NULL,
    `prerequisites` = NULL,
    `methodConfigVersion` = NULL,
    `deleted` = NULL,
    initialize = function(
        `name`='cancer_exome_pipeline_v2', `namespace`='broad-dsde-dev', `methodRepoMethod`=NULL, `outputs`=NULL, `inputs`=NULL, `rootEntityType`='pair', `prerequisites`=NULL, `methodConfigVersion`=1, `deleted`=FALSE, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!is.null(`namespace`)) {
        stopifnot(is.character(`namespace`), length(`namespace`) == 1)
        self$`namespace` <- `namespace`
      }
      if (!is.null(`methodRepoMethod`)) {
        stopifnot(R6::is.R6(`methodRepoMethod`))
        self$`methodRepoMethod` <- `methodRepoMethod`
      }
      if (!is.null(`outputs`)) {
        stopifnot(is.vector(`outputs`), length(`outputs`) != 0)
        sapply(`outputs`, function(x) stopifnot(is.character(x)))
        self$`outputs` <- `outputs`
      }
      if (!is.null(`inputs`)) {
        stopifnot(is.vector(`inputs`), length(`inputs`) != 0)
        sapply(`inputs`, function(x) stopifnot(is.character(x)))
        self$`inputs` <- `inputs`
      }
      if (!is.null(`rootEntityType`)) {
        stopifnot(is.character(`rootEntityType`), length(`rootEntityType`) == 1)
        self$`rootEntityType` <- `rootEntityType`
      }
      if (!is.null(`prerequisites`)) {
        stopifnot(is.vector(`prerequisites`), length(`prerequisites`) != 0)
        sapply(`prerequisites`, function(x) stopifnot(is.character(x)))
        self$`prerequisites` <- `prerequisites`
      }
      if (!is.null(`methodConfigVersion`)) {
        stopifnot(is.numeric(`methodConfigVersion`), length(`methodConfigVersion`) == 1)
        self$`methodConfigVersion` <- `methodConfigVersion`
      }
      if (!is.null(`deleted`)) {
        self$`deleted` <- `deleted`
      }
    },
    toJSON = function() {
      ConfigurationPayloadObject <- list()
      if (!is.null(self$`name`)) {
        ConfigurationPayloadObject[['name']] <-
          self$`name`
      }
      if (!is.null(self$`namespace`)) {
        ConfigurationPayloadObject[['namespace']] <-
          self$`namespace`
      }
      if (!is.null(self$`methodRepoMethod`)) {
        ConfigurationPayloadObject[['methodRepoMethod']] <-
          self$`methodRepoMethod`$toJSON()
      }
      if (!is.null(self$`outputs`)) {
        ConfigurationPayloadObject[['outputs']] <-
          self$`outputs`
      }
      if (!is.null(self$`inputs`)) {
        ConfigurationPayloadObject[['inputs']] <-
          self$`inputs`
      }
      if (!is.null(self$`rootEntityType`)) {
        ConfigurationPayloadObject[['rootEntityType']] <-
          self$`rootEntityType`
      }
      if (!is.null(self$`prerequisites`)) {
        ConfigurationPayloadObject[['prerequisites']] <-
          self$`prerequisites`
      }
      if (!is.null(self$`methodConfigVersion`)) {
        ConfigurationPayloadObject[['methodConfigVersion']] <-
          self$`methodConfigVersion`
      }
      if (!is.null(self$`deleted`)) {
        ConfigurationPayloadObject[['deleted']] <-
          self$`deleted`
      }

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