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


#' RDFTypeDTO Class
#'
#' @field uri 
#' @field name 
#' @field comment 
#' @field parent 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
RDFTypeDTO <- R6::R6Class(
  'RDFTypeDTO',
  public = list(
    `uri` = NULL,
    `name` = NULL,
    `comment` = NULL,
    `parent` = NULL,
    initialize = function(`uri`, `name`, `comment`, `parent`){
      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`
      }
    },
    toJSON = function() {
      RDFTypeDTOObject <- list()
      if (!is.null(self$`uri`)) {
        RDFTypeDTOObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`name`)) {
        RDFTypeDTOObject[['name']] <- self$`name`
      }
      if (!is.null(self$`comment`)) {
        RDFTypeDTOObject[['comment']] <- self$`comment`
      }
      if (!is.null(self$`parent`)) {
        RDFTypeDTOObject[['parent']] <- self$`parent`
      }

      RDFTypeDTOObject
    },
    fromJSON = function(RDFTypeDTOJson) {
      RDFTypeDTOObject <- jsonlite::fromJSON(RDFTypeDTOJson)
      if (!is.null(RDFTypeDTOObject$`uri`)) {
        self$`uri` <- RDFTypeDTOObject$`uri`
      }
      if (!is.null(RDFTypeDTOObject$`name`)) {
        self$`name` <- RDFTypeDTOObject$`name`
      }
      if (!is.null(RDFTypeDTOObject$`comment`)) {
        self$`comment` <- RDFTypeDTOObject$`comment`
      }
      if (!is.null(RDFTypeDTOObject$`parent`)) {
        self$`parent` <- RDFTypeDTOObject$`parent`
      }
    },
    fromJSONObject = function(RDFTypeDTOObject) {
      if (!is.null(RDFTypeDTOObject$`uri`)) {
        self$`uri` <- RDFTypeDTOObject$`uri`
      }
      if (!is.null(RDFTypeDTOObject$`name`)) {
        self$`name` <- RDFTypeDTOObject$`name`
      }
      if (!is.null(RDFTypeDTOObject$`comment`)) {
        self$`comment` <- RDFTypeDTOObject$`comment`
      }
      if (!is.null(RDFTypeDTOObject$`parent`)) {
        self$`parent` <- RDFTypeDTOObject$`parent`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "uri": %s,
           "name": %s,
           "comment": %s,
           "parent": %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"))
      )
    },
    fromJSONString = function(RDFTypeDTOJson) {
      RDFTypeDTOObject <- jsonlite::fromJSON(RDFTypeDTOJson)
      self$`uri` <- RDFTypeDTOObject$`uri`
      self$`name` <- RDFTypeDTOObject$`name`
      self$`comment` <- RDFTypeDTOObject$`comment`
      self$`parent` <- RDFTypeDTOObject$`parent`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.