R/ConcernedItemWithLabelsDTO.r

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


#' ConcernedItemWithLabelsDTO Class
#'
#' @field uri 
#' @field typeURI 
#' @field labels 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ConcernedItemWithLabelsDTO <- R6::R6Class(
  'ConcernedItemWithLabelsDTO',
  public = list(
    `uri` = NULL,
    `typeURI` = NULL,
    `labels` = NULL,
    initialize = function(`uri`, `typeURI`, `labels`){
      if (!missing(`uri`)) {
        stopifnot(is.character(`uri`), length(`uri`) == 1)
        self$`uri` <- `uri`
      }
      if (!missing(`typeURI`)) {
        stopifnot(is.character(`typeURI`), length(`typeURI`) == 1)
        self$`typeURI` <- `typeURI`
      }
      if (!missing(`labels`)) {
        stopifnot(is.list(`labels`), length(`labels`) != 0)
        lapply(`labels`, function(x) stopifnot(is.character(x)))
        self$`labels` <- `labels`
      }
    },
    toJSON = function() {
      ConcernedItemWithLabelsDTOObject <- list()
      if (!is.null(self$`uri`)) {
        ConcernedItemWithLabelsDTOObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`typeURI`)) {
        ConcernedItemWithLabelsDTOObject[['typeURI']] <- self$`typeURI`
      }
      if (!is.null(self$`labels`)) {
        ConcernedItemWithLabelsDTOObject[['labels']] <- self$`labels`
      }

      ConcernedItemWithLabelsDTOObject
    },
    fromJSON = function(ConcernedItemWithLabelsDTOJson) {
      ConcernedItemWithLabelsDTOObject <- jsonlite::fromJSON(ConcernedItemWithLabelsDTOJson)
      if (!is.null(ConcernedItemWithLabelsDTOObject$`uri`)) {
        self$`uri` <- ConcernedItemWithLabelsDTOObject$`uri`
      }
      if (!is.null(ConcernedItemWithLabelsDTOObject$`typeURI`)) {
        self$`typeURI` <- ConcernedItemWithLabelsDTOObject$`typeURI`
      }
      if (!is.null(ConcernedItemWithLabelsDTOObject$`labels`)) {
        self$`labels` <- ConcernedItemWithLabelsDTOObject$`labels`
      }
    },
    fromJSONObject = function(ConcernedItemWithLabelsDTOObject) {
      if (!is.null(ConcernedItemWithLabelsDTOObject$`uri`)) {
        self$`uri` <- ConcernedItemWithLabelsDTOObject$`uri`
      }
      if (!is.null(ConcernedItemWithLabelsDTOObject$`typeURI`)) {
        self$`typeURI` <- ConcernedItemWithLabelsDTOObject$`typeURI`
      }
      if (!is.null(ConcernedItemWithLabelsDTOObject$`labels`)) {
        self$`labels` <- ConcernedItemWithLabelsDTOObject$`labels`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "uri": %s,
           "typeURI": %s,
           "labels": [%s]
        }',
        jsonlite::toJSON(self$`uri`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`typeURI`,auto_unbox=TRUE, null = "null"),
        lapply(self$`labels`, function(x) paste(paste0('"', x, '"'), sep=","))
      )
    },
    fromJSONString = function(ConcernedItemWithLabelsDTOJson) {
      ConcernedItemWithLabelsDTOObject <- jsonlite::fromJSON(ConcernedItemWithLabelsDTOJson)
      self$`uri` <- ConcernedItemWithLabelsDTOObject$`uri`
      self$`typeURI` <- ConcernedItemWithLabelsDTOObject$`typeURI`
      self$`labels` <- ConcernedItemWithLabelsDTOObject$`labels`
    }
  )
)
OpenSILEX/phis-ws-client-r-tool documentation built on Sept. 10, 2020, 8:42 a.m.