R/execution_event.R

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

#' @docType class
#' @title ExecutionEvent
#'
#' @description ExecutionEvent Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field description  character 
#'
#' @field startTime  character 
#'
#' @field endTime  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ExecutionEvent <- R6::R6Class(
  'ExecutionEvent',
  public = list(
    `description` = NULL,
    `startTime` = NULL,
    `endTime` = NULL,
    initialize = function(
        `description`, `startTime`, `endTime`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`startTime`)) {
        stopifnot(is.character(`startTime`), length(`startTime`) == 1)
        self$`startTime` <- `startTime`
      }
      if (!is.null(`endTime`)) {
        stopifnot(is.character(`endTime`), length(`endTime`) == 1)
        self$`endTime` <- `endTime`
      }
    },
    toJSON = function() {
      ExecutionEventObject <- list()
      if (!is.null(self$`description`)) {
        ExecutionEventObject[['description']] <-
          self$`description`
      }
      if (!is.null(self$`startTime`)) {
        ExecutionEventObject[['startTime']] <-
          self$`startTime`
      }
      if (!is.null(self$`endTime`)) {
        ExecutionEventObject[['endTime']] <-
          self$`endTime`
      }

      ExecutionEventObject
    },
    fromJSON = function(ExecutionEventJson) {
      ExecutionEventObject <- jsonlite::fromJSON(ExecutionEventJson)
      if (!is.null(ExecutionEventObject$`description`)) {
        self$`description` <- ExecutionEventObject$`description`
      }
      if (!is.null(ExecutionEventObject$`startTime`)) {
        self$`startTime` <- ExecutionEventObject$`startTime`
      }
      if (!is.null(ExecutionEventObject$`endTime`)) {
        self$`endTime` <- ExecutionEventObject$`endTime`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`description`)) {
        sprintf(
        '"description":
          "%s"
                ',
        self$`description`
        )},
        if (!is.null(self$`startTime`)) {
        sprintf(
        '"startTime":
          "%s"
                ',
        self$`startTime`
        )},
        if (!is.null(self$`endTime`)) {
        sprintf(
        '"endTime":
          "%s"
                ',
        self$`endTime`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(ExecutionEventJson) {
      ExecutionEventObject <- jsonlite::fromJSON(ExecutionEventJson)
      self$`description` <- ExecutionEventObject$`description`
      self$`startTime` <- ExecutionEventObject$`startTime`
      self$`endTime` <- ExecutionEventObject$`endTime`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.