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


#' ScientificObjectSearchDTO Class
#'
#' @field uris 
#' @field excluded_uris 
#' @field experiment 
#' @field rdf_types 
#' @field name 
#' @field parent 
#' @field germplasm 
#' @field factor_levels 
#' @field facility 
#' @field existence_date 
#' @field creation_date 
#' @field order_by 
#' @field page 
#' @field page_sze 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ScientificObjectSearchDTO <- R6::R6Class(
  'ScientificObjectSearchDTO',
  public = list(
    `uris` = NULL,
    `excluded_uris` = NULL,
    `experiment` = NULL,
    `rdf_types` = NULL,
    `name` = NULL,
    `parent` = NULL,
    `germplasm` = NULL,
    `factor_levels` = NULL,
    `facility` = NULL,
    `existence_date` = NULL,
    `creation_date` = NULL,
    `order_by` = NULL,
    `page` = NULL,
    `page_sze` = NULL,
    initialize = function(`uris`, `excluded_uris`, `experiment`, `rdf_types`, `name`, `parent`, `germplasm`, `factor_levels`, `facility`, `existence_date`, `creation_date`, `order_by`, `page`, `page_sze`){
      if (!missing(`uris`)) {
        stopifnot(is.list(`uris`), length(`uris`) != 0)
        lapply(`uris`, function(x) stopifnot(is.character(x)))
        self$`uris` <- `uris`
      }
      if (!missing(`excluded_uris`)) {
        stopifnot(is.list(`excluded_uris`), length(`excluded_uris`) != 0)
        lapply(`excluded_uris`, function(x) stopifnot(is.character(x)))
        self$`excluded_uris` <- `excluded_uris`
      }
      if (!missing(`experiment`)) {
        stopifnot(is.character(`experiment`), length(`experiment`) == 1)
        self$`experiment` <- `experiment`
      }
      if (!missing(`rdf_types`)) {
        stopifnot(is.list(`rdf_types`), length(`rdf_types`) != 0)
        lapply(`rdf_types`, function(x) stopifnot(is.character(x)))
        self$`rdf_types` <- `rdf_types`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`parent`)) {
        stopifnot(is.character(`parent`), length(`parent`) == 1)
        self$`parent` <- `parent`
      }
      if (!missing(`germplasm`)) {
        stopifnot(is.character(`germplasm`), length(`germplasm`) == 1)
        self$`germplasm` <- `germplasm`
      }
      if (!missing(`factor_levels`)) {
        stopifnot(is.list(`factor_levels`), length(`factor_levels`) != 0)
        lapply(`factor_levels`, function(x) stopifnot(is.character(x)))
        self$`factor_levels` <- `factor_levels`
      }
      if (!missing(`facility`)) {
        stopifnot(is.character(`facility`), length(`facility`) == 1)
        self$`facility` <- `facility`
      }
      if (!missing(`existence_date`)) {
        stopifnot(is.character(`existence_date`), length(`existence_date`) == 1)
        self$`existence_date` <- `existence_date`
      }
      if (!missing(`creation_date`)) {
        stopifnot(is.character(`creation_date`), length(`creation_date`) == 1)
        self$`creation_date` <- `creation_date`
      }
      if (!missing(`order_by`)) {
        stopifnot(is.list(`order_by`), length(`order_by`) != 0)
        lapply(`order_by`, function(x) stopifnot(R6::is.R6(x)))
        self$`order_by` <- `order_by`
      }
      if (!missing(`page`)) {
        stopifnot(is.numeric(`page`), length(`page`) == 1)
        self$`page` <- `page`
      }
      if (!missing(`page_sze`)) {
        stopifnot(is.numeric(`page_sze`), length(`page_sze`) == 1)
        self$`page_sze` <- `page_sze`
      }
    },
    toJSON = function() {
      ScientificObjectSearchDTOObject <- list()
      if (!is.null(self$`uris`)) {
        ScientificObjectSearchDTOObject[['uris']] <- self$`uris`
      }
      if (!is.null(self$`excluded_uris`)) {
        ScientificObjectSearchDTOObject[['excluded_uris']] <- self$`excluded_uris`
      }
      if (!is.null(self$`experiment`)) {
        ScientificObjectSearchDTOObject[['experiment']] <- self$`experiment`
      }
      if (!is.null(self$`rdf_types`)) {
        ScientificObjectSearchDTOObject[['rdf_types']] <- self$`rdf_types`
      }
      if (!is.null(self$`name`)) {
        ScientificObjectSearchDTOObject[['name']] <- self$`name`
      }
      if (!is.null(self$`parent`)) {
        ScientificObjectSearchDTOObject[['parent']] <- self$`parent`
      }
      if (!is.null(self$`germplasm`)) {
        ScientificObjectSearchDTOObject[['germplasm']] <- self$`germplasm`
      }
      if (!is.null(self$`factor_levels`)) {
        ScientificObjectSearchDTOObject[['factor_levels']] <- self$`factor_levels`
      }
      if (!is.null(self$`facility`)) {
        ScientificObjectSearchDTOObject[['facility']] <- self$`facility`
      }
      if (!is.null(self$`existence_date`)) {
        ScientificObjectSearchDTOObject[['existence_date']] <- self$`existence_date`
      }
      if (!is.null(self$`creation_date`)) {
        ScientificObjectSearchDTOObject[['creation_date']] <- self$`creation_date`
      }
      if (!is.null(self$`order_by`)) {
        ScientificObjectSearchDTOObject[['order_by']] <- lapply(self$`order_by`, function(x) x$toJSON())
      }
      if (!is.null(self$`page`)) {
        ScientificObjectSearchDTOObject[['page']] <- self$`page`
      }
      if (!is.null(self$`page_sze`)) {
        ScientificObjectSearchDTOObject[['page_sze']] <- self$`page_sze`
      }

      ScientificObjectSearchDTOObject
    },
    fromJSON = function(ScientificObjectSearchDTOJson) {
      ScientificObjectSearchDTOObject <- jsonlite::fromJSON(ScientificObjectSearchDTOJson)
      if (!is.null(ScientificObjectSearchDTOObject$`uris`)) {
        self$`uris` <- ScientificObjectSearchDTOObject$`uris`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`excluded_uris`)) {
        self$`excluded_uris` <- ScientificObjectSearchDTOObject$`excluded_uris`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`experiment`)) {
        self$`experiment` <- ScientificObjectSearchDTOObject$`experiment`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`rdf_types`)) {
        self$`rdf_types` <- ScientificObjectSearchDTOObject$`rdf_types`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`name`)) {
        self$`name` <- ScientificObjectSearchDTOObject$`name`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`parent`)) {
        self$`parent` <- ScientificObjectSearchDTOObject$`parent`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`germplasm`)) {
        self$`germplasm` <- ScientificObjectSearchDTOObject$`germplasm`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`factor_levels`)) {
        self$`factor_levels` <- ScientificObjectSearchDTOObject$`factor_levels`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`facility`)) {
        self$`facility` <- ScientificObjectSearchDTOObject$`facility`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`existence_date`)) {
        self$`existence_date` <- ScientificObjectSearchDTOObject$`existence_date`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`creation_date`)) {
        self$`creation_date` <- ScientificObjectSearchDTOObject$`creation_date`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`order_by`)) {
        self$`order_by` <- lapply(ScientificObjectSearchDTOObject$`order_by`, function(x) {
          order_byObject <- OrderBy$new()
          order_byObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          order_byObject
        })
      }
      if (!is.null(ScientificObjectSearchDTOObject$`page`)) {
        self$`page` <- ScientificObjectSearchDTOObject$`page`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`page_sze`)) {
        self$`page_sze` <- ScientificObjectSearchDTOObject$`page_sze`
      }
    },
    fromJSONObject = function(ScientificObjectSearchDTOObject) {
      if (!is.null(ScientificObjectSearchDTOObject$`uris`)) {
        self$`uris` <- ScientificObjectSearchDTOObject$`uris`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`excluded_uris`)) {
        self$`excluded_uris` <- ScientificObjectSearchDTOObject$`excluded_uris`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`experiment`)) {
        self$`experiment` <- ScientificObjectSearchDTOObject$`experiment`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`rdf_types`)) {
        self$`rdf_types` <- ScientificObjectSearchDTOObject$`rdf_types`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`name`)) {
        self$`name` <- ScientificObjectSearchDTOObject$`name`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`parent`)) {
        self$`parent` <- ScientificObjectSearchDTOObject$`parent`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`germplasm`)) {
        self$`germplasm` <- ScientificObjectSearchDTOObject$`germplasm`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`factor_levels`)) {
        self$`factor_levels` <- ScientificObjectSearchDTOObject$`factor_levels`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`facility`)) {
        self$`facility` <- ScientificObjectSearchDTOObject$`facility`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`existence_date`)) {
        self$`existence_date` <- ScientificObjectSearchDTOObject$`existence_date`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`creation_date`)) {
        self$`creation_date` <- ScientificObjectSearchDTOObject$`creation_date`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`order_by`)) {
        self$`order_by` <- lapply(ScientificObjectSearchDTOObject$`order_by`, function(x) {
          order_byObject <- OrderBy$new()
          order_byObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          order_byObject
        })
      }
      if (!is.null(ScientificObjectSearchDTOObject$`page`)) {
        self$`page` <- ScientificObjectSearchDTOObject$`page`
      }
      if (!is.null(ScientificObjectSearchDTOObject$`page_sze`)) {
        self$`page_sze` <- ScientificObjectSearchDTOObject$`page_sze`
      }
    },
    toJSONString = function() {
      order_byList = paste(lapply(self$`order_by`, function(x) x$toJSONString()),collapse = ",")
       sprintf(
        '{
           "uris": [%s],
           "excluded_uris": [%s],
           "experiment": %s,
           "rdf_types": [%s],
           "name": %s,
           "parent": %s,
           "germplasm": %s,
           "factor_levels": [%s],
           "facility": %s,
           "existence_date": %s,
           "creation_date": %s,
           "order_by": [%s],
           "page": %s,
           "page_sze": %s
        }',
        ifelse(is.null(self$`uris`) || length(self$`uris`) == 0, "" ,lapply(self$`uris`, function(x) paste(paste0('"', x, '"'), sep=","))),
        ifelse(is.null(self$`excluded_uris`) || length(self$`excluded_uris`) == 0, "" ,lapply(self$`excluded_uris`, function(x) paste(paste0('"', x, '"'), sep=","))),
        ifelse(is.null(self$`experiment`), "null",jsonlite::toJSON(self$`experiment`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`rdf_types`) || length(self$`rdf_types`) == 0, "" ,lapply(self$`rdf_types`, function(x) paste(paste0('"', x, '"'), sep=","))),
        ifelse(is.null(self$`name`), "null",jsonlite::toJSON(self$`name`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`parent`), "null",jsonlite::toJSON(self$`parent`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`germplasm`), "null",jsonlite::toJSON(self$`germplasm`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`factor_levels`) || length(self$`factor_levels`) == 0, "" ,lapply(self$`factor_levels`, function(x) paste(paste0('"', x, '"'), sep=","))),
        ifelse(is.null(self$`facility`), "null",jsonlite::toJSON(self$`facility`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`existence_date`), "null",jsonlite::toJSON(self$`existence_date`,auto_unbox=TRUE, null = "null")),
        ifelse(is.null(self$`creation_date`), "null",jsonlite::toJSON(self$`creation_date`,auto_unbox=TRUE, null = "null")),
        order_byList,
        ifelse(is.null(self$`page`), "null",as.numeric(jsonlite::toJSON(self$`page`,auto_unbox=TRUE, null = "null"))),
        ifelse(is.null(self$`page_sze`), "null",as.numeric(jsonlite::toJSON(self$`page_sze`,auto_unbox=TRUE, null = "null")))
      )
    },
    fromJSONString = function(ScientificObjectSearchDTOJson) {
      ScientificObjectSearchDTOObject <- jsonlite::fromJSON(ScientificObjectSearchDTOJson)
      self$`uris` <- ScientificObjectSearchDTOObject$`uris`
      self$`excluded_uris` <- ScientificObjectSearchDTOObject$`excluded_uris`
      self$`experiment` <- ScientificObjectSearchDTOObject$`experiment`
      self$`rdf_types` <- ScientificObjectSearchDTOObject$`rdf_types`
      self$`name` <- ScientificObjectSearchDTOObject$`name`
      self$`parent` <- ScientificObjectSearchDTOObject$`parent`
      self$`germplasm` <- ScientificObjectSearchDTOObject$`germplasm`
      self$`factor_levels` <- ScientificObjectSearchDTOObject$`factor_levels`
      self$`facility` <- ScientificObjectSearchDTOObject$`facility`
      self$`existence_date` <- ScientificObjectSearchDTOObject$`existence_date`
      self$`creation_date` <- ScientificObjectSearchDTOObject$`creation_date`
      self$`order_by` <- lapply(ScientificObjectSearchDTOObject$`order_by`, function(x) OrderBy$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`page` <- ScientificObjectSearchDTOObject$`page`
      self$`page_sze` <- ScientificObjectSearchDTOObject$`page_sze`
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.