R/bagit_request.R

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

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

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