R/terra_preference.R

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

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

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