R/billing_account.R

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

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

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