# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' Variable Class
#'
#' @field uri
#' @field label
#' @field comment
#' @field ontologiesReferences
#' @field properties
#' @field trait
#' @field method
#' @field unit
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Variable <- R6::R6Class(
'Variable',
public = list(
`uri` = NULL,
`label` = NULL,
`comment` = NULL,
`ontologiesReferences` = NULL,
`properties` = NULL,
`trait` = NULL,
`method` = NULL,
`unit` = NULL,
initialize = function(`uri`, `label`, `comment`, `ontologiesReferences`, `properties`, `trait`, `method`, `unit`){
if (!missing(`uri`)) {
stopifnot(is.character(`uri`), length(`uri`) == 1)
self$`uri` <- `uri`
}
if (!missing(`label`)) {
stopifnot(is.character(`label`), length(`label`) == 1)
self$`label` <- `label`
}
if (!missing(`comment`)) {
stopifnot(is.character(`comment`), length(`comment`) == 1)
self$`comment` <- `comment`
}
if (!missing(`ontologiesReferences`)) {
stopifnot(is.list(`ontologiesReferences`), length(`ontologiesReferences`) != 0)
lapply(`ontologiesReferences`, function(x) stopifnot(R6::is.R6(x)))
self$`ontologiesReferences` <- `ontologiesReferences`
}
if (!missing(`properties`)) {
stopifnot(is.list(`properties`), length(`properties`) != 0)
lapply(`properties`, function(x) stopifnot(R6::is.R6(x)))
self$`properties` <- `properties`
}
if (!missing(`trait`)) {
stopifnot(R6::is.R6(`trait`))
self$`trait` <- `trait`
}
if (!missing(`method`)) {
stopifnot(R6::is.R6(`method`))
self$`method` <- `method`
}
if (!missing(`unit`)) {
stopifnot(R6::is.R6(`unit`))
self$`unit` <- `unit`
}
},
toJSON = function() {
VariableObject <- list()
if (!is.null(self$`uri`)) {
VariableObject[['uri']] <- self$`uri`
}
if (!is.null(self$`label`)) {
VariableObject[['label']] <- self$`label`
}
if (!is.null(self$`comment`)) {
VariableObject[['comment']] <- self$`comment`
}
if (!is.null(self$`ontologiesReferences`)) {
VariableObject[['ontologiesReferences']] <- lapply(self$`ontologiesReferences`, function(x) x$toJSON())
}
if (!is.null(self$`properties`)) {
VariableObject[['properties']] <- lapply(self$`properties`, function(x) x$toJSON())
}
if (!is.null(self$`trait`)) {
VariableObject[['trait']] <- self$`trait`$toJSON()
}
if (!is.null(self$`method`)) {
VariableObject[['method']] <- self$`method`$toJSON()
}
if (!is.null(self$`unit`)) {
VariableObject[['unit']] <- self$`unit`$toJSON()
}
VariableObject
},
fromJSON = function(VariableJson) {
VariableObject <- jsonlite::fromJSON(VariableJson)
if (!is.null(VariableObject$`uri`)) {
self$`uri` <- VariableObject$`uri`
}
if (!is.null(VariableObject$`label`)) {
self$`label` <- VariableObject$`label`
}
if (!is.null(VariableObject$`comment`)) {
self$`comment` <- VariableObject$`comment`
}
if (!is.null(VariableObject$`ontologiesReferences`)) {
self$`ontologiesReferences` <- lapply(VariableObject$`ontologiesReferences`, function(x) {
ontologiesReferencesObject <- OntologyReference$new()
ontologiesReferencesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
ontologiesReferencesObject
})
}
if (!is.null(VariableObject$`properties`)) {
self$`properties` <- lapply(VariableObject$`properties`, function(x) {
propertiesObject <- Property$new()
propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
propertiesObject
})
}
if (!is.null(VariableObject$`trait`)) {
traitObject <- Trait$new()
traitObject$fromJSON(jsonlite::toJSON(VariableObject$trait, auto_unbox = TRUE, null = "null"))
self$`trait` <- traitObject
}
if (!is.null(VariableObject$`method`)) {
methodObject <- Method$new()
methodObject$fromJSON(jsonlite::toJSON(VariableObject$method, auto_unbox = TRUE, null = "null"))
self$`method` <- methodObject
}
if (!is.null(VariableObject$`unit`)) {
unitObject <- Unit$new()
unitObject$fromJSON(jsonlite::toJSON(VariableObject$unit, auto_unbox = TRUE, null = "null"))
self$`unit` <- unitObject
}
},
fromJSONObject = function(VariableObject) {
if (!is.null(VariableObject$`uri`)) {
self$`uri` <- VariableObject$`uri`
}
if (!is.null(VariableObject$`label`)) {
self$`label` <- VariableObject$`label`
}
if (!is.null(VariableObject$`comment`)) {
self$`comment` <- VariableObject$`comment`
}
if (!is.null(VariableObject$`ontologiesReferences`)) {
self$`ontologiesReferences` <- lapply(VariableObject$`ontologiesReferences`, function(x) {
ontologiesReferencesObject <- OntologyReference$new()
ontologiesReferencesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
ontologiesReferencesObject
})
}
if (!is.null(VariableObject$`properties`)) {
self$`properties` <- lapply(VariableObject$`properties`, function(x) {
propertiesObject <- Property$new()
propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
propertiesObject
})
}
if (!is.null(VariableObject$`trait`)) {
traitObject <- Trait$new()
traitObject$fromJSON(jsonlite::toJSON(VariableObject$trait, auto_unbox = TRUE, null = "null"))
self$`trait` <- traitObject
}
if (!is.null(VariableObject$`method`)) {
methodObject <- Method$new()
methodObject$fromJSON(jsonlite::toJSON(VariableObject$method, auto_unbox = TRUE, null = "null"))
self$`method` <- methodObject
}
if (!is.null(VariableObject$`unit`)) {
unitObject <- Unit$new()
unitObject$fromJSON(jsonlite::toJSON(VariableObject$unit, auto_unbox = TRUE, null = "null"))
self$`unit` <- unitObject
}
},
toJSONString = function() {
ontologiesReferencesList = paste(lapply(self$`ontologiesReferences`, function(x) x$toJSONString()),collapse = ",")
propertiesList = paste(lapply(self$`properties`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"uri": %s,
"label": %s,
"comment": %s,
"ontologiesReferences": [%s],
"properties": [%s],
"trait": %s,
"method": %s,
"unit": %s
}',
jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`label`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`comment`,auto_unbox=TRUE, null = "null"),
ontologiesReferencesList,
propertiesList,
self$`trait`$toJSON(),
self$`method`$toJSON(),
self$`unit`$toJSON()
)
},
fromJSONString = function(VariableJson) {
VariableObject <- jsonlite::fromJSON(VariableJson)
self$`uri` <- VariableObject$`uri`
self$`label` <- VariableObject$`label`
self$`comment` <- VariableObject$`comment`
self$`ontologiesReferences` <- lapply(VariableObject$`ontologiesReferences`, function(x) OntologyReference$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`properties` <- lapply(VariableObject$`properties`, function(x) Property$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
TraitObject <- Trait$new()
self$`trait` <- TraitObject$fromJSON(jsonlite::toJSON(VariableObject$trait, auto_unbox = TRUE))
MethodObject <- Method$new()
self$`method` <- MethodObject$fromJSON(jsonlite::toJSON(VariableObject$method, auto_unbox = TRUE))
UnitObject <- Unit$new()
self$`unit` <- UnitObject$fromJSON(jsonlite::toJSON(VariableObject$unit, auto_unbox = TRUE))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.