R/DocumentMetadataDTO.r

# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' DocumentMetadataDTO Class
#'
#' @field uri 
#' @field documentType 
#' @field checksum 
#' @field creator 
#' @field language 
#' @field title 
#' @field creationDate 
#' @field extension 
#' @field comment 
#' @field concernedItems 
#' @field status 
#' @field serverFilePath 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
DocumentMetadataDTO <- R6::R6Class(
  'DocumentMetadataDTO',
  public = list(
    `uri` = NULL,
    `documentType` = NULL,
    `checksum` = NULL,
    `creator` = NULL,
    `language` = NULL,
    `title` = NULL,
    `creationDate` = NULL,
    `extension` = NULL,
    `comment` = NULL,
    `concernedItems` = NULL,
    `status` = NULL,
    `serverFilePath` = NULL,
    initialize = function(`uri`, `documentType`, `checksum`, `creator`, `language`, `title`, `creationDate`, `extension`, `comment`, `concernedItems`, `status`, `serverFilePath`){
      if (!missing(`uri`)) {
        stopifnot(is.character(`uri`), length(`uri`) == 1)
        self$`uri` <- `uri`
      }
      if (!missing(`documentType`)) {
        stopifnot(is.character(`documentType`), length(`documentType`) == 1)
        self$`documentType` <- `documentType`
      }
      if (!missing(`checksum`)) {
        stopifnot(is.character(`checksum`), length(`checksum`) == 1)
        self$`checksum` <- `checksum`
      }
      if (!missing(`creator`)) {
        stopifnot(is.character(`creator`), length(`creator`) == 1)
        self$`creator` <- `creator`
      }
      if (!missing(`language`)) {
        stopifnot(is.character(`language`), length(`language`) == 1)
        self$`language` <- `language`
      }
      if (!missing(`title`)) {
        stopifnot(is.character(`title`), length(`title`) == 1)
        self$`title` <- `title`
      }
      if (!missing(`creationDate`)) {
        stopifnot(is.character(`creationDate`), length(`creationDate`) == 1)
        self$`creationDate` <- `creationDate`
      }
      if (!missing(`extension`)) {
        stopifnot(is.character(`extension`), length(`extension`) == 1)
        self$`extension` <- `extension`
      }
      if (!missing(`comment`)) {
        stopifnot(is.character(`comment`), length(`comment`) == 1)
        self$`comment` <- `comment`
      }
      if (!missing(`concernedItems`)) {
        stopifnot(is.list(`concernedItems`), length(`concernedItems`) != 0)
        lapply(`concernedItems`, function(x) stopifnot(R6::is.R6(x)))
        self$`concernedItems` <- `concernedItems`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
      if (!missing(`serverFilePath`)) {
        stopifnot(is.character(`serverFilePath`), length(`serverFilePath`) == 1)
        self$`serverFilePath` <- `serverFilePath`
      }
    },
    toJSON = function() {
      DocumentMetadataDTOObject <- list()
      if (!is.null(self$`uri`)) {
        DocumentMetadataDTOObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`documentType`)) {
        DocumentMetadataDTOObject[['documentType']] <- self$`documentType`
      }
      if (!is.null(self$`checksum`)) {
        DocumentMetadataDTOObject[['checksum']] <- self$`checksum`
      }
      if (!is.null(self$`creator`)) {
        DocumentMetadataDTOObject[['creator']] <- self$`creator`
      }
      if (!is.null(self$`language`)) {
        DocumentMetadataDTOObject[['language']] <- self$`language`
      }
      if (!is.null(self$`title`)) {
        DocumentMetadataDTOObject[['title']] <- self$`title`
      }
      if (!is.null(self$`creationDate`)) {
        DocumentMetadataDTOObject[['creationDate']] <- self$`creationDate`
      }
      if (!is.null(self$`extension`)) {
        DocumentMetadataDTOObject[['extension']] <- self$`extension`
      }
      if (!is.null(self$`comment`)) {
        DocumentMetadataDTOObject[['comment']] <- self$`comment`
      }
      if (!is.null(self$`concernedItems`)) {
        DocumentMetadataDTOObject[['concernedItems']] <- lapply(self$`concernedItems`, function(x) x$toJSON())
      }
      if (!is.null(self$`status`)) {
        DocumentMetadataDTOObject[['status']] <- self$`status`
      }
      if (!is.null(self$`serverFilePath`)) {
        DocumentMetadataDTOObject[['serverFilePath']] <- self$`serverFilePath`
      }

      DocumentMetadataDTOObject
    },
    fromJSON = function(DocumentMetadataDTOJson) {
      DocumentMetadataDTOObject <- jsonlite::fromJSON(DocumentMetadataDTOJson)
      if (!is.null(DocumentMetadataDTOObject$`uri`)) {
        self$`uri` <- DocumentMetadataDTOObject$`uri`
      }
      if (!is.null(DocumentMetadataDTOObject$`documentType`)) {
        self$`documentType` <- DocumentMetadataDTOObject$`documentType`
      }
      if (!is.null(DocumentMetadataDTOObject$`checksum`)) {
        self$`checksum` <- DocumentMetadataDTOObject$`checksum`
      }
      if (!is.null(DocumentMetadataDTOObject$`creator`)) {
        self$`creator` <- DocumentMetadataDTOObject$`creator`
      }
      if (!is.null(DocumentMetadataDTOObject$`language`)) {
        self$`language` <- DocumentMetadataDTOObject$`language`
      }
      if (!is.null(DocumentMetadataDTOObject$`title`)) {
        self$`title` <- DocumentMetadataDTOObject$`title`
      }
      if (!is.null(DocumentMetadataDTOObject$`creationDate`)) {
        self$`creationDate` <- DocumentMetadataDTOObject$`creationDate`
      }
      if (!is.null(DocumentMetadataDTOObject$`extension`)) {
        self$`extension` <- DocumentMetadataDTOObject$`extension`
      }
      if (!is.null(DocumentMetadataDTOObject$`comment`)) {
        self$`comment` <- DocumentMetadataDTOObject$`comment`
      }
      if (!is.null(DocumentMetadataDTOObject$`concernedItems`)) {
        self$`concernedItems` <- lapply(DocumentMetadataDTOObject$`concernedItems`, function(x) {
          concernedItemsObject <- ConcernedItemDTO$new()
          concernedItemsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          concernedItemsObject
        })
      }
      if (!is.null(DocumentMetadataDTOObject$`status`)) {
        self$`status` <- DocumentMetadataDTOObject$`status`
      }
      if (!is.null(DocumentMetadataDTOObject$`serverFilePath`)) {
        self$`serverFilePath` <- DocumentMetadataDTOObject$`serverFilePath`
      }
    },
    fromJSONObject = function(DocumentMetadataDTOObject) {
      if (!is.null(DocumentMetadataDTOObject$`uri`)) {
        self$`uri` <- DocumentMetadataDTOObject$`uri`
      }
      if (!is.null(DocumentMetadataDTOObject$`documentType`)) {
        self$`documentType` <- DocumentMetadataDTOObject$`documentType`
      }
      if (!is.null(DocumentMetadataDTOObject$`checksum`)) {
        self$`checksum` <- DocumentMetadataDTOObject$`checksum`
      }
      if (!is.null(DocumentMetadataDTOObject$`creator`)) {
        self$`creator` <- DocumentMetadataDTOObject$`creator`
      }
      if (!is.null(DocumentMetadataDTOObject$`language`)) {
        self$`language` <- DocumentMetadataDTOObject$`language`
      }
      if (!is.null(DocumentMetadataDTOObject$`title`)) {
        self$`title` <- DocumentMetadataDTOObject$`title`
      }
      if (!is.null(DocumentMetadataDTOObject$`creationDate`)) {
        self$`creationDate` <- DocumentMetadataDTOObject$`creationDate`
      }
      if (!is.null(DocumentMetadataDTOObject$`extension`)) {
        self$`extension` <- DocumentMetadataDTOObject$`extension`
      }
      if (!is.null(DocumentMetadataDTOObject$`comment`)) {
        self$`comment` <- DocumentMetadataDTOObject$`comment`
      }
      if (!is.null(DocumentMetadataDTOObject$`concernedItems`)) {
        self$`concernedItems` <- lapply(DocumentMetadataDTOObject$`concernedItems`, function(x) {
          concernedItemsObject <- ConcernedItemDTO$new()
          concernedItemsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE, null = "null"))
          concernedItemsObject
        })
      }
      if (!is.null(DocumentMetadataDTOObject$`status`)) {
        self$`status` <- DocumentMetadataDTOObject$`status`
      }
      if (!is.null(DocumentMetadataDTOObject$`serverFilePath`)) {
        self$`serverFilePath` <- DocumentMetadataDTOObject$`serverFilePath`
      }
    },
    toJSONString = function() {
      concernedItemsList = paste(lapply(self$`concernedItems`, function(x) x$toJSONString()),collapse = ",")
       sprintf(
        '{
           "uri": %s,
           "documentType": %s,
           "checksum": %s,
           "creator": %s,
           "language": %s,
           "title": %s,
           "creationDate": %s,
           "extension": %s,
           "comment": %s,
           "concernedItems": [%s],
           "status": %s,
           "serverFilePath": %s
        }',
        jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`documentType`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`checksum`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`creator`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`language`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`title`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`creationDate`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`extension`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`comment`,auto_unbox=TRUE, null = "null"),
        concernedItemsList,
        jsonlite::toJSON(self$`status`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`serverFilePath`,auto_unbox=TRUE, null = "null")
      )
    },
    fromJSONString = function(DocumentMetadataDTOJson) {
      DocumentMetadataDTOObject <- jsonlite::fromJSON(DocumentMetadataDTOJson)
      self$`uri` <- DocumentMetadataDTOObject$`uri`
      self$`documentType` <- DocumentMetadataDTOObject$`documentType`
      self$`checksum` <- DocumentMetadataDTOObject$`checksum`
      self$`creator` <- DocumentMetadataDTOObject$`creator`
      self$`language` <- DocumentMetadataDTOObject$`language`
      self$`title` <- DocumentMetadataDTOObject$`title`
      self$`creationDate` <- DocumentMetadataDTOObject$`creationDate`
      self$`extension` <- DocumentMetadataDTOObject$`extension`
      self$`comment` <- DocumentMetadataDTOObject$`comment`
      self$`concernedItems` <- lapply(DocumentMetadataDTOObject$`concernedItems`, function(x) ConcernedItemDTO$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)))
      self$`status` <- DocumentMetadataDTOObject$`status`
      self$`serverFilePath` <- DocumentMetadataDTOObject$`serverFilePath`
    }
  )
)
OpenSILEX/phis-ws-client-r-tool documentation built on Sept. 10, 2020, 8:42 a.m.