# 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
#' FactorCreationDTO Class
#'
#' @field uri
#' @field name
#' @field category
#' @field description
#' @field levels
#' @field exact_match
#' @field close_match
#' @field broad_match
#' @field narrow_match
#' @field experiment
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
FactorCreationDTO <- R6::R6Class(
'FactorCreationDTO',
public = list(
`uri` = NULL,
`name` = NULL,
`category` = NULL,
`description` = NULL,
`levels` = NULL,
`exact_match` = NULL,
`close_match` = NULL,
`broad_match` = NULL,
`narrow_match` = NULL,
`experiment` = NULL,
initialize = function(`uri`, `name`, `category`, `description`, `levels`, `exact_match`, `close_match`, `broad_match`, `narrow_match`, `experiment`){
if (!missing(`uri`)) {
stopifnot(is.character(`uri`), length(`uri`) == 1)
self$`uri` <- `uri`
}
if (!missing(`name`)) {
stopifnot(is.character(`name`), length(`name`) == 1)
self$`name` <- `name`
}
if (!missing(`category`)) {
stopifnot(is.character(`category`), length(`category`) == 1)
self$`category` <- `category`
}
if (!missing(`description`)) {
stopifnot(is.character(`description`), length(`description`) == 1)
self$`description` <- `description`
}
if (!missing(`levels`)) {
stopifnot(is.list(`levels`), length(`levels`) != 0)
lapply(`levels`, function(x) stopifnot(R6::is.R6(x)))
self$`levels` <- `levels`
}
if (!missing(`exact_match`)) {
stopifnot(is.list(`exact_match`), length(`exact_match`) != 0)
lapply(`exact_match`, function(x) stopifnot(is.character(x)))
self$`exact_match` <- `exact_match`
}
if (!missing(`close_match`)) {
stopifnot(is.list(`close_match`), length(`close_match`) != 0)
lapply(`close_match`, function(x) stopifnot(is.character(x)))
self$`close_match` <- `close_match`
}
if (!missing(`broad_match`)) {
stopifnot(is.list(`broad_match`), length(`broad_match`) != 0)
lapply(`broad_match`, function(x) stopifnot(is.character(x)))
self$`broad_match` <- `broad_match`
}
if (!missing(`narrow_match`)) {
stopifnot(is.list(`narrow_match`), length(`narrow_match`) != 0)
lapply(`narrow_match`, function(x) stopifnot(is.character(x)))
self$`narrow_match` <- `narrow_match`
}
if (!missing(`experiment`)) {
stopifnot(is.character(`experiment`), length(`experiment`) == 1)
self$`experiment` <- `experiment`
}
},
toJSON = function() {
FactorCreationDTOObject <- list()
if (!is.null(self$`uri`)) {
FactorCreationDTOObject[['uri']] <- self$`uri`
}
if (!is.null(self$`name`)) {
FactorCreationDTOObject[['name']] <- self$`name`
}
if (!is.null(self$`category`)) {
FactorCreationDTOObject[['category']] <- self$`category`
}
if (!is.null(self$`description`)) {
FactorCreationDTOObject[['description']] <- self$`description`
}
if (!is.null(self$`levels`)) {
FactorCreationDTOObject[['levels']] <- lapply(self$`levels`, function(x) x$toJSON())
}
if (!is.null(self$`exact_match`)) {
FactorCreationDTOObject[['exact_match']] <- self$`exact_match`
}
if (!is.null(self$`close_match`)) {
FactorCreationDTOObject[['close_match']] <- self$`close_match`
}
if (!is.null(self$`broad_match`)) {
FactorCreationDTOObject[['broad_match']] <- self$`broad_match`
}
if (!is.null(self$`narrow_match`)) {
FactorCreationDTOObject[['narrow_match']] <- self$`narrow_match`
}
if (!is.null(self$`experiment`)) {
FactorCreationDTOObject[['experiment']] <- self$`experiment`
}
FactorCreationDTOObject
},
fromJSON = function(FactorCreationDTOJson) {
FactorCreationDTOObject <- jsonlite::fromJSON(FactorCreationDTOJson)
if (!is.null(FactorCreationDTOObject$`uri`)) {
self$`uri` <- FactorCreationDTOObject$`uri`
}
if (!is.null(FactorCreationDTOObject$`name`)) {
self$`name` <- FactorCreationDTOObject$`name`
}
if (!is.null(FactorCreationDTOObject$`category`)) {
self$`category` <- FactorCreationDTOObject$`category`
}
if (!is.null(FactorCreationDTOObject$`description`)) {
self$`description` <- FactorCreationDTOObject$`description`
}
if (!is.null(FactorCreationDTOObject$`levels`)) {
self$`levels` <- lapply(FactorCreationDTOObject$`levels`, function(x) {
levelsObject <- FactorLevelCreationDTO$new()
levelsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
levelsObject
})
}
if (!is.null(FactorCreationDTOObject$`exact_match`)) {
self$`exact_match` <- FactorCreationDTOObject$`exact_match`
}
if (!is.null(FactorCreationDTOObject$`close_match`)) {
self$`close_match` <- FactorCreationDTOObject$`close_match`
}
if (!is.null(FactorCreationDTOObject$`broad_match`)) {
self$`broad_match` <- FactorCreationDTOObject$`broad_match`
}
if (!is.null(FactorCreationDTOObject$`narrow_match`)) {
self$`narrow_match` <- FactorCreationDTOObject$`narrow_match`
}
if (!is.null(FactorCreationDTOObject$`experiment`)) {
self$`experiment` <- FactorCreationDTOObject$`experiment`
}
},
fromJSONObject = function(FactorCreationDTOObject) {
if (!is.null(FactorCreationDTOObject$`uri`)) {
self$`uri` <- FactorCreationDTOObject$`uri`
}
if (!is.null(FactorCreationDTOObject$`name`)) {
self$`name` <- FactorCreationDTOObject$`name`
}
if (!is.null(FactorCreationDTOObject$`category`)) {
self$`category` <- FactorCreationDTOObject$`category`
}
if (!is.null(FactorCreationDTOObject$`description`)) {
self$`description` <- FactorCreationDTOObject$`description`
}
if (!is.null(FactorCreationDTOObject$`levels`)) {
self$`levels` <- lapply(FactorCreationDTOObject$`levels`, function(x) {
levelsObject <- FactorLevelCreationDTO$new()
levelsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
levelsObject
})
}
if (!is.null(FactorCreationDTOObject$`exact_match`)) {
self$`exact_match` <- FactorCreationDTOObject$`exact_match`
}
if (!is.null(FactorCreationDTOObject$`close_match`)) {
self$`close_match` <- FactorCreationDTOObject$`close_match`
}
if (!is.null(FactorCreationDTOObject$`broad_match`)) {
self$`broad_match` <- FactorCreationDTOObject$`broad_match`
}
if (!is.null(FactorCreationDTOObject$`narrow_match`)) {
self$`narrow_match` <- FactorCreationDTOObject$`narrow_match`
}
if (!is.null(FactorCreationDTOObject$`experiment`)) {
self$`experiment` <- FactorCreationDTOObject$`experiment`
}
},
toJSONString = function() {
levelsList = paste(lapply(self$`levels`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"uri": %s,
"name": %s,
"category": %s,
"description": %s,
"levels": [%s],
"exact_match": [%s],
"close_match": [%s],
"broad_match": [%s],
"narrow_match": [%s],
"experiment": %s
}',
ifelse(is.null(self$`uri`), "null",jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`name`), "null",jsonlite::toJSON(self$`name`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`category`), "null",jsonlite::toJSON(self$`category`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`description`), "null",jsonlite::toJSON(self$`description`,auto_unbox=TRUE, null = "null")),
levelsList,
ifelse(is.null(self$`exact_match`) || length(self$`exact_match`) == 0, "" ,lapply(self$`exact_match`, function(x) paste(paste0('"', x, '"'), sep=","))),
ifelse(is.null(self$`close_match`) || length(self$`close_match`) == 0, "" ,lapply(self$`close_match`, function(x) paste(paste0('"', x, '"'), sep=","))),
ifelse(is.null(self$`broad_match`) || length(self$`broad_match`) == 0, "" ,lapply(self$`broad_match`, function(x) paste(paste0('"', x, '"'), sep=","))),
ifelse(is.null(self$`narrow_match`) || length(self$`narrow_match`) == 0, "" ,lapply(self$`narrow_match`, function(x) paste(paste0('"', x, '"'), sep=","))),
ifelse(is.null(self$`experiment`), "null",jsonlite::toJSON(self$`experiment`,auto_unbox=TRUE, null = "null"))
)
},
fromJSONString = function(FactorCreationDTOJson) {
FactorCreationDTOObject <- jsonlite::fromJSON(FactorCreationDTOJson)
self$`uri` <- FactorCreationDTOObject$`uri`
self$`name` <- FactorCreationDTOObject$`name`
self$`category` <- FactorCreationDTOObject$`category`
self$`description` <- FactorCreationDTOObject$`description`
self$`levels` <- lapply(FactorCreationDTOObject$`levels`, function(x) FactorLevelCreationDTO$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`exact_match` <- FactorCreationDTOObject$`exact_match`
self$`close_match` <- FactorCreationDTOObject$`close_match`
self$`broad_match` <- FactorCreationDTOObject$`broad_match`
self$`narrow_match` <- FactorCreationDTOObject$`narrow_match`
self$`experiment` <- FactorCreationDTOObject$`experiment`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.