R/notification_type.R

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

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

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