# OpenSilex API
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 1.0.0-rc+2
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' Method Class
#'
#' @field description
#' @field formula
#' @field methodDbId
#' @field methodName
#' @field ontologyReference
#' @field reference
#' @field class
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Method <- R6::R6Class(
'Method',
public = list(
`description` = NULL,
`formula` = NULL,
`methodDbId` = NULL,
`methodName` = NULL,
`ontologyReference` = NULL,
`reference` = NULL,
`class` = NULL,
initialize = function(`description`, `formula`, `methodDbId`, `methodName`, `ontologyReference`, `reference`, `class`){
if (!missing(`description`)) {
stopifnot(is.character(`description`), length(`description`) == 1)
self$`description` <- `description`
}
if (!missing(`formula`)) {
stopifnot(is.character(`formula`), length(`formula`) == 1)
self$`formula` <- `formula`
}
if (!missing(`methodDbId`)) {
stopifnot(is.character(`methodDbId`), length(`methodDbId`) == 1)
self$`methodDbId` <- `methodDbId`
}
if (!missing(`methodName`)) {
stopifnot(is.character(`methodName`), length(`methodName`) == 1)
self$`methodName` <- `methodName`
}
if (!missing(`ontologyReference`)) {
stopifnot(R6::is.R6(`ontologyReference`))
self$`ontologyReference` <- `ontologyReference`
}
if (!missing(`reference`)) {
stopifnot(is.character(`reference`), length(`reference`) == 1)
self$`reference` <- `reference`
}
if (!missing(`class`)) {
stopifnot(is.character(`class`), length(`class`) == 1)
self$`class` <- `class`
}
},
toJSON = function() {
MethodObject <- list()
if (!is.null(self$`description`)) {
MethodObject[['description']] <- self$`description`
}
if (!is.null(self$`formula`)) {
MethodObject[['formula']] <- self$`formula`
}
if (!is.null(self$`methodDbId`)) {
MethodObject[['methodDbId']] <- self$`methodDbId`
}
if (!is.null(self$`methodName`)) {
MethodObject[['methodName']] <- self$`methodName`
}
if (!is.null(self$`ontologyReference`)) {
MethodObject[['ontologyReference']] <- self$`ontologyReference`$toJSON()
}
if (!is.null(self$`reference`)) {
MethodObject[['reference']] <- self$`reference`
}
if (!is.null(self$`class`)) {
MethodObject[['class']] <- self$`class`
}
MethodObject
},
fromJSON = function(MethodJson) {
MethodObject <- jsonlite::fromJSON(MethodJson)
if (!is.null(MethodObject$`description`)) {
self$`description` <- MethodObject$`description`
}
if (!is.null(MethodObject$`formula`)) {
self$`formula` <- MethodObject$`formula`
}
if (!is.null(MethodObject$`methodDbId`)) {
self$`methodDbId` <- MethodObject$`methodDbId`
}
if (!is.null(MethodObject$`methodName`)) {
self$`methodName` <- MethodObject$`methodName`
}
if (!is.null(MethodObject$`ontologyReference`)) {
ontologyReferenceObject <- OntologyReference$new()
ontologyReferenceObject$fromJSON(jsonlite::toJSON(MethodObject$ontologyReference, auto_unbox = TRUE, null = "null"))
self$`ontologyReference` <- ontologyReferenceObject
}
if (!is.null(MethodObject$`reference`)) {
self$`reference` <- MethodObject$`reference`
}
if (!is.null(MethodObject$`class`)) {
self$`class` <- MethodObject$`class`
}
},
fromJSONObject = function(MethodObject) {
if (!is.null(MethodObject$`description`)) {
self$`description` <- MethodObject$`description`
}
if (!is.null(MethodObject$`formula`)) {
self$`formula` <- MethodObject$`formula`
}
if (!is.null(MethodObject$`methodDbId`)) {
self$`methodDbId` <- MethodObject$`methodDbId`
}
if (!is.null(MethodObject$`methodName`)) {
self$`methodName` <- MethodObject$`methodName`
}
if (!is.null(MethodObject$`ontologyReference`)) {
ontologyReferenceObject <- OntologyReference$new()
ontologyReferenceObject$fromJSON(jsonlite::toJSON(MethodObject$ontologyReference, auto_unbox = TRUE, null = "null"))
self$`ontologyReference` <- ontologyReferenceObject
}
if (!is.null(MethodObject$`reference`)) {
self$`reference` <- MethodObject$`reference`
}
if (!is.null(MethodObject$`class`)) {
self$`class` <- MethodObject$`class`
}
},
toJSONString = function() {
sprintf(
'{
"description": %s,
"formula": %s,
"methodDbId": %s,
"methodName": %s,
"ontologyReference": %s,
"reference": %s,
"class": %s
}',
ifelse(is.null(self$`description`), "null",jsonlite::toJSON(self$`description`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`formula`), "null",jsonlite::toJSON(self$`formula`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`methodDbId`), "null",jsonlite::toJSON(self$`methodDbId`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`methodName`), "null",jsonlite::toJSON(self$`methodName`,auto_unbox=TRUE, null = "null")),
jsonlite::toJSON(self$`ontologyReference`$toJSON(),auto_unbox=TRUE, null = "null"),
ifelse(is.null(self$`reference`), "null",jsonlite::toJSON(self$`reference`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`class`), "null",jsonlite::toJSON(self$`class`,auto_unbox=TRUE, null = "null"))
)
},
fromJSONString = function(MethodJson) {
MethodObject <- jsonlite::fromJSON(MethodJson)
self$`description` <- MethodObject$`description`
self$`formula` <- MethodObject$`formula`
self$`methodDbId` <- MethodObject$`methodDbId`
self$`methodName` <- MethodObject$`methodName`
OntologyReferenceObject <- OntologyReference$new()
self$`ontologyReference` <- OntologyReferenceObject$fromJSON(jsonlite::toJSON(MethodObject$ontologyReference, auto_unbox = TRUE))
self$`reference` <- MethodObject$`reference`
self$`class` <- MethodObject$`class`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.