# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' ScientificObjectPutDTO Class
#'
#' @field rdfType
#' @field geometry
#' @field isPartOf
#' @field label
#' @field properties
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ScientificObjectPutDTO <- R6::R6Class(
'ScientificObjectPutDTO',
public = list(
`rdfType` = NULL,
`geometry` = NULL,
`isPartOf` = NULL,
`label` = NULL,
`properties` = NULL,
initialize = function(`rdfType`, `geometry`, `isPartOf`, `label`, `properties`){
if (!missing(`rdfType`)) {
stopifnot(is.character(`rdfType`), length(`rdfType`) == 1)
self$`rdfType` <- `rdfType`
}
if (!missing(`geometry`)) {
stopifnot(is.character(`geometry`), length(`geometry`) == 1)
self$`geometry` <- `geometry`
}
if (!missing(`isPartOf`)) {
stopifnot(is.character(`isPartOf`), length(`isPartOf`) == 1)
self$`isPartOf` <- `isPartOf`
}
if (!missing(`label`)) {
stopifnot(is.character(`label`), length(`label`) == 1)
self$`label` <- `label`
}
if (!missing(`properties`)) {
stopifnot(is.list(`properties`), length(`properties`) != 0)
lapply(`properties`, function(x) stopifnot(R6::is.R6(x)))
self$`properties` <- `properties`
}
},
toJSON = function() {
ScientificObjectPutDTOObject <- list()
if (!is.null(self$`rdfType`)) {
ScientificObjectPutDTOObject[['rdfType']] <- self$`rdfType`
}
if (!is.null(self$`geometry`)) {
ScientificObjectPutDTOObject[['geometry']] <- self$`geometry`
}
if (!is.null(self$`isPartOf`)) {
ScientificObjectPutDTOObject[['isPartOf']] <- self$`isPartOf`
}
if (!is.null(self$`label`)) {
ScientificObjectPutDTOObject[['label']] <- self$`label`
}
if (!is.null(self$`properties`)) {
ScientificObjectPutDTOObject[['properties']] <- lapply(self$`properties`, function(x) x$toJSON())
}
ScientificObjectPutDTOObject
},
fromJSON = function(ScientificObjectPutDTOJson) {
ScientificObjectPutDTOObject <- jsonlite::fromJSON(ScientificObjectPutDTOJson)
if (!is.null(ScientificObjectPutDTOObject$`rdfType`)) {
self$`rdfType` <- ScientificObjectPutDTOObject$`rdfType`
}
if (!is.null(ScientificObjectPutDTOObject$`geometry`)) {
self$`geometry` <- ScientificObjectPutDTOObject$`geometry`
}
if (!is.null(ScientificObjectPutDTOObject$`isPartOf`)) {
self$`isPartOf` <- ScientificObjectPutDTOObject$`isPartOf`
}
if (!is.null(ScientificObjectPutDTOObject$`label`)) {
self$`label` <- ScientificObjectPutDTOObject$`label`
}
if (!is.null(ScientificObjectPutDTOObject$`properties`)) {
self$`properties` <- lapply(ScientificObjectPutDTOObject$`properties`, function(x) {
propertiesObject <- PropertyPostDTO$new()
propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
propertiesObject
})
}
},
fromJSONObject = function(ScientificObjectPutDTOObject) {
if (!is.null(ScientificObjectPutDTOObject$`rdfType`)) {
self$`rdfType` <- ScientificObjectPutDTOObject$`rdfType`
}
if (!is.null(ScientificObjectPutDTOObject$`geometry`)) {
self$`geometry` <- ScientificObjectPutDTOObject$`geometry`
}
if (!is.null(ScientificObjectPutDTOObject$`isPartOf`)) {
self$`isPartOf` <- ScientificObjectPutDTOObject$`isPartOf`
}
if (!is.null(ScientificObjectPutDTOObject$`label`)) {
self$`label` <- ScientificObjectPutDTOObject$`label`
}
if (!is.null(ScientificObjectPutDTOObject$`properties`)) {
self$`properties` <- lapply(ScientificObjectPutDTOObject$`properties`, function(x) {
propertiesObject <- PropertyPostDTO$new()
propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
propertiesObject
})
}
},
toJSONString = function() {
propertiesList = paste(lapply(self$`properties`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"rdfType": %s,
"geometry": %s,
"isPartOf": %s,
"label": %s,
"properties": [%s]
}',
jsonlite::toJSON(self$`rdfType`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`geometry`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`isPartOf`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`label`,auto_unbox=TRUE, null = "null"),
propertiesList
)
},
fromJSONString = function(ScientificObjectPutDTOJson) {
ScientificObjectPutDTOObject <- jsonlite::fromJSON(ScientificObjectPutDTOJson)
self$`rdfType` <- ScientificObjectPutDTOObject$`rdfType`
self$`geometry` <- ScientificObjectPutDTOObject$`geometry`
self$`isPartOf` <- ScientificObjectPutDTOObject$`isPartOf`
self$`label` <- ScientificObjectPutDTOObject$`label`
self$`properties` <- lapply(ScientificObjectPutDTOObject$`properties`, function(x) PropertyPostDTO$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.