R/workflow_query_response.R

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

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

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