R/call_metadata.R

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

#' @docType class
#' @title CallMetadata
#'
#' @description CallMetadata Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field inputs  named list( object ) [optional]
#'
#' @field executionStatus  character [optional]
#'
#' @field executionEvents  list( \link{ExecutionEvent} ) [optional]
#'
#' @field backendStatus  character [optional]
#'
#' @field backendLogs  named list( character ) [optional]
#'
#' @field outputs  named list( character ) [optional]
#'
#' @field start  character [optional]
#'
#' @field end  character [optional]
#'
#' @field jobId  character [optional]
#'
#' @field returnCode  integer [optional]
#'
#' @field backend  character [optional]
#'
#' @field stdout  character [optional]
#'
#' @field stderr  character [optional]
#'
#' @field shardIndex  integer [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
CallMetadata <- R6::R6Class(
  'CallMetadata',
  public = list(
    `inputs` = NULL,
    `executionStatus` = NULL,
    `executionEvents` = NULL,
    `backendStatus` = NULL,
    `backendLogs` = NULL,
    `outputs` = NULL,
    `start` = NULL,
    `end` = NULL,
    `jobId` = NULL,
    `returnCode` = NULL,
    `backend` = NULL,
    `stdout` = NULL,
    `stderr` = NULL,
    `shardIndex` = NULL,
    initialize = function(
        `inputs`=NULL, `executionStatus`=NULL, `executionEvents`=NULL, `backendStatus`=NULL, `backendLogs`=NULL, `outputs`=NULL, `start`=NULL, `end`=NULL, `jobId`=NULL, `returnCode`=NULL, `backend`=NULL, `stdout`=NULL, `stderr`=NULL, `shardIndex`=NULL, ...
    ) {
      local.optional.var <- list(...)
      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(`executionStatus`)) {
        stopifnot(is.character(`executionStatus`), length(`executionStatus`) == 1)
        self$`executionStatus` <- `executionStatus`
      }
      if (!is.null(`executionEvents`)) {
        stopifnot(is.vector(`executionEvents`), length(`executionEvents`) != 0)
        sapply(`executionEvents`, function(x) stopifnot(R6::is.R6(x)))
        self$`executionEvents` <- `executionEvents`
      }
      if (!is.null(`backendStatus`)) {
        stopifnot(is.character(`backendStatus`), length(`backendStatus`) == 1)
        self$`backendStatus` <- `backendStatus`
      }
      if (!is.null(`backendLogs`)) {
        stopifnot(is.vector(`backendLogs`), length(`backendLogs`) != 0)
        sapply(`backendLogs`, function(x) stopifnot(is.character(x)))
        self$`backendLogs` <- `backendLogs`
      }
      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(`start`)) {
        stopifnot(is.character(`start`), length(`start`) == 1)
        self$`start` <- `start`
      }
      if (!is.null(`end`)) {
        stopifnot(is.character(`end`), length(`end`) == 1)
        self$`end` <- `end`
      }
      if (!is.null(`jobId`)) {
        stopifnot(is.character(`jobId`), length(`jobId`) == 1)
        self$`jobId` <- `jobId`
      }
      if (!is.null(`returnCode`)) {
        stopifnot(is.numeric(`returnCode`), length(`returnCode`) == 1)
        self$`returnCode` <- `returnCode`
      }
      if (!is.null(`backend`)) {
        stopifnot(is.character(`backend`), length(`backend`) == 1)
        self$`backend` <- `backend`
      }
      if (!is.null(`stdout`)) {
        stopifnot(is.character(`stdout`), length(`stdout`) == 1)
        self$`stdout` <- `stdout`
      }
      if (!is.null(`stderr`)) {
        stopifnot(is.character(`stderr`), length(`stderr`) == 1)
        self$`stderr` <- `stderr`
      }
      if (!is.null(`shardIndex`)) {
        stopifnot(is.numeric(`shardIndex`), length(`shardIndex`) == 1)
        self$`shardIndex` <- `shardIndex`
      }
    },
    toJSON = function() {
      CallMetadataObject <- list()
      if (!is.null(self$`inputs`)) {
        CallMetadataObject[['inputs']] <-
          self$`inputs`
      }
      if (!is.null(self$`executionStatus`)) {
        CallMetadataObject[['executionStatus']] <-
          self$`executionStatus`
      }
      if (!is.null(self$`executionEvents`)) {
        CallMetadataObject[['executionEvents']] <-
          lapply(self$`executionEvents`, function(x) x$toJSON())
      }
      if (!is.null(self$`backendStatus`)) {
        CallMetadataObject[['backendStatus']] <-
          self$`backendStatus`
      }
      if (!is.null(self$`backendLogs`)) {
        CallMetadataObject[['backendLogs']] <-
          self$`backendLogs`
      }
      if (!is.null(self$`outputs`)) {
        CallMetadataObject[['outputs']] <-
          self$`outputs`
      }
      if (!is.null(self$`start`)) {
        CallMetadataObject[['start']] <-
          self$`start`
      }
      if (!is.null(self$`end`)) {
        CallMetadataObject[['end']] <-
          self$`end`
      }
      if (!is.null(self$`jobId`)) {
        CallMetadataObject[['jobId']] <-
          self$`jobId`
      }
      if (!is.null(self$`returnCode`)) {
        CallMetadataObject[['returnCode']] <-
          self$`returnCode`
      }
      if (!is.null(self$`backend`)) {
        CallMetadataObject[['backend']] <-
          self$`backend`
      }
      if (!is.null(self$`stdout`)) {
        CallMetadataObject[['stdout']] <-
          self$`stdout`
      }
      if (!is.null(self$`stderr`)) {
        CallMetadataObject[['stderr']] <-
          self$`stderr`
      }
      if (!is.null(self$`shardIndex`)) {
        CallMetadataObject[['shardIndex']] <-
          self$`shardIndex`
      }

      CallMetadataObject
    },
    fromJSON = function(CallMetadataJson) {
      CallMetadataObject <- jsonlite::fromJSON(CallMetadataJson)
      if (!is.null(CallMetadataObject$`inputs`)) {
        self$`inputs` <- ApiClient$new()$deserializeObj(CallMetadataObject$`inputs`, "map(object)", loadNamespace("openapi"))
      }
      if (!is.null(CallMetadataObject$`executionStatus`)) {
        self$`executionStatus` <- CallMetadataObject$`executionStatus`
      }
      if (!is.null(CallMetadataObject$`executionEvents`)) {
        self$`executionEvents` <- ApiClient$new()$deserializeObj(CallMetadataObject$`executionEvents`, "array[ExecutionEvent]", loadNamespace("openapi"))
      }
      if (!is.null(CallMetadataObject$`backendStatus`)) {
        self$`backendStatus` <- CallMetadataObject$`backendStatus`
      }
      if (!is.null(CallMetadataObject$`backendLogs`)) {
        self$`backendLogs` <- ApiClient$new()$deserializeObj(CallMetadataObject$`backendLogs`, "map(character)", loadNamespace("openapi"))
      }
      if (!is.null(CallMetadataObject$`outputs`)) {
        self$`outputs` <- ApiClient$new()$deserializeObj(CallMetadataObject$`outputs`, "map(character)", loadNamespace("openapi"))
      }
      if (!is.null(CallMetadataObject$`start`)) {
        self$`start` <- CallMetadataObject$`start`
      }
      if (!is.null(CallMetadataObject$`end`)) {
        self$`end` <- CallMetadataObject$`end`
      }
      if (!is.null(CallMetadataObject$`jobId`)) {
        self$`jobId` <- CallMetadataObject$`jobId`
      }
      if (!is.null(CallMetadataObject$`returnCode`)) {
        self$`returnCode` <- CallMetadataObject$`returnCode`
      }
      if (!is.null(CallMetadataObject$`backend`)) {
        self$`backend` <- CallMetadataObject$`backend`
      }
      if (!is.null(CallMetadataObject$`stdout`)) {
        self$`stdout` <- CallMetadataObject$`stdout`
      }
      if (!is.null(CallMetadataObject$`stderr`)) {
        self$`stderr` <- CallMetadataObject$`stderr`
      }
      if (!is.null(CallMetadataObject$`shardIndex`)) {
        self$`shardIndex` <- CallMetadataObject$`shardIndex`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        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$`executionStatus`)) {
        sprintf(
        '"executionStatus":
          "%s"
                ',
        self$`executionStatus`
        )},
        if (!is.null(self$`executionEvents`)) {
        sprintf(
        '"executionEvents":
        [%s]
',
        paste(sapply(self$`executionEvents`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`backendStatus`)) {
        sprintf(
        '"backendStatus":
          "%s"
                ',
        self$`backendStatus`
        )},
        if (!is.null(self$`backendLogs`)) {
        sprintf(
        '"backendLogs":
          "%s"
        ',
        jsonlite::toJSON(lapply(self$`backendLogs`, function(x){ x }), 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$`start`)) {
        sprintf(
        '"start":
          "%s"
                ',
        self$`start`
        )},
        if (!is.null(self$`end`)) {
        sprintf(
        '"end":
          "%s"
                ',
        self$`end`
        )},
        if (!is.null(self$`jobId`)) {
        sprintf(
        '"jobId":
          "%s"
                ',
        self$`jobId`
        )},
        if (!is.null(self$`returnCode`)) {
        sprintf(
        '"returnCode":
          %d
                ',
        self$`returnCode`
        )},
        if (!is.null(self$`backend`)) {
        sprintf(
        '"backend":
          "%s"
                ',
        self$`backend`
        )},
        if (!is.null(self$`stdout`)) {
        sprintf(
        '"stdout":
          "%s"
                ',
        self$`stdout`
        )},
        if (!is.null(self$`stderr`)) {
        sprintf(
        '"stderr":
          "%s"
                ',
        self$`stderr`
        )},
        if (!is.null(self$`shardIndex`)) {
        sprintf(
        '"shardIndex":
          %d
                ',
        self$`shardIndex`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(CallMetadataJson) {
      CallMetadataObject <- jsonlite::fromJSON(CallMetadataJson)
      self$`inputs` <- ApiClient$new()$deserializeObj(CallMetadataObject$`inputs`, "map(object)", loadNamespace("openapi"))
      self$`executionStatus` <- CallMetadataObject$`executionStatus`
      self$`executionEvents` <- ApiClient$new()$deserializeObj(CallMetadataObject$`executionEvents`, "array[ExecutionEvent]", loadNamespace("openapi"))
      self$`backendStatus` <- CallMetadataObject$`backendStatus`
      self$`backendLogs` <- ApiClient$new()$deserializeObj(CallMetadataObject$`backendLogs`, "map(character)", loadNamespace("openapi"))
      self$`outputs` <- ApiClient$new()$deserializeObj(CallMetadataObject$`outputs`, "map(character)", loadNamespace("openapi"))
      self$`start` <- CallMetadataObject$`start`
      self$`end` <- CallMetadataObject$`end`
      self$`jobId` <- CallMetadataObject$`jobId`
      self$`returnCode` <- CallMetadataObject$`returnCode`
      self$`backend` <- CallMetadataObject$`backend`
      self$`stdout` <- CallMetadataObject$`stdout`
      self$`stderr` <- CallMetadataObject$`stderr`
      self$`shardIndex` <- CallMetadataObject$`shardIndex`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.