R/workflow_queue_status_response.R

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

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

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