R/workflow_cost.R

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

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

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