# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' Experiment Class
#'
#' @field uri
#' @field startDate
#' @field endDate
#' @field field
#' @field campaign
#' @field place
#' @field alias
#' @field comment
#' @field keywords
#' @field objective
#' @field cropSpecies
#' @field projects
#' @field groups
#' @field contacts
#' @field variables
#' @field sensors
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Experiment <- R6::R6Class(
'Experiment',
public = list(
`uri` = NULL,
`startDate` = NULL,
`endDate` = NULL,
`field` = NULL,
`campaign` = NULL,
`place` = NULL,
`alias` = NULL,
`comment` = NULL,
`keywords` = NULL,
`objective` = NULL,
`cropSpecies` = NULL,
`projects` = NULL,
`groups` = NULL,
`contacts` = NULL,
`variables` = NULL,
`sensors` = NULL,
initialize = function(`uri`, `startDate`, `endDate`, `field`, `campaign`, `place`, `alias`, `comment`, `keywords`, `objective`, `cropSpecies`, `projects`, `groups`, `contacts`, `variables`, `sensors`){
if (!missing(`uri`)) {
stopifnot(is.character(`uri`), length(`uri`) == 1)
self$`uri` <- `uri`
}
if (!missing(`startDate`)) {
stopifnot(is.character(`startDate`), length(`startDate`) == 1)
self$`startDate` <- `startDate`
}
if (!missing(`endDate`)) {
stopifnot(is.character(`endDate`), length(`endDate`) == 1)
self$`endDate` <- `endDate`
}
if (!missing(`field`)) {
stopifnot(is.character(`field`), length(`field`) == 1)
self$`field` <- `field`
}
if (!missing(`campaign`)) {
stopifnot(is.character(`campaign`), length(`campaign`) == 1)
self$`campaign` <- `campaign`
}
if (!missing(`place`)) {
stopifnot(is.character(`place`), length(`place`) == 1)
self$`place` <- `place`
}
if (!missing(`alias`)) {
stopifnot(is.character(`alias`), length(`alias`) == 1)
self$`alias` <- `alias`
}
if (!missing(`comment`)) {
stopifnot(is.character(`comment`), length(`comment`) == 1)
self$`comment` <- `comment`
}
if (!missing(`keywords`)) {
stopifnot(is.character(`keywords`), length(`keywords`) == 1)
self$`keywords` <- `keywords`
}
if (!missing(`objective`)) {
stopifnot(is.character(`objective`), length(`objective`) == 1)
self$`objective` <- `objective`
}
if (!missing(`cropSpecies`)) {
stopifnot(is.character(`cropSpecies`), length(`cropSpecies`) == 1)
self$`cropSpecies` <- `cropSpecies`
}
if (!missing(`projects`)) {
stopifnot(is.list(`projects`), length(`projects`) != 0)
lapply(`projects`, function(x) stopifnot(R6::is.R6(x)))
self$`projects` <- `projects`
}
if (!missing(`groups`)) {
stopifnot(is.list(`groups`), length(`groups`) != 0)
lapply(`groups`, function(x) stopifnot(R6::is.R6(x)))
self$`groups` <- `groups`
}
if (!missing(`contacts`)) {
stopifnot(is.list(`contacts`), length(`contacts`) != 0)
lapply(`contacts`, function(x) stopifnot(R6::is.R6(x)))
self$`contacts` <- `contacts`
}
if (!missing(`variables`)) {
self$`variables` <- `variables`
}
if (!missing(`sensors`)) {
self$`sensors` <- `sensors`
}
},
toJSON = function() {
ExperimentObject <- list()
if (!is.null(self$`uri`)) {
ExperimentObject[['uri']] <- self$`uri`
}
if (!is.null(self$`startDate`)) {
ExperimentObject[['startDate']] <- self$`startDate`
}
if (!is.null(self$`endDate`)) {
ExperimentObject[['endDate']] <- self$`endDate`
}
if (!is.null(self$`field`)) {
ExperimentObject[['field']] <- self$`field`
}
if (!is.null(self$`campaign`)) {
ExperimentObject[['campaign']] <- self$`campaign`
}
if (!is.null(self$`place`)) {
ExperimentObject[['place']] <- self$`place`
}
if (!is.null(self$`alias`)) {
ExperimentObject[['alias']] <- self$`alias`
}
if (!is.null(self$`comment`)) {
ExperimentObject[['comment']] <- self$`comment`
}
if (!is.null(self$`keywords`)) {
ExperimentObject[['keywords']] <- self$`keywords`
}
if (!is.null(self$`objective`)) {
ExperimentObject[['objective']] <- self$`objective`
}
if (!is.null(self$`cropSpecies`)) {
ExperimentObject[['cropSpecies']] <- self$`cropSpecies`
}
if (!is.null(self$`projects`)) {
ExperimentObject[['projects']] <- lapply(self$`projects`, function(x) x$toJSON())
}
if (!is.null(self$`groups`)) {
ExperimentObject[['groups']] <- lapply(self$`groups`, function(x) x$toJSON())
}
if (!is.null(self$`contacts`)) {
ExperimentObject[['contacts']] <- lapply(self$`contacts`, function(x) x$toJSON())
}
if (!is.null(self$`variables`)) {
ExperimentObject[['variables']] <- self$`variables`
}
if (!is.null(self$`sensors`)) {
ExperimentObject[['sensors']] <- self$`sensors`
}
ExperimentObject
},
fromJSON = function(ExperimentJson) {
ExperimentObject <- jsonlite::fromJSON(ExperimentJson)
if (!is.null(ExperimentObject$`uri`)) {
self$`uri` <- ExperimentObject$`uri`
}
if (!is.null(ExperimentObject$`startDate`)) {
self$`startDate` <- ExperimentObject$`startDate`
}
if (!is.null(ExperimentObject$`endDate`)) {
self$`endDate` <- ExperimentObject$`endDate`
}
if (!is.null(ExperimentObject$`field`)) {
self$`field` <- ExperimentObject$`field`
}
if (!is.null(ExperimentObject$`campaign`)) {
self$`campaign` <- ExperimentObject$`campaign`
}
if (!is.null(ExperimentObject$`place`)) {
self$`place` <- ExperimentObject$`place`
}
if (!is.null(ExperimentObject$`alias`)) {
self$`alias` <- ExperimentObject$`alias`
}
if (!is.null(ExperimentObject$`comment`)) {
self$`comment` <- ExperimentObject$`comment`
}
if (!is.null(ExperimentObject$`keywords`)) {
self$`keywords` <- ExperimentObject$`keywords`
}
if (!is.null(ExperimentObject$`objective`)) {
self$`objective` <- ExperimentObject$`objective`
}
if (!is.null(ExperimentObject$`cropSpecies`)) {
self$`cropSpecies` <- ExperimentObject$`cropSpecies`
}
if (!is.null(ExperimentObject$`projects`)) {
self$`projects` <- lapply(ExperimentObject$`projects`, function(x) {
projectsObject <- Project$new()
projectsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
projectsObject
})
}
if (!is.null(ExperimentObject$`groups`)) {
self$`groups` <- lapply(ExperimentObject$`groups`, function(x) {
groupsObject <- Group$new()
groupsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
groupsObject
})
}
if (!is.null(ExperimentObject$`contacts`)) {
self$`contacts` <- lapply(ExperimentObject$`contacts`, function(x) {
contactsObject <- ContactPostgreSQL$new()
contactsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
contactsObject
})
}
if (!is.null(ExperimentObject$`variables`)) {
self$`variables` <- ExperimentObject$`variables`
}
if (!is.null(ExperimentObject$`sensors`)) {
self$`sensors` <- ExperimentObject$`sensors`
}
},
fromJSONObject = function(ExperimentObject) {
if (!is.null(ExperimentObject$`uri`)) {
self$`uri` <- ExperimentObject$`uri`
}
if (!is.null(ExperimentObject$`startDate`)) {
self$`startDate` <- ExperimentObject$`startDate`
}
if (!is.null(ExperimentObject$`endDate`)) {
self$`endDate` <- ExperimentObject$`endDate`
}
if (!is.null(ExperimentObject$`field`)) {
self$`field` <- ExperimentObject$`field`
}
if (!is.null(ExperimentObject$`campaign`)) {
self$`campaign` <- ExperimentObject$`campaign`
}
if (!is.null(ExperimentObject$`place`)) {
self$`place` <- ExperimentObject$`place`
}
if (!is.null(ExperimentObject$`alias`)) {
self$`alias` <- ExperimentObject$`alias`
}
if (!is.null(ExperimentObject$`comment`)) {
self$`comment` <- ExperimentObject$`comment`
}
if (!is.null(ExperimentObject$`keywords`)) {
self$`keywords` <- ExperimentObject$`keywords`
}
if (!is.null(ExperimentObject$`objective`)) {
self$`objective` <- ExperimentObject$`objective`
}
if (!is.null(ExperimentObject$`cropSpecies`)) {
self$`cropSpecies` <- ExperimentObject$`cropSpecies`
}
if (!is.null(ExperimentObject$`projects`)) {
self$`projects` <- lapply(ExperimentObject$`projects`, function(x) {
projectsObject <- Project$new()
projectsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
projectsObject
})
}
if (!is.null(ExperimentObject$`groups`)) {
self$`groups` <- lapply(ExperimentObject$`groups`, function(x) {
groupsObject <- Group$new()
groupsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
groupsObject
})
}
if (!is.null(ExperimentObject$`contacts`)) {
self$`contacts` <- lapply(ExperimentObject$`contacts`, function(x) {
contactsObject <- ContactPostgreSQL$new()
contactsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
contactsObject
})
}
if (!is.null(ExperimentObject$`variables`)) {
self$`variables` <- ExperimentObject$`variables`
}
if (!is.null(ExperimentObject$`sensors`)) {
self$`sensors` <- ExperimentObject$`sensors`
}
},
toJSONString = function() {
projectsList = paste(lapply(self$`projects`, function(x) x$toJSONString()),collapse = ",")
groupsList = paste(lapply(self$`groups`, function(x) x$toJSONString()),collapse = ",")
contactsList = paste(lapply(self$`contacts`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"uri": %s,
"startDate": %s,
"endDate": %s,
"field": %s,
"campaign": %s,
"place": %s,
"alias": %s,
"comment": %s,
"keywords": %s,
"objective": %s,
"cropSpecies": %s,
"projects": [%s],
"groups": [%s],
"contacts": [%s],
"variables": %s,
"sensors": %s
}',
jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`startDate`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`endDate`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`field`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`campaign`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`place`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`alias`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`comment`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`keywords`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`objective`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`cropSpecies`,auto_unbox=TRUE, null = "null"),
projectsList,
groupsList,
contactsList,
jsonlite::toJSON(self$`variables`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`sensors`,auto_unbox=TRUE, null = "null")
)
},
fromJSONString = function(ExperimentJson) {
ExperimentObject <- jsonlite::fromJSON(ExperimentJson)
self$`uri` <- ExperimentObject$`uri`
self$`startDate` <- ExperimentObject$`startDate`
self$`endDate` <- ExperimentObject$`endDate`
self$`field` <- ExperimentObject$`field`
self$`campaign` <- ExperimentObject$`campaign`
self$`place` <- ExperimentObject$`place`
self$`alias` <- ExperimentObject$`alias`
self$`comment` <- ExperimentObject$`comment`
self$`keywords` <- ExperimentObject$`keywords`
self$`objective` <- ExperimentObject$`objective`
self$`cropSpecies` <- ExperimentObject$`cropSpecies`
self$`projects` <- lapply(ExperimentObject$`projects`, function(x) Project$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`groups` <- lapply(ExperimentObject$`groups`, function(x) Group$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`contacts` <- lapply(ExperimentObject$`contacts`, function(x) ContactPostgreSQL$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`variables` <- ExperimentObject$`variables`
self$`sensors` <- ExperimentObject$`sensors`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.