# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' Project Class
#'
#' @field uri
#' @field name
#' @field shortname
#' @field relatedProjects
#' @field financialFunding
#' @field financialReference
#' @field description
#' @field startDate
#' @field endDate
#' @field keywords
#' @field homePage
#' @field administrativeContacts
#' @field coordinators
#' @field scientificContacts
#' @field objective
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Project <- R6::R6Class(
'Project',
public = list(
`uri` = NULL,
`name` = NULL,
`shortname` = NULL,
`relatedProjects` = NULL,
`financialFunding` = NULL,
`financialReference` = NULL,
`description` = NULL,
`startDate` = NULL,
`endDate` = NULL,
`keywords` = NULL,
`homePage` = NULL,
`administrativeContacts` = NULL,
`coordinators` = NULL,
`scientificContacts` = NULL,
`objective` = NULL,
initialize = function(`uri`, `name`, `shortname`, `relatedProjects`, `financialFunding`, `financialReference`, `description`, `startDate`, `endDate`, `keywords`, `homePage`, `administrativeContacts`, `coordinators`, `scientificContacts`, `objective`){
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(`shortname`)) {
stopifnot(is.character(`shortname`), length(`shortname`) == 1)
self$`shortname` <- `shortname`
}
if (!missing(`relatedProjects`)) {
stopifnot(is.list(`relatedProjects`), length(`relatedProjects`) != 0)
lapply(`relatedProjects`, function(x) stopifnot(R6::is.R6(x)))
self$`relatedProjects` <- `relatedProjects`
}
if (!missing(`financialFunding`)) {
stopifnot(R6::is.R6(`financialFunding`))
self$`financialFunding` <- `financialFunding`
}
if (!missing(`financialReference`)) {
stopifnot(is.character(`financialReference`), length(`financialReference`) == 1)
self$`financialReference` <- `financialReference`
}
if (!missing(`description`)) {
stopifnot(is.character(`description`), length(`description`) == 1)
self$`description` <- `description`
}
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(`keywords`)) {
stopifnot(is.list(`keywords`), length(`keywords`) != 0)
lapply(`keywords`, function(x) stopifnot(is.character(x)))
self$`keywords` <- `keywords`
}
if (!missing(`homePage`)) {
stopifnot(is.character(`homePage`), length(`homePage`) == 1)
self$`homePage` <- `homePage`
}
if (!missing(`administrativeContacts`)) {
stopifnot(is.list(`administrativeContacts`), length(`administrativeContacts`) != 0)
lapply(`administrativeContacts`, function(x) stopifnot(R6::is.R6(x)))
self$`administrativeContacts` <- `administrativeContacts`
}
if (!missing(`coordinators`)) {
stopifnot(is.list(`coordinators`), length(`coordinators`) != 0)
lapply(`coordinators`, function(x) stopifnot(R6::is.R6(x)))
self$`coordinators` <- `coordinators`
}
if (!missing(`scientificContacts`)) {
stopifnot(is.list(`scientificContacts`), length(`scientificContacts`) != 0)
lapply(`scientificContacts`, function(x) stopifnot(R6::is.R6(x)))
self$`scientificContacts` <- `scientificContacts`
}
if (!missing(`objective`)) {
stopifnot(is.character(`objective`), length(`objective`) == 1)
self$`objective` <- `objective`
}
},
toJSON = function() {
ProjectObject <- list()
if (!is.null(self$`uri`)) {
ProjectObject[['uri']] <- self$`uri`
}
if (!is.null(self$`name`)) {
ProjectObject[['name']] <- self$`name`
}
if (!is.null(self$`shortname`)) {
ProjectObject[['shortname']] <- self$`shortname`
}
if (!is.null(self$`relatedProjects`)) {
ProjectObject[['relatedProjects']] <- lapply(self$`relatedProjects`, function(x) x$toJSON())
}
if (!is.null(self$`financialFunding`)) {
ProjectObject[['financialFunding']] <- self$`financialFunding`$toJSON()
}
if (!is.null(self$`financialReference`)) {
ProjectObject[['financialReference']] <- self$`financialReference`
}
if (!is.null(self$`description`)) {
ProjectObject[['description']] <- self$`description`
}
if (!is.null(self$`startDate`)) {
ProjectObject[['startDate']] <- self$`startDate`
}
if (!is.null(self$`endDate`)) {
ProjectObject[['endDate']] <- self$`endDate`
}
if (!is.null(self$`keywords`)) {
ProjectObject[['keywords']] <- self$`keywords`
}
if (!is.null(self$`homePage`)) {
ProjectObject[['homePage']] <- self$`homePage`
}
if (!is.null(self$`administrativeContacts`)) {
ProjectObject[['administrativeContacts']] <- lapply(self$`administrativeContacts`, function(x) x$toJSON())
}
if (!is.null(self$`coordinators`)) {
ProjectObject[['coordinators']] <- lapply(self$`coordinators`, function(x) x$toJSON())
}
if (!is.null(self$`scientificContacts`)) {
ProjectObject[['scientificContacts']] <- lapply(self$`scientificContacts`, function(x) x$toJSON())
}
if (!is.null(self$`objective`)) {
ProjectObject[['objective']] <- self$`objective`
}
ProjectObject
},
fromJSON = function(ProjectJson) {
ProjectObject <- jsonlite::fromJSON(ProjectJson)
if (!is.null(ProjectObject$`uri`)) {
self$`uri` <- ProjectObject$`uri`
}
if (!is.null(ProjectObject$`name`)) {
self$`name` <- ProjectObject$`name`
}
if (!is.null(ProjectObject$`shortname`)) {
self$`shortname` <- ProjectObject$`shortname`
}
if (!is.null(ProjectObject$`relatedProjects`)) {
self$`relatedProjects` <- lapply(ProjectObject$`relatedProjects`, function(x) {
relatedProjectsObject <- Project$new()
relatedProjectsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
relatedProjectsObject
})
}
if (!is.null(ProjectObject$`financialFunding`)) {
financialFundingObject <- FinancialFunding$new()
financialFundingObject$fromJSON(jsonlite::toJSON(ProjectObject$financialFunding, auto_unbox = TRUE, null = "null"))
self$`financialFunding` <- financialFundingObject
}
if (!is.null(ProjectObject$`financialReference`)) {
self$`financialReference` <- ProjectObject$`financialReference`
}
if (!is.null(ProjectObject$`description`)) {
self$`description` <- ProjectObject$`description`
}
if (!is.null(ProjectObject$`startDate`)) {
self$`startDate` <- ProjectObject$`startDate`
}
if (!is.null(ProjectObject$`endDate`)) {
self$`endDate` <- ProjectObject$`endDate`
}
if (!is.null(ProjectObject$`keywords`)) {
self$`keywords` <- ProjectObject$`keywords`
}
if (!is.null(ProjectObject$`homePage`)) {
self$`homePage` <- ProjectObject$`homePage`
}
if (!is.null(ProjectObject$`administrativeContacts`)) {
self$`administrativeContacts` <- lapply(ProjectObject$`administrativeContacts`, function(x) {
administrativeContactsObject <- Contact$new()
administrativeContactsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
administrativeContactsObject
})
}
if (!is.null(ProjectObject$`coordinators`)) {
self$`coordinators` <- lapply(ProjectObject$`coordinators`, function(x) {
coordinatorsObject <- Contact$new()
coordinatorsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
coordinatorsObject
})
}
if (!is.null(ProjectObject$`scientificContacts`)) {
self$`scientificContacts` <- lapply(ProjectObject$`scientificContacts`, function(x) {
scientificContactsObject <- Contact$new()
scientificContactsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
scientificContactsObject
})
}
if (!is.null(ProjectObject$`objective`)) {
self$`objective` <- ProjectObject$`objective`
}
},
fromJSONObject = function(ProjectObject) {
if (!is.null(ProjectObject$`uri`)) {
self$`uri` <- ProjectObject$`uri`
}
if (!is.null(ProjectObject$`name`)) {
self$`name` <- ProjectObject$`name`
}
if (!is.null(ProjectObject$`shortname`)) {
self$`shortname` <- ProjectObject$`shortname`
}
if (!is.null(ProjectObject$`relatedProjects`)) {
self$`relatedProjects` <- lapply(ProjectObject$`relatedProjects`, function(x) {
relatedProjectsObject <- Project$new()
relatedProjectsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
relatedProjectsObject
})
}
if (!is.null(ProjectObject$`financialFunding`)) {
financialFundingObject <- FinancialFunding$new()
financialFundingObject$fromJSON(jsonlite::toJSON(ProjectObject$financialFunding, auto_unbox = TRUE, null = "null"))
self$`financialFunding` <- financialFundingObject
}
if (!is.null(ProjectObject$`financialReference`)) {
self$`financialReference` <- ProjectObject$`financialReference`
}
if (!is.null(ProjectObject$`description`)) {
self$`description` <- ProjectObject$`description`
}
if (!is.null(ProjectObject$`startDate`)) {
self$`startDate` <- ProjectObject$`startDate`
}
if (!is.null(ProjectObject$`endDate`)) {
self$`endDate` <- ProjectObject$`endDate`
}
if (!is.null(ProjectObject$`keywords`)) {
self$`keywords` <- ProjectObject$`keywords`
}
if (!is.null(ProjectObject$`homePage`)) {
self$`homePage` <- ProjectObject$`homePage`
}
if (!is.null(ProjectObject$`administrativeContacts`)) {
self$`administrativeContacts` <- lapply(ProjectObject$`administrativeContacts`, function(x) {
administrativeContactsObject <- Contact$new()
administrativeContactsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
administrativeContactsObject
})
}
if (!is.null(ProjectObject$`coordinators`)) {
self$`coordinators` <- lapply(ProjectObject$`coordinators`, function(x) {
coordinatorsObject <- Contact$new()
coordinatorsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
coordinatorsObject
})
}
if (!is.null(ProjectObject$`scientificContacts`)) {
self$`scientificContacts` <- lapply(ProjectObject$`scientificContacts`, function(x) {
scientificContactsObject <- Contact$new()
scientificContactsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
scientificContactsObject
})
}
if (!is.null(ProjectObject$`objective`)) {
self$`objective` <- ProjectObject$`objective`
}
},
toJSONString = function() {
relatedProjectsList = paste(lapply(self$`relatedProjects`, function(x) x$toJSONString()),collapse = ",")
administrativeContactsList = paste(lapply(self$`administrativeContacts`, function(x) x$toJSONString()),collapse = ",")
coordinatorsList = paste(lapply(self$`coordinators`, function(x) x$toJSONString()),collapse = ",")
scientificContactsList = paste(lapply(self$`scientificContacts`, function(x) x$toJSONString()),collapse = ",")
sprintf(
'{
"uri": %s,
"name": %s,
"shortname": %s,
"relatedProjects": [%s],
"financialFunding": %s,
"financialReference": %s,
"description": %s,
"startDate": %s,
"endDate": %s,
"keywords": [%s],
"homePage": %s,
"administrativeContacts": [%s],
"coordinators": [%s],
"scientificContacts": [%s],
"objective": %s
}',
jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`name`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`shortname`,auto_unbox=TRUE, null = "null"),
relatedProjectsList,
self$`financialFunding`$toJSON(),
jsonlite::toJSON(self$`financialReference`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`description`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`startDate`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`endDate`,auto_unbox=TRUE, null = "null"),
lapply(self$`keywords`, function(x) paste(paste0('"', x, '"'), sep=",")),
jsonlite::toJSON(self$`homePage`,auto_unbox=TRUE, null = "null"),
administrativeContactsList,
coordinatorsList,
scientificContactsList,
jsonlite::toJSON(self$`objective`,auto_unbox=TRUE, null = "null")
)
},
fromJSONString = function(ProjectJson) {
ProjectObject <- jsonlite::fromJSON(ProjectJson)
self$`uri` <- ProjectObject$`uri`
self$`name` <- ProjectObject$`name`
self$`shortname` <- ProjectObject$`shortname`
self$`relatedProjects` <- lapply(ProjectObject$`relatedProjects`, function(x) Project$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
FinancialFundingObject <- FinancialFunding$new()
self$`financialFunding` <- FinancialFundingObject$fromJSON(jsonlite::toJSON(ProjectObject$financialFunding, auto_unbox = TRUE))
self$`financialReference` <- ProjectObject$`financialReference`
self$`description` <- ProjectObject$`description`
self$`startDate` <- ProjectObject$`startDate`
self$`endDate` <- ProjectObject$`endDate`
self$`keywords` <- ProjectObject$`keywords`
self$`homePage` <- ProjectObject$`homePage`
self$`administrativeContacts` <- lapply(ProjectObject$`administrativeContacts`, function(x) Contact$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`coordinators` <- lapply(ProjectObject$`coordinators`, function(x) Contact$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`scientificContacts` <- lapply(ProjectObject$`scientificContacts`, function(x) Contact$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
self$`objective` <- ProjectObject$`objective`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.