R/TripletDTO.r

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


#' TripletDTO Class
#'
#' @field s 
#' @field p 
#' @field o 
#' @field o_type 
#' @field o_lang 
#' @field g 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TripletDTO <- R6::R6Class(
  'TripletDTO',
  public = list(
    `s` = NULL,
    `p` = NULL,
    `o` = NULL,
    `o_type` = NULL,
    `o_lang` = NULL,
    `g` = NULL,
    initialize = function(`s`, `p`, `o`, `o_type`, `o_lang`, `g`){
      if (!missing(`s`)) {
        stopifnot(is.character(`s`), length(`s`) == 1)
        self$`s` <- `s`
      }
      if (!missing(`p`)) {
        stopifnot(is.character(`p`), length(`p`) == 1)
        self$`p` <- `p`
      }
      if (!missing(`o`)) {
        stopifnot(is.character(`o`), length(`o`) == 1)
        self$`o` <- `o`
      }
      if (!missing(`o_type`)) {
        stopifnot(is.character(`o_type`), length(`o_type`) == 1)
        self$`o_type` <- `o_type`
      }
      if (!missing(`o_lang`)) {
        stopifnot(is.character(`o_lang`), length(`o_lang`) == 1)
        self$`o_lang` <- `o_lang`
      }
      if (!missing(`g`)) {
        stopifnot(is.character(`g`), length(`g`) == 1)
        self$`g` <- `g`
      }
    },
    toJSON = function() {
      TripletDTOObject <- list()
      if (!is.null(self$`s`)) {
        TripletDTOObject[['s']] <- self$`s`
      }
      if (!is.null(self$`p`)) {
        TripletDTOObject[['p']] <- self$`p`
      }
      if (!is.null(self$`o`)) {
        TripletDTOObject[['o']] <- self$`o`
      }
      if (!is.null(self$`o_type`)) {
        TripletDTOObject[['o_type']] <- self$`o_type`
      }
      if (!is.null(self$`o_lang`)) {
        TripletDTOObject[['o_lang']] <- self$`o_lang`
      }
      if (!is.null(self$`g`)) {
        TripletDTOObject[['g']] <- self$`g`
      }

      TripletDTOObject
    },
    fromJSON = function(TripletDTOJson) {
      TripletDTOObject <- jsonlite::fromJSON(TripletDTOJson)
      if (!is.null(TripletDTOObject$`s`)) {
        self$`s` <- TripletDTOObject$`s`
      }
      if (!is.null(TripletDTOObject$`p`)) {
        self$`p` <- TripletDTOObject$`p`
      }
      if (!is.null(TripletDTOObject$`o`)) {
        self$`o` <- TripletDTOObject$`o`
      }
      if (!is.null(TripletDTOObject$`o_type`)) {
        self$`o_type` <- TripletDTOObject$`o_type`
      }
      if (!is.null(TripletDTOObject$`o_lang`)) {
        self$`o_lang` <- TripletDTOObject$`o_lang`
      }
      if (!is.null(TripletDTOObject$`g`)) {
        self$`g` <- TripletDTOObject$`g`
      }
    },
    fromJSONObject = function(TripletDTOObject) {
      if (!is.null(TripletDTOObject$`s`)) {
        self$`s` <- TripletDTOObject$`s`
      }
      if (!is.null(TripletDTOObject$`p`)) {
        self$`p` <- TripletDTOObject$`p`
      }
      if (!is.null(TripletDTOObject$`o`)) {
        self$`o` <- TripletDTOObject$`o`
      }
      if (!is.null(TripletDTOObject$`o_type`)) {
        self$`o_type` <- TripletDTOObject$`o_type`
      }
      if (!is.null(TripletDTOObject$`o_lang`)) {
        self$`o_lang` <- TripletDTOObject$`o_lang`
      }
      if (!is.null(TripletDTOObject$`g`)) {
        self$`g` <- TripletDTOObject$`g`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "s": %s,
           "p": %s,
           "o": %s,
           "o_type": %s,
           "o_lang": %s,
           "g": %s
        }',
        jsonlite::toJSON(self$`s`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`p`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`o`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`o_type`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`o_lang`,auto_unbox=TRUE, null = "null"),
        jsonlite::toJSON(self$`g`,auto_unbox=TRUE, null = "null")
      )
    },
    fromJSONString = function(TripletDTOJson) {
      TripletDTOObject <- jsonlite::fromJSON(TripletDTOJson)
      self$`s` <- TripletDTOObject$`s`
      self$`p` <- TripletDTOObject$`p`
      self$`o` <- TripletDTOObject$`o`
      self$`o_type` <- TripletDTOObject$`o_type`
      self$`o_lang` <- TripletDTOObject$`o_lang`
      self$`g` <- TripletDTOObject$`g`
    }
  )
)
OpenSILEX/phis-ws-client-r-tool documentation built on Sept. 10, 2020, 8:42 a.m.