R/VueRDFTypeDTO.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


#' VueRDFTypeDTO Class
#'
#' @field uri 
#' @field name 
#' @field comment 
#' @field parent 
#' @field icon 
#' @field name_translations 
#' @field comment_translations 
#' @field is_abstract 
#' @field data_properties 
#' @field object_properties 
#' @field properties_order 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
VueRDFTypeDTO <- R6::R6Class(
  'VueRDFTypeDTO',
  public = list(
    `uri` = NULL,
    `name` = NULL,
    `comment` = NULL,
    `parent` = NULL,
    `icon` = NULL,
    `name_translations` = NULL,
    `comment_translations` = NULL,
    `is_abstract` = NULL,
    `data_properties` = NULL,
    `object_properties` = NULL,
    `properties_order` = NULL,
    initialize = function(`uri`, `name`, `comment`, `parent`, `icon`, `name_translations`, `comment_translations`, `is_abstract`, `data_properties`, `object_properties`, `properties_order`){
      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(`comment`)) {
        stopifnot(is.character(`comment`), length(`comment`) == 1)
        self$`comment` <- `comment`
      }
      if (!missing(`parent`)) {
        stopifnot(is.character(`parent`), length(`parent`) == 1)
        self$`parent` <- `parent`
      }
      if (!missing(`icon`)) {
        stopifnot(is.character(`icon`), length(`icon`) == 1)
        self$`icon` <- `icon`
      }
      if (!missing(`name_translations`)) {
        self$`name_translations` <- `name_translations`
      }
      if (!missing(`comment_translations`)) {
        self$`comment_translations` <- `comment_translations`
      }
      if (!missing(`is_abstract`)) {
        self$`is_abstract` <- `is_abstract`
      }
      if (!missing(`data_properties`)) {
        stopifnot(is.list(`data_properties`), length(`data_properties`) != 0)
        lapply(`data_properties`, function(x) stopifnot(R6::is.R6(x)))
        self$`data_properties` <- `data_properties`
      }
      if (!missing(`object_properties`)) {
        stopifnot(is.list(`object_properties`), length(`object_properties`) != 0)
        lapply(`object_properties`, function(x) stopifnot(R6::is.R6(x)))
        self$`object_properties` <- `object_properties`
      }
      if (!missing(`properties_order`)) {
        stopifnot(is.list(`properties_order`), length(`properties_order`) != 0)
        lapply(`properties_order`, function(x) stopifnot(is.character(x)))
        self$`properties_order` <- `properties_order`
      }
    },
    toJSON = function() {
      VueRDFTypeDTOObject <- list()
      if (!is.null(self$`uri`)) {
        VueRDFTypeDTOObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`name`)) {
        VueRDFTypeDTOObject[['name']] <- self$`name`
      }
      if (!is.null(self$`comment`)) {
        VueRDFTypeDTOObject[['comment']] <- self$`comment`
      }
      if (!is.null(self$`parent`)) {
        VueRDFTypeDTOObject[['parent']] <- self$`parent`
      }
      if (!is.null(self$`icon`)) {
        VueRDFTypeDTOObject[['icon']] <- self$`icon`
      }
      if (!is.null(self$`name_translations`)) {
        VueRDFTypeDTOObject[['name_translations']] <- self$`name_translations`
      }
      if (!is.null(self$`comment_translations`)) {
        VueRDFTypeDTOObject[['comment_translations']] <- self$`comment_translations`
      }
      if (!is.null(self$`is_abstract`)) {
        VueRDFTypeDTOObject[['is_abstract']] <- self$`is_abstract`
      }
      if (!is.null(self$`data_properties`)) {
        VueRDFTypeDTOObject[['data_properties']] <- lapply(self$`data_properties`, function(x) x$toJSON())
      }
      if (!is.null(self$`object_properties`)) {
        VueRDFTypeDTOObject[['object_properties']] <- lapply(self$`object_properties`, function(x) x$toJSON())
      }
      if (!is.null(self$`properties_order`)) {
        VueRDFTypeDTOObject[['properties_order']] <- self$`properties_order`
      }

      VueRDFTypeDTOObject
    },
    fromJSON = function(VueRDFTypeDTOJson) {
      VueRDFTypeDTOObject <- jsonlite::fromJSON(VueRDFTypeDTOJson)
      if (!is.null(VueRDFTypeDTOObject$`uri`)) {
        self$`uri` <- VueRDFTypeDTOObject$`uri`
      }
      if (!is.null(VueRDFTypeDTOObject$`name`)) {
        self$`name` <- VueRDFTypeDTOObject$`name`
      }
      if (!is.null(VueRDFTypeDTOObject$`comment`)) {
        self$`comment` <- VueRDFTypeDTOObject$`comment`
      }
      if (!is.null(VueRDFTypeDTOObject$`parent`)) {
        self$`parent` <- VueRDFTypeDTOObject$`parent`
      }
      if (!is.null(VueRDFTypeDTOObject$`icon`)) {
        self$`icon` <- VueRDFTypeDTOObject$`icon`
      }
      if (!is.null(VueRDFTypeDTOObject$`name_translations`)) {
        self$`name_translations` <- VueRDFTypeDTOObject$`name_translations`
      }
      if (!is.null(VueRDFTypeDTOObject$`comment_translations`)) {
        self$`comment_translations` <- VueRDFTypeDTOObject$`comment_translations`
      }
      if (!is.null(VueRDFTypeDTOObject$`is_abstract`)) {
        self$`is_abstract` <- VueRDFTypeDTOObject$`is_abstract`
      }
      if (!is.null(VueRDFTypeDTOObject$`data_properties`)) {
        self$`data_properties` <- lapply(VueRDFTypeDTOObject$`data_properties`, function(x) {
          data_propertiesObject <- VueRDFTypePropertyDTO$new()
          data_propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          data_propertiesObject
        })
      }
      if (!is.null(VueRDFTypeDTOObject$`object_properties`)) {
        self$`object_properties` <- lapply(VueRDFTypeDTOObject$`object_properties`, function(x) {
          object_propertiesObject <- VueRDFTypePropertyDTO$new()
          object_propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          object_propertiesObject
        })
      }
      if (!is.null(VueRDFTypeDTOObject$`properties_order`)) {
        self$`properties_order` <- VueRDFTypeDTOObject$`properties_order`
      }
    },
    fromJSONObject = function(VueRDFTypeDTOObject) {
      if (!is.null(VueRDFTypeDTOObject$`uri`)) {
        self$`uri` <- VueRDFTypeDTOObject$`uri`
      }
      if (!is.null(VueRDFTypeDTOObject$`name`)) {
        self$`name` <- VueRDFTypeDTOObject$`name`
      }
      if (!is.null(VueRDFTypeDTOObject$`comment`)) {
        self$`comment` <- VueRDFTypeDTOObject$`comment`
      }
      if (!is.null(VueRDFTypeDTOObject$`parent`)) {
        self$`parent` <- VueRDFTypeDTOObject$`parent`
      }
      if (!is.null(VueRDFTypeDTOObject$`icon`)) {
        self$`icon` <- VueRDFTypeDTOObject$`icon`
      }
      if (!is.null(VueRDFTypeDTOObject$`name_translations`)) {
        self$`name_translations` <- VueRDFTypeDTOObject$`name_translations`
      }
      if (!is.null(VueRDFTypeDTOObject$`comment_translations`)) {
        self$`comment_translations` <- VueRDFTypeDTOObject$`comment_translations`
      }
      if (!is.null(VueRDFTypeDTOObject$`is_abstract`)) {
        self$`is_abstract` <- VueRDFTypeDTOObject$`is_abstract`
      }
      if (!is.null(VueRDFTypeDTOObject$`data_properties`)) {
        self$`data_properties` <- lapply(VueRDFTypeDTOObject$`data_properties`, function(x) {
          data_propertiesObject <- VueRDFTypePropertyDTO$new()
          data_propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          data_propertiesObject
        })
      }
      if (!is.null(VueRDFTypeDTOObject$`object_properties`)) {
        self$`object_properties` <- lapply(VueRDFTypeDTOObject$`object_properties`, function(x) {
          object_propertiesObject <- VueRDFTypePropertyDTO$new()
          object_propertiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          object_propertiesObject
        })
      }
      if (!is.null(VueRDFTypeDTOObject$`properties_order`)) {
        self$`properties_order` <- VueRDFTypeDTOObject$`properties_order`
      }
    },
    toJSONString = function() {
      data_propertiesList = paste(lapply(self$`data_properties`, function(x) x$toJSONString()),collapse = ",")
      object_propertiesList = paste(lapply(self$`object_properties`, function(x) x$toJSONString()),collapse = ",")
       sprintf(
        '{
           "uri": %s,
           "name": %s,
           "comment": %s,
           "parent": %s,
           "icon": %s,
           "name_translations": %s,
           "comment_translations": %s,
           "is_abstract": %s,
           "data_properties": [%s],
           "object_properties": [%s],
           "properties_order": [%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$`comment`), "null",jsonlite::toJSON(self$`comment`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`parent`), "null",jsonlite::toJSON(self$`parent`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`icon`), "null",jsonlite::toJSON(self$`icon`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`name_translations`), "null",jsonlite::toJSON(self$`name_translations`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`comment_translations`), "null",jsonlite::toJSON(self$`comment_translations`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`is_abstract`), "null",jsonlite::toJSON(self$`is_abstract`,auto_unbox=TRUE, null = "null")),
        data_propertiesList,
        object_propertiesList,
        ifelse(is.null(self$`properties_order`) || length(self$`properties_order`) == 0, "" ,lapply(self$`properties_order`, function(x) paste(paste0('"', x, '"'), sep=",")))
      )
    },
    fromJSONString = function(VueRDFTypeDTOJson) {
      VueRDFTypeDTOObject <- jsonlite::fromJSON(VueRDFTypeDTOJson)
      self$`uri` <- VueRDFTypeDTOObject$`uri`
      self$`name` <- VueRDFTypeDTOObject$`name`
      self$`comment` <- VueRDFTypeDTOObject$`comment`
      self$`parent` <- VueRDFTypeDTOObject$`parent`
      self$`icon` <- VueRDFTypeDTOObject$`icon`
      self$`name_translations` <- VueRDFTypeDTOObject$`name_translations`
      self$`comment_translations` <- VueRDFTypeDTOObject$`comment_translations`
      self$`is_abstract` <- VueRDFTypeDTOObject$`is_abstract`
      self$`data_properties` <- lapply(VueRDFTypeDTOObject$`data_properties`, function(x) VueRDFTypePropertyDTO$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`object_properties` <- lapply(VueRDFTypeDTOObject$`object_properties`, function(x) VueRDFTypePropertyDTO$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`properties_order` <- VueRDFTypeDTOObject$`properties_order`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.