# 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
#' ProvenanceGetDTO Class
#'
#' @field uri
#' @field name
#' @field description
#' @field prov_activity
#' @field prov_agent
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ProvenanceGetDTO <- R6::R6Class(
'ProvenanceGetDTO',
public = list(
`uri` = NULL,
`name` = NULL,
`description` = NULL,
`prov_activity` = NULL,
`prov_agent` = NULL,
initialize = function(`uri`, `name`, `description`, `prov_activity`, `prov_agent`){
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(`description`)) {
stopifnot(is.character(`description`), length(`description`) == 1)
self$`description` <- `description`
}
if (!missing(`prov_activity`)) {
stopifnot(is.list(`prov_activity`), length(`prov_activity`) != 0)
lapply(`prov_activity`, function(x) stopifnot(R6::is.R6(x)))
self$`prov_activity` <- `prov_activity`
}
if (!missing(`prov_agent`)) {
stopifnot(is.list(`prov_agent`), length(`prov_agent`) != 0)
lapply(`prov_agent`, function(x) stopifnot(R6::is.R6(x)))
self$`prov_agent` <- `prov_agent`
}
},
toJSON = function() {
ProvenanceGetDTOObject <- list()
if (!is.null(self$`uri`)) {
ProvenanceGetDTOObject[['uri']] <- self$`uri`
}
if (!is.null(self$`name`)) {
ProvenanceGetDTOObject[['name']] <- self$`name`
}
if (!is.null(self$`description`)) {
ProvenanceGetDTOObject[['description']] <- self$`description`
}
if (!is.null(self$`prov_activity`)) {
ProvenanceGetDTOObject[['prov_activity']] <- lapply(self$`prov_activity`, function(x) x$toJSON())
}
if (!is.null(self$`prov_agent`)) {
ProvenanceGetDTOObject[['prov_agent']] <- lapply(self$`prov_agent`, function(x) x$toJSON())
}
ProvenanceGetDTOObject
},
fromJSON = function(ProvenanceGetDTOJson) {
ProvenanceGetDTOObject <- jsonlite::fromJSON(ProvenanceGetDTOJson)
if (!is.null(ProvenanceGetDTOObject$`uri`)) {
self$`uri` <- ProvenanceGetDTOObject$`uri`
}
if (!is.null(ProvenanceGetDTOObject$`name`)) {
self$`name` <- ProvenanceGetDTOObject$`name`
}
if (!is.null(ProvenanceGetDTOObject$`description`)) {
self$`description` <- ProvenanceGetDTOObject$`description`
}
if (!is.null(ProvenanceGetDTOObject$`prov_activity`)) {
self$`prov_activity` <- lapply(ProvenanceGetDTOObject$`prov_activity`, function(x) {
prov_activityObject <- ActivityGetDTO$new()
prov_activityObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
prov_activityObject
})
}
if (!is.null(ProvenanceGetDTOObject$`prov_agent`)) {
self$`prov_agent` <- lapply(ProvenanceGetDTOObject$`prov_agent`, function(x) {
prov_agentObject <- AgentModel$new()
prov_agentObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
prov_agentObject
})
}
},
fromJSONObject = function(ProvenanceGetDTOObject) {
if (!is.null(ProvenanceGetDTOObject$`uri`)) {
self$`uri` <- ProvenanceGetDTOObject$`uri`
}
if (!is.null(ProvenanceGetDTOObject$`name`)) {
self$`name` <- ProvenanceGetDTOObject$`name`
}
if (!is.null(ProvenanceGetDTOObject$`description`)) {
self$`description` <- ProvenanceGetDTOObject$`description`
}
if (!is.null(ProvenanceGetDTOObject$`prov_activity`)) {
self$`prov_activity` <- lapply(ProvenanceGetDTOObject$`prov_activity`, function(x) {
prov_activityObject <- ActivityGetDTO$new()
prov_activityObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
prov_activityObject
})
}
if (!is.null(ProvenanceGetDTOObject$`prov_agent`)) {
self$`prov_agent` <- lapply(ProvenanceGetDTOObject$`prov_agent`, function(x) {
prov_agentObject <- AgentModel$new()
prov_agentObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
prov_agentObject
})
}
},
toJSONString = function() {
prov_activityList = paste(lapply(self$`prov_activity`, function(x) x$toJSONString()),collapse = ",")
prov_agentList = paste(lapply(self$`prov_agent`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"uri": %s,
"name": %s,
"description": %s,
"prov_activity": [%s],
"prov_agent": [%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$`description`), "null",jsonlite::toJSON(self$`description`,auto_unbox=TRUE, null = "null")),
prov_activityList,
prov_agentList
)
},
fromJSONString = function(ProvenanceGetDTOJson) {
ProvenanceGetDTOObject <- jsonlite::fromJSON(ProvenanceGetDTOJson)
self$`uri` <- ProvenanceGetDTOObject$`uri`
self$`name` <- ProvenanceGetDTOObject$`name`
self$`description` <- ProvenanceGetDTOObject$`description`
self$`prov_activity` <- lapply(ProvenanceGetDTOObject$`prov_activity`, function(x) ActivityGetDTO$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`prov_agent` <- lapply(ProvenanceGetDTOObject$`prov_agent`, function(x) AgentModel$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.