R/NotificationRequest.r

# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' NotificationRequest Class
#'
#' 
#'
#' @field associatedUuid UUID of resource to whome the event applies.
#' @field url The url or email address that will be notified of the event.
#' @field persistent Whether this notification should stay active after it fires the first time.
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
NotificationRequest <- R6::R6Class(
  'NotificationRequest',
  public = list(
    `associatedUuid` = NULL,
    `url` = NULL,
    `persistent` = NULL,
    initialize = function(`associatedUuid`, `url`, `persistent`){
      if (!missing(`associatedUuid`)) {
        stopifnot(is.character(`associatedUuid`), length(`associatedUuid`) == 1)
        self$`associatedUuid` <- `associatedUuid`
      }
      if (!missing(`url`)) {
        stopifnot(is.character(`url`), length(`url`) == 1)
        self$`url` <- `url`
      }
      if (!missing(`persistent`)) {
        self$`persistent` <- `persistent`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      NotificationRequestObject <- list()
      if (!is.null(self$`associatedUuid`)) {
        NotificationRequestObject[['associatedUuid']] <- self$`associatedUuid`
      }
      else {
        NotificationRequestObject[['associatedUuid']] <- NULL
      }
      if (!is.null(self$`url`)) {
        NotificationRequestObject[['url']] <- self$`url`
      }
      else {
        NotificationRequestObject[['url']] <- NULL
      }
      if (!is.null(self$`persistent`)) {
        NotificationRequestObject[['persistent']] <- self$`persistent`
      }
      else {
        NotificationRequestObject[['persistent']] <- NULL
      }

      NotificationRequestObject
    },
    fromJSON = function(NotificationRequestObject) {
      if (is.character(NotificationRequestObject)) {
        NotificationRequestObject <- jsonlite::fromJSON(NotificationRequestJson)
      }

      if ("result" %in% names(NotificationRequestObject)) {
        NotificationRequestObject <- NotificationRequestObject$result
      }

      if (!is.null(NotificationRequestObject$`associatedUuid`)) {
        self$`associatedUuid` <- NotificationRequestObject$`associatedUuid`
      }
      if (!is.null(NotificationRequestObject$`url`)) {
        self$`url` <- NotificationRequestObject$`url`
      }
      if (!is.null(NotificationRequestObject$`persistent`)) {
        self$`persistent` <- NotificationRequestObject$`persistent`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "associatedUuid": %s,
           "url": %s,
           "persistent": %s
        }',
        ifelse( is.null(self$`associatedUuid`),"null",paste0(c('"', self$`associatedUuid`, '"'))),
        ifelse( is.null(self$`url`),"null",paste0(c('"', self$`url`, '"'))),
        ifelse( is.null(self$`persistent`),"null",paste0(c('"', self$`persistent`, '"')))
      )
    },
    fromJSONString = function(NotificationRequestJson) {
      NotificationRequestObject <- jsonlite::fromJSON(NotificationRequestJson)
      self::fromJSON(NotificationRequestObject)

    }
  )
)
agaveplatform/r-sdk documentation built on May 13, 2019, 8:20 a.m.