R/ScientificObjectNodeDTO.r

# 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


#' ScientificObjectNodeDTO Class
#'
#' @field uri 
#' @field name 
#' @field geometry 
#' @field rdf_type 
#' @field rdf_type_name 
#' @field creation_date 
#' @field destruction_date 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ScientificObjectNodeDTO <- R6::R6Class(
  'ScientificObjectNodeDTO',
  public = list(
    `uri` = NULL,
    `name` = NULL,
    `geometry` = NULL,
    `rdf_type` = NULL,
    `rdf_type_name` = NULL,
    `creation_date` = NULL,
    `destruction_date` = NULL,
    initialize = function(`uri`, `name`, `geometry`, `rdf_type`, `rdf_type_name`, `creation_date`, `destruction_date`){
      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(`geometry`)) {
        stopifnot(R6::is.R6(`geometry`))
        self$`geometry` <- `geometry`
      }
      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(`creation_date`)) {
        stopifnot(is.character(`creation_date`), length(`creation_date`) == 1)
        self$`creation_date` <- `creation_date`
      }
      if (!missing(`destruction_date`)) {
        stopifnot(is.character(`destruction_date`), length(`destruction_date`) == 1)
        self$`destruction_date` <- `destruction_date`
      }
    },
    toJSON = function() {
      ScientificObjectNodeDTOObject <- list()
      if (!is.null(self$`uri`)) {
        ScientificObjectNodeDTOObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`name`)) {
        ScientificObjectNodeDTOObject[['name']] <- self$`name`
      }
      if (!is.null(self$`geometry`)) {
        ScientificObjectNodeDTOObject[['geometry']] <- self$`geometry`$toJSON()
      }
      if (!is.null(self$`rdf_type`)) {
        ScientificObjectNodeDTOObject[['rdf_type']] <- self$`rdf_type`
      }
      if (!is.null(self$`rdf_type_name`)) {
        ScientificObjectNodeDTOObject[['rdf_type_name']] <- self$`rdf_type_name`
      }
      if (!is.null(self$`creation_date`)) {
        ScientificObjectNodeDTOObject[['creation_date']] <- self$`creation_date`
      }
      if (!is.null(self$`destruction_date`)) {
        ScientificObjectNodeDTOObject[['destruction_date']] <- self$`destruction_date`
      }

      ScientificObjectNodeDTOObject
    },
    fromJSON = function(ScientificObjectNodeDTOJson) {
      ScientificObjectNodeDTOObject <- jsonlite::fromJSON(ScientificObjectNodeDTOJson)
      if (!is.null(ScientificObjectNodeDTOObject$`uri`)) {
        self$`uri` <- ScientificObjectNodeDTOObject$`uri`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`name`)) {
        self$`name` <- ScientificObjectNodeDTOObject$`name`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`geometry`)) {
        geometryObject <- GeoJsonObject$new()
        geometryObject$fromJSON(jsonlite::toJSON(ScientificObjectNodeDTOObject$geometry, auto_unbox = TRUE, null = "null"))
        self$`geometry` <- geometryObject
      }
      if (!is.null(ScientificObjectNodeDTOObject$`rdf_type`)) {
        self$`rdf_type` <- ScientificObjectNodeDTOObject$`rdf_type`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`rdf_type_name`)) {
        self$`rdf_type_name` <- ScientificObjectNodeDTOObject$`rdf_type_name`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`creation_date`)) {
        self$`creation_date` <- ScientificObjectNodeDTOObject$`creation_date`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`destruction_date`)) {
        self$`destruction_date` <- ScientificObjectNodeDTOObject$`destruction_date`
      }
    },
    fromJSONObject = function(ScientificObjectNodeDTOObject) {
      if (!is.null(ScientificObjectNodeDTOObject$`uri`)) {
        self$`uri` <- ScientificObjectNodeDTOObject$`uri`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`name`)) {
        self$`name` <- ScientificObjectNodeDTOObject$`name`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`geometry`)) {
        geometryObject <- GeoJsonObject$new()
        geometryObject$fromJSON(jsonlite::toJSON(ScientificObjectNodeDTOObject$geometry, auto_unbox = TRUE, null = "null"))
        self$`geometry` <- geometryObject
      }
      if (!is.null(ScientificObjectNodeDTOObject$`rdf_type`)) {
        self$`rdf_type` <- ScientificObjectNodeDTOObject$`rdf_type`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`rdf_type_name`)) {
        self$`rdf_type_name` <- ScientificObjectNodeDTOObject$`rdf_type_name`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`creation_date`)) {
        self$`creation_date` <- ScientificObjectNodeDTOObject$`creation_date`
      }
      if (!is.null(ScientificObjectNodeDTOObject$`destruction_date`)) {
        self$`destruction_date` <- ScientificObjectNodeDTOObject$`destruction_date`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "uri": %s,
           "name": %s,
           "geometry": %s,
           "rdf_type": %s,
           "rdf_type_name": %s,
           "creation_date": %s,
           "destruction_date": %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")),
        jsonlite::toJSON(self$`geometry`$toJSON(),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$`creation_date`), "null",jsonlite::toJSON(self$`creation_date`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`destruction_date`), "null",jsonlite::toJSON(self$`destruction_date`,auto_unbox=TRUE, null = "null"))
      )
    },
    fromJSONString = function(ScientificObjectNodeDTOJson) {
      ScientificObjectNodeDTOObject <- jsonlite::fromJSON(ScientificObjectNodeDTOJson)
      self$`uri` <- ScientificObjectNodeDTOObject$`uri`
      self$`name` <- ScientificObjectNodeDTOObject$`name`
      GeoJsonObjectObject <- GeoJsonObject$new()
      self$`geometry` <- GeoJsonObjectObject$fromJSON(jsonlite::toJSON(ScientificObjectNodeDTOObject$geometry, auto_unbox = TRUE))
      self$`rdf_type` <- ScientificObjectNodeDTOObject$`rdf_type`
      self$`rdf_type_name` <- ScientificObjectNodeDTOObject$`rdf_type_name`
      self$`creation_date` <- ScientificObjectNodeDTOObject$`creation_date`
      self$`destruction_date` <- ScientificObjectNodeDTOObject$`destruction_date`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.