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


#' TagSummary Class
#'
#' Tag object without resource list
#'
#' @field name name of tag
#' @field created Date tag was created
#' @field lastUpdated Date tag was last updated
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TagSummary <- R6::R6Class(
  'TagSummary',
  public = list(
    `name` = NULL,
    `created` = NULL,
    `lastUpdated` = NULL,
    initialize = function(`name`, `created`, `lastUpdated`){
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`created`)) {
        stopifnot(is.character(`created`), length(`created`) == 1)
        self$`created` <- `created`
      }
      if (!missing(`lastUpdated`)) {
        stopifnot(is.character(`lastUpdated`), length(`lastUpdated`) == 1)
        self$`lastUpdated` <- `lastUpdated`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      TagSummaryObject <- list()
      if (!is.null(self$`name`)) {
        TagSummaryObject[['name']] <- self$`name`
      }
      else {
        TagSummaryObject[['name']] <- NULL
      }
      if (!is.null(self$`created`)) {
        TagSummaryObject[['created']] <- self$`created`
      }
      else {
        TagSummaryObject[['created']] <- NULL
      }
      if (!is.null(self$`lastUpdated`)) {
        TagSummaryObject[['lastUpdated']] <- self$`lastUpdated`
      }
      else {
        TagSummaryObject[['lastUpdated']] <- NULL
      }

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

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

      if (!is.null(TagSummaryObject$`name`)) {
        self$`name` <- TagSummaryObject$`name`
      }
      if (!is.null(TagSummaryObject$`created`)) {
        self$`created` <- TagSummaryObject$`created`
      }
      if (!is.null(TagSummaryObject$`lastUpdated`)) {
        self$`lastUpdated` <- TagSummaryObject$`lastUpdated`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "name": %s,
           "created": %s,
           "lastUpdated": %s
        }',
        ifelse( is.null(self$`name`),"null",paste0(c('"', self$`name`, '"'))),
        ifelse( is.null(self$`created`),"null",paste0(c('"', self$`created`, '"'))),
        ifelse( is.null(self$`lastUpdated`),"null",paste0(c('"', self$`lastUpdated`, '"')))
      )
    },
    fromJSONString = function(TagSummaryJson) {
      TagSummaryObject <- jsonlite::fromJSON(TagSummaryJson)
      self::fromJSON(TagSummaryObject)

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