R/TagHistory.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


#' TagHistory Class
#'
#' Individual tag event
#'
#' @field created uuid of the referenced resource
#' @field event event that occurred on this tag
#' @field description description of the event which occurred
#' @field id unique identifier of the event
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TagHistory <- R6::R6Class(
  'TagHistory',
  public = list(
    `created` = NULL,
    `event` = NULL,
    `description` = NULL,
    `id` = NULL,
    initialize = function(`created`, `event`, `description`, `id`){
      if (!missing(`created`)) {
        stopifnot(is.character(`created`), length(`created`) == 1)
        self$`created` <- `created`
      }
      if (!missing(`event`)) {
        stopifnot(is.character(`event`), length(`event`) == 1)
        self$`event` <- `event`
      }
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`id`)) {
        stopifnot(is.character(`id`), length(`id`) == 1)
        self$`id` <- `id`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      TagHistoryObject <- list()
      if (!is.null(self$`created`)) {
        TagHistoryObject[['created']] <- self$`created`
      }
      else {
        TagHistoryObject[['created']] <- NULL
      }
      if (!is.null(self$`event`)) {
        TagHistoryObject[['event']] <- self$`event`
      }
      else {
        TagHistoryObject[['event']] <- NULL
      }
      if (!is.null(self$`description`)) {
        TagHistoryObject[['description']] <- self$`description`
      }
      else {
        TagHistoryObject[['description']] <- NULL
      }
      if (!is.null(self$`id`)) {
        TagHistoryObject[['id']] <- self$`id`
      }
      else {
        TagHistoryObject[['id']] <- NULL
      }

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

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

      if (!is.null(TagHistoryObject$`created`)) {
        self$`created` <- TagHistoryObject$`created`
      }
      if (!is.null(TagHistoryObject$`event`)) {
        self$`event` <- TagHistoryObject$`event`
      }
      if (!is.null(TagHistoryObject$`description`)) {
        self$`description` <- TagHistoryObject$`description`
      }
      if (!is.null(TagHistoryObject$`id`)) {
        self$`id` <- TagHistoryObject$`id`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "created": %s,
           "event": %s,
           "description": %s,
           "id": %s
        }',
        ifelse( is.null(self$`created`),"null",paste0(c('"', self$`created`, '"'))),
        ifelse( is.null(self$`event`),"null",paste0(c('"', self$`event`, '"'))),
        ifelse( is.null(self$`description`),"null",paste0(c('"', self$`description`, '"'))),
        ifelse( is.null(self$`id`),"null",paste0(c('"', self$`id`, '"')))
      )
    },
    fromJSONString = function(TagHistoryJson) {
      TagHistoryObject <- jsonlite::fromJSON(TagHistoryJson)
      self::fromJSON(TagHistoryObject)

    }
  )
)
deardooley/agave-rlang-sdk documentation built on May 17, 2019, 10:12 p.m.