# mzTab-M reference implementation and validation API.
#
# This is the mzTab-M reference implementation and validation API service.
#
# The version of the OpenAPI document: 2.0.0
# Contact: nils.hoffmann@cebitec.uni-bielefeld.de
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title PublicationItem
#' @description PublicationItem Class
#' @format An \code{R6Class} generator object
#' @field type character
#'
#' @field accession character
#'
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
PublicationItem <- R6::R6Class(
'PublicationItem',
public = list(
`type` = NULL,
`accession` = NULL,
#' @description Create a PublicationItem
#' @param type The type of the PublicationItem.
#' @param accession The type-dependent accession of the PublicationItem.
#' @param ... local optional variable arguments
#'
initialize = function(`type`, `accession`, ...){
local.optional.var <- list(...)
if (!missing(`type`)) {
stopifnot(is.character(`type`), length(`type`) == 1)
self$`type` <- `type`
}
if (!missing(`accession`)) {
stopifnot(is.character(`accession`), length(`accession`) == 1)
self$`accession` <- `accession`
}
},
#' @description Serialize to list object suitable for jsonlite
toJSON = function() {
PublicationItemObject <- list()
if (!is.null(self$`type`)) {
PublicationItemObject[['type']] <-
rmzTabM::safe_unbox(self$`type`)
}
if (!is.null(self$`accession`)) {
PublicationItemObject[['accession']] <-
rmzTabM::safe_unbox(self$`accession`)
}
PublicationItemObject
},
#' @description Deserialize from jsonlite list object
#' @param PublicationItemJson list object.
fromJSON = function(PublicationItemJson) {
PublicationItemObject <- jsonlite::fromJSON(PublicationItemJson)
if (!is.null(PublicationItemObject$`type`)) {
self$`type` <- PublicationItemObject$`type`
}
if (!is.null(PublicationItemObject$`accession`)) {
self$`accession` <- PublicationItemObject$`accession`
}
},
#' @description Serialize to JSON string.
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`type`)) {
sprintf(
'"type":
"%s"
',
rmzTabM::safe_unbox(self$`type`)
)},
if (!is.null(self$`accession`)) {
sprintf(
'"accession":
"%s"
',
rmzTabM::safe_unbox(self$`accession`)
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
#' @description Deserialize from JSON string
#' @param PublicationItemJson JSON string
fromJSONString = function(PublicationItemJson) {
PublicationItemObject <- jsonlite::fromJSON(PublicationItemJson)
self$`type` <- PublicationItemObject$`type`
self$`accession` <- PublicationItemObject$`accession`
self
},
#' @description Serialize to string.
toString = function() {
paste(self$`type`, self$`accession`, sep=":")
},
#' @description Deserialize from string.
#' @param PublicationItemString the string representation of a PublicationItem.
fromString = function(PublicationItemString) {
PublicationItemList <- splitList(PublicationItemString, separator = ":")
if (length(PublicationItemList) == 2) {
self$`type` <- PublicationItemList[[1]]
self$`accession` <- PublicationItemList[[2]]
}
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.