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


#' InfrastructureCreationDTO Class
#'
#' @field uri 
#' @field rdf_type 
#' @field rdf_type_name 
#' @field name 
#' @field parents 
#' @field groups 
#' @field facilities 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InfrastructureCreationDTO <- R6::R6Class(
  'InfrastructureCreationDTO',
  public = list(
    `uri` = NULL,
    `rdf_type` = NULL,
    `rdf_type_name` = NULL,
    `name` = NULL,
    `parents` = NULL,
    `groups` = NULL,
    `facilities` = NULL,
    initialize = function(`uri`, `rdf_type`, `rdf_type_name`, `name`, `parents`, `groups`, `facilities`){
      if (!missing(`uri`)) {
        stopifnot(is.character(`uri`), length(`uri`) == 1)
        self$`uri` <- `uri`
      }
      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(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`parents`)) {
        stopifnot(is.list(`parents`), length(`parents`) != 0)
        lapply(`parents`, function(x) stopifnot(is.character(x)))
        self$`parents` <- `parents`
      }
      if (!missing(`groups`)) {
        stopifnot(is.list(`groups`), length(`groups`) != 0)
        lapply(`groups`, function(x) stopifnot(is.character(x)))
        self$`groups` <- `groups`
      }
      if (!missing(`facilities`)) {
        stopifnot(is.list(`facilities`), length(`facilities`) != 0)
        lapply(`facilities`, function(x) stopifnot(is.character(x)))
        self$`facilities` <- `facilities`
      }
    },
    toJSON = function() {
      InfrastructureCreationDTOObject <- list()
      if (!is.null(self$`uri`)) {
        InfrastructureCreationDTOObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`rdf_type`)) {
        InfrastructureCreationDTOObject[['rdf_type']] <- self$`rdf_type`
      }
      if (!is.null(self$`rdf_type_name`)) {
        InfrastructureCreationDTOObject[['rdf_type_name']] <- self$`rdf_type_name`
      }
      if (!is.null(self$`name`)) {
        InfrastructureCreationDTOObject[['name']] <- self$`name`
      }
      if (!is.null(self$`parents`)) {
        InfrastructureCreationDTOObject[['parents']] <- self$`parents`
      }
      if (!is.null(self$`groups`)) {
        InfrastructureCreationDTOObject[['groups']] <- self$`groups`
      }
      if (!is.null(self$`facilities`)) {
        InfrastructureCreationDTOObject[['facilities']] <- self$`facilities`
      }

      InfrastructureCreationDTOObject
    },
    fromJSON = function(InfrastructureCreationDTOJson) {
      InfrastructureCreationDTOObject <- jsonlite::fromJSON(InfrastructureCreationDTOJson)
      if (!is.null(InfrastructureCreationDTOObject$`uri`)) {
        self$`uri` <- InfrastructureCreationDTOObject$`uri`
      }
      if (!is.null(InfrastructureCreationDTOObject$`rdf_type`)) {
        self$`rdf_type` <- InfrastructureCreationDTOObject$`rdf_type`
      }
      if (!is.null(InfrastructureCreationDTOObject$`rdf_type_name`)) {
        self$`rdf_type_name` <- InfrastructureCreationDTOObject$`rdf_type_name`
      }
      if (!is.null(InfrastructureCreationDTOObject$`name`)) {
        self$`name` <- InfrastructureCreationDTOObject$`name`
      }
      if (!is.null(InfrastructureCreationDTOObject$`parents`)) {
        self$`parents` <- InfrastructureCreationDTOObject$`parents`
      }
      if (!is.null(InfrastructureCreationDTOObject$`groups`)) {
        self$`groups` <- InfrastructureCreationDTOObject$`groups`
      }
      if (!is.null(InfrastructureCreationDTOObject$`facilities`)) {
        self$`facilities` <- InfrastructureCreationDTOObject$`facilities`
      }
    },
    fromJSONObject = function(InfrastructureCreationDTOObject) {
      if (!is.null(InfrastructureCreationDTOObject$`uri`)) {
        self$`uri` <- InfrastructureCreationDTOObject$`uri`
      }
      if (!is.null(InfrastructureCreationDTOObject$`rdf_type`)) {
        self$`rdf_type` <- InfrastructureCreationDTOObject$`rdf_type`
      }
      if (!is.null(InfrastructureCreationDTOObject$`rdf_type_name`)) {
        self$`rdf_type_name` <- InfrastructureCreationDTOObject$`rdf_type_name`
      }
      if (!is.null(InfrastructureCreationDTOObject$`name`)) {
        self$`name` <- InfrastructureCreationDTOObject$`name`
      }
      if (!is.null(InfrastructureCreationDTOObject$`parents`)) {
        self$`parents` <- InfrastructureCreationDTOObject$`parents`
      }
      if (!is.null(InfrastructureCreationDTOObject$`groups`)) {
        self$`groups` <- InfrastructureCreationDTOObject$`groups`
      }
      if (!is.null(InfrastructureCreationDTOObject$`facilities`)) {
        self$`facilities` <- InfrastructureCreationDTOObject$`facilities`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "uri": %s,
           "rdf_type": %s,
           "rdf_type_name": %s,
           "name": %s,
           "parents": [%s],
           "groups": [%s],
           "facilities": [%s]
        }',
        ifelse(is.null(self$`uri`), "null",jsonlite::toJSON(self$`uri`,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$`name`), "null",jsonlite::toJSON(self$`name`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`parents`) || length(self$`parents`) == 0, "" ,lapply(self$`parents`, function(x) paste(paste0('"', x, '"'), sep=","))),
        ifelse(is.null(self$`groups`) || length(self$`groups`) == 0, "" ,lapply(self$`groups`, function(x) paste(paste0('"', x, '"'), sep=","))),
        ifelse(is.null(self$`facilities`) || length(self$`facilities`) == 0, "" ,lapply(self$`facilities`, function(x) paste(paste0('"', x, '"'), sep=",")))
      )
    },
    fromJSONString = function(InfrastructureCreationDTOJson) {
      InfrastructureCreationDTOObject <- jsonlite::fromJSON(InfrastructureCreationDTOJson)
      self$`uri` <- InfrastructureCreationDTOObject$`uri`
      self$`rdf_type` <- InfrastructureCreationDTOObject$`rdf_type`
      self$`rdf_type_name` <- InfrastructureCreationDTOObject$`rdf_type_name`
      self$`name` <- InfrastructureCreationDTOObject$`name`
      self$`parents` <- InfrastructureCreationDTOObject$`parents`
      self$`groups` <- InfrastructureCreationDTOObject$`groups`
      self$`facilities` <- InfrastructureCreationDTOObject$`facilities`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.