# 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
#' InfrastructureFacilityGetDTO Class
#'
#' @field uri
#' @field rdf_type
#' @field rdf_type_name
#' @field name
#' @field organizations
#' @field sites
#' @field address
#' @field geometry
#' @field relations
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InfrastructureFacilityGetDTO <- R6::R6Class(
'InfrastructureFacilityGetDTO',
public = list(
`uri` = NULL,
`rdf_type` = NULL,
`rdf_type_name` = NULL,
`name` = NULL,
`organizations` = NULL,
`sites` = NULL,
`address` = NULL,
`geometry` = NULL,
`relations` = NULL,
initialize = function(`uri`, `rdf_type`, `rdf_type_name`, `name`, `organizations`, `sites`, `address`, `geometry`, `relations`){
if (!missing(`uri`)) {
stopifnot(is.character(`uri`), length(`uri`) == 1)
self$`uri` <- `uri`
}
if (!missing(`rdf_type`)) {
stopifnot(is.character(`rdf_type`), length(`rdf_type`) == 1)
self$`rdf_type` <- `rdf_type`
}
if (!missing(`rdf_type_name`)) {
stopifnot(is.character(`rdf_type_name`), length(`rdf_type_name`) == 1)
self$`rdf_type_name` <- `rdf_type_name`
}
if (!missing(`name`)) {
stopifnot(is.character(`name`), length(`name`) == 1)
self$`name` <- `name`
}
if (!missing(`organizations`)) {
stopifnot(is.list(`organizations`), length(`organizations`) != 0)
lapply(`organizations`, function(x) stopifnot(R6::is.R6(x)))
self$`organizations` <- `organizations`
}
if (!missing(`sites`)) {
stopifnot(is.list(`sites`), length(`sites`) != 0)
lapply(`sites`, function(x) stopifnot(R6::is.R6(x)))
self$`sites` <- `sites`
}
if (!missing(`address`)) {
stopifnot(R6::is.R6(`address`))
self$`address` <- `address`
}
if (!missing(`geometry`)) {
stopifnot(R6::is.R6(`geometry`))
self$`geometry` <- `geometry`
}
if (!missing(`relations`)) {
stopifnot(is.list(`relations`), length(`relations`) != 0)
lapply(`relations`, function(x) stopifnot(R6::is.R6(x)))
self$`relations` <- `relations`
}
},
toJSON = function() {
InfrastructureFacilityGetDTOObject <- list()
if (!is.null(self$`uri`)) {
InfrastructureFacilityGetDTOObject[['uri']] <- self$`uri`
}
if (!is.null(self$`rdf_type`)) {
InfrastructureFacilityGetDTOObject[['rdf_type']] <- self$`rdf_type`
}
if (!is.null(self$`rdf_type_name`)) {
InfrastructureFacilityGetDTOObject[['rdf_type_name']] <- self$`rdf_type_name`
}
if (!is.null(self$`name`)) {
InfrastructureFacilityGetDTOObject[['name']] <- self$`name`
}
if (!is.null(self$`organizations`)) {
InfrastructureFacilityGetDTOObject[['organizations']] <- lapply(self$`organizations`, function(x) x$toJSON())
}
if (!is.null(self$`sites`)) {
InfrastructureFacilityGetDTOObject[['sites']] <- lapply(self$`sites`, function(x) x$toJSON())
}
if (!is.null(self$`address`)) {
InfrastructureFacilityGetDTOObject[['address']] <- self$`address`$toJSON()
}
if (!is.null(self$`geometry`)) {
InfrastructureFacilityGetDTOObject[['geometry']] <- self$`geometry`$toJSON()
}
if (!is.null(self$`relations`)) {
InfrastructureFacilityGetDTOObject[['relations']] <- lapply(self$`relations`, function(x) x$toJSON())
}
InfrastructureFacilityGetDTOObject
},
fromJSON = function(InfrastructureFacilityGetDTOJson) {
InfrastructureFacilityGetDTOObject <- jsonlite::fromJSON(InfrastructureFacilityGetDTOJson)
if (!is.null(InfrastructureFacilityGetDTOObject$`uri`)) {
self$`uri` <- InfrastructureFacilityGetDTOObject$`uri`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`rdf_type`)) {
self$`rdf_type` <- InfrastructureFacilityGetDTOObject$`rdf_type`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`rdf_type_name`)) {
self$`rdf_type_name` <- InfrastructureFacilityGetDTOObject$`rdf_type_name`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`name`)) {
self$`name` <- InfrastructureFacilityGetDTOObject$`name`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`organizations`)) {
self$`organizations` <- lapply(InfrastructureFacilityGetDTOObject$`organizations`, function(x) {
organizationsObject <- NamedResourceDTOInfrastructureModel$new()
organizationsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
organizationsObject
})
}
if (!is.null(InfrastructureFacilityGetDTOObject$`sites`)) {
self$`sites` <- lapply(InfrastructureFacilityGetDTOObject$`sites`, function(x) {
sitesObject <- NamedResourceDTOSiteModel$new()
sitesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
sitesObject
})
}
if (!is.null(InfrastructureFacilityGetDTOObject$`address`)) {
addressObject <- FacilityAddressDTO$new()
addressObject$fromJSON(jsonlite::toJSON(InfrastructureFacilityGetDTOObject$address, auto_unbox = TRUE, null = "null"))
self$`address` <- addressObject
}
if (!is.null(InfrastructureFacilityGetDTOObject$`geometry`)) {
geometryObject <- GeoJsonObject$new()
geometryObject$fromJSON(jsonlite::toJSON(InfrastructureFacilityGetDTOObject$geometry, auto_unbox = TRUE, null = "null"))
self$`geometry` <- geometryObject
}
if (!is.null(InfrastructureFacilityGetDTOObject$`relations`)) {
self$`relations` <- lapply(InfrastructureFacilityGetDTOObject$`relations`, function(x) {
relationsObject <- RDFObjectRelationDTO$new()
relationsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
relationsObject
})
}
},
fromJSONObject = function(InfrastructureFacilityGetDTOObject) {
if (!is.null(InfrastructureFacilityGetDTOObject$`uri`)) {
self$`uri` <- InfrastructureFacilityGetDTOObject$`uri`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`rdf_type`)) {
self$`rdf_type` <- InfrastructureFacilityGetDTOObject$`rdf_type`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`rdf_type_name`)) {
self$`rdf_type_name` <- InfrastructureFacilityGetDTOObject$`rdf_type_name`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`name`)) {
self$`name` <- InfrastructureFacilityGetDTOObject$`name`
}
if (!is.null(InfrastructureFacilityGetDTOObject$`organizations`)) {
self$`organizations` <- lapply(InfrastructureFacilityGetDTOObject$`organizations`, function(x) {
organizationsObject <- NamedResourceDTOInfrastructureModel$new()
organizationsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
organizationsObject
})
}
if (!is.null(InfrastructureFacilityGetDTOObject$`sites`)) {
self$`sites` <- lapply(InfrastructureFacilityGetDTOObject$`sites`, function(x) {
sitesObject <- NamedResourceDTOSiteModel$new()
sitesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
sitesObject
})
}
if (!is.null(InfrastructureFacilityGetDTOObject$`address`)) {
addressObject <- FacilityAddressDTO$new()
addressObject$fromJSON(jsonlite::toJSON(InfrastructureFacilityGetDTOObject$address, auto_unbox = TRUE, null = "null"))
self$`address` <- addressObject
}
if (!is.null(InfrastructureFacilityGetDTOObject$`geometry`)) {
geometryObject <- GeoJsonObject$new()
geometryObject$fromJSON(jsonlite::toJSON(InfrastructureFacilityGetDTOObject$geometry, auto_unbox = TRUE, null = "null"))
self$`geometry` <- geometryObject
}
if (!is.null(InfrastructureFacilityGetDTOObject$`relations`)) {
self$`relations` <- lapply(InfrastructureFacilityGetDTOObject$`relations`, function(x) {
relationsObject <- RDFObjectRelationDTO$new()
relationsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
relationsObject
})
}
},
toJSONString = function() {
organizationsList = paste(lapply(self$`organizations`, function(x) x$toJSONString()),collapse = ",")
sitesList = paste(lapply(self$`sites`, function(x) x$toJSONString()),collapse = ",")
relationsList = paste(lapply(self$`relations`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"uri": %s,
"rdf_type": %s,
"rdf_type_name": %s,
"name": %s,
"organizations": [%s],
"sites": [%s],
"address": %s,
"geometry": %s,
"relations": [%s]
}',
ifelse(is.null(self$`uri`), "null",jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`rdf_type`), "null",jsonlite::toJSON(self$`rdf_type`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`rdf_type_name`), "null",jsonlite::toJSON(self$`rdf_type_name`,auto_unbox=TRUE, null = "null")),
ifelse(is.null(self$`name`), "null",jsonlite::toJSON(self$`name`,auto_unbox=TRUE, null = "null")),
organizationsList,
sitesList,
jsonlite::toJSON(self$`address`$toJSON(),auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`geometry`$toJSON(),auto_unbox=TRUE, null = "null"),
relationsList
)
},
fromJSONString = function(InfrastructureFacilityGetDTOJson) {
InfrastructureFacilityGetDTOObject <- jsonlite::fromJSON(InfrastructureFacilityGetDTOJson)
self$`uri` <- InfrastructureFacilityGetDTOObject$`uri`
self$`rdf_type` <- InfrastructureFacilityGetDTOObject$`rdf_type`
self$`rdf_type_name` <- InfrastructureFacilityGetDTOObject$`rdf_type_name`
self$`name` <- InfrastructureFacilityGetDTOObject$`name`
self$`organizations` <- lapply(InfrastructureFacilityGetDTOObject$`organizations`, function(x) NamedResourceDTOInfrastructureModel$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`sites` <- lapply(InfrastructureFacilityGetDTOObject$`sites`, function(x) NamedResourceDTOSiteModel$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
FacilityAddressDTOObject <- FacilityAddressDTO$new()
self$`address` <- FacilityAddressDTOObject$fromJSON(jsonlite::toJSON(InfrastructureFacilityGetDTOObject$address, auto_unbox = TRUE))
GeoJsonObjectObject <- GeoJsonObject$new()
self$`geometry` <- GeoJsonObjectObject$fromJSON(jsonlite::toJSON(InfrastructureFacilityGetDTOObject$geometry, auto_unbox = TRUE))
self$`relations` <- lapply(InfrastructureFacilityGetDTOObject$`relations`, function(x) RDFObjectRelationDTO$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.