R/workflow_cache_diff_response.R

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

#' @docType class
#' @title WorkflowCacheDiffResponse
#'
#' @description WorkflowCacheDiffResponse Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field callA  \link{WorkflowCallDiff} [optional]
#'
#' @field callB  \link{WorkflowCallDiff} [optional]
#'
#' @field hashDifferential  list( \link{WorkflowCallDiffCallHashDiff} ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
WorkflowCacheDiffResponse <- R6::R6Class(
  'WorkflowCacheDiffResponse',
  public = list(
    `callA` = NULL,
    `callB` = NULL,
    `hashDifferential` = NULL,
    initialize = function(
        `callA`=NULL, `callB`=NULL, `hashDifferential`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`callA`)) {
        stopifnot(R6::is.R6(`callA`))
        self$`callA` <- `callA`
      }
      if (!is.null(`callB`)) {
        stopifnot(R6::is.R6(`callB`))
        self$`callB` <- `callB`
      }
      if (!is.null(`hashDifferential`)) {
        stopifnot(is.vector(`hashDifferential`), length(`hashDifferential`) != 0)
        sapply(`hashDifferential`, function(x) stopifnot(R6::is.R6(x)))
        self$`hashDifferential` <- `hashDifferential`
      }
    },
    toJSON = function() {
      WorkflowCacheDiffResponseObject <- list()
      if (!is.null(self$`callA`)) {
        WorkflowCacheDiffResponseObject[['callA']] <-
          self$`callA`$toJSON()
      }
      if (!is.null(self$`callB`)) {
        WorkflowCacheDiffResponseObject[['callB']] <-
          self$`callB`$toJSON()
      }
      if (!is.null(self$`hashDifferential`)) {
        WorkflowCacheDiffResponseObject[['hashDifferential']] <-
          lapply(self$`hashDifferential`, function(x) x$toJSON())
      }

      WorkflowCacheDiffResponseObject
    },
    fromJSON = function(WorkflowCacheDiffResponseJson) {
      WorkflowCacheDiffResponseObject <- jsonlite::fromJSON(WorkflowCacheDiffResponseJson)
      if (!is.null(WorkflowCacheDiffResponseObject$`callA`)) {
        callAObject <- WorkflowCallDiff$new()
        callAObject$fromJSON(jsonlite::toJSON(WorkflowCacheDiffResponseObject$callA, auto_unbox = TRUE, digits = NA))
        self$`callA` <- callAObject
      }
      if (!is.null(WorkflowCacheDiffResponseObject$`callB`)) {
        callBObject <- WorkflowCallDiff$new()
        callBObject$fromJSON(jsonlite::toJSON(WorkflowCacheDiffResponseObject$callB, auto_unbox = TRUE, digits = NA))
        self$`callB` <- callBObject
      }
      if (!is.null(WorkflowCacheDiffResponseObject$`hashDifferential`)) {
        self$`hashDifferential` <- ApiClient$new()$deserializeObj(WorkflowCacheDiffResponseObject$`hashDifferential`, "array[WorkflowCallDiffCallHashDiff]", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`callA`)) {
        sprintf(
        '"callA":
        %s
        ',
        jsonlite::toJSON(self$`callA`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`callB`)) {
        sprintf(
        '"callB":
        %s
        ',
        jsonlite::toJSON(self$`callB`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`hashDifferential`)) {
        sprintf(
        '"hashDifferential":
        [%s]
',
        paste(sapply(self$`hashDifferential`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(WorkflowCacheDiffResponseJson) {
      WorkflowCacheDiffResponseObject <- jsonlite::fromJSON(WorkflowCacheDiffResponseJson)
      self$`callA` <- WorkflowCallDiff$new()$fromJSON(jsonlite::toJSON(WorkflowCacheDiffResponseObject$callA, auto_unbox = TRUE, digits = NA))
      self$`callB` <- WorkflowCallDiff$new()$fromJSON(jsonlite::toJSON(WorkflowCacheDiffResponseObject$callB, auto_unbox = TRUE, digits = NA))
      self$`hashDifferential` <- ApiClient$new()$deserializeObj(WorkflowCacheDiffResponseObject$`hashDifferential`, "array[WorkflowCallDiffCallHashDiff]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.