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


#' AgentModel Class
#'
#' @field uri 
#' @field rdf_type 
#' @field settings 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
AgentModel <- R6::R6Class(
  'AgentModel',
  public = list(
    `uri` = NULL,
    `rdf_type` = NULL,
    `settings` = NULL,
    initialize = function(`uri`, `rdf_type`, `settings`){
      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(`settings`)) {
        stopifnot(R6::is.R6(`settings`))
        self$`settings` <- `settings`
      }
    },
    toJSON = function() {
      AgentModelObject <- list()
      if (!is.null(self$`uri`)) {
        AgentModelObject[['uri']] <- self$`uri`
      }
      if (!is.null(self$`rdf_type`)) {
        AgentModelObject[['rdf_type']] <- self$`rdf_type`
      }
      if (!is.null(self$`settings`)) {
        AgentModelObject[['settings']] <- self$`settings`$toJSON()
      }

      AgentModelObject
    },
    fromJSON = function(AgentModelJson) {
      AgentModelObject <- jsonlite::fromJSON(AgentModelJson)
      if (!is.null(AgentModelObject$`uri`)) {
        self$`uri` <- AgentModelObject$`uri`
      }
      if (!is.null(AgentModelObject$`rdf_type`)) {
        self$`rdf_type` <- AgentModelObject$`rdf_type`
      }
      if (!is.null(AgentModelObject$`settings`)) {
        settingsObject <- ObjectDTO$new()
        settingsObject$fromJSON(jsonlite::toJSON(AgentModelObject$settings, auto_unbox = TRUE, null = "null"))
        self$`settings` <- settingsObject
      }
    },
    fromJSONObject = function(AgentModelObject) {
      if (!is.null(AgentModelObject$`uri`)) {
        self$`uri` <- AgentModelObject$`uri`
      }
      if (!is.null(AgentModelObject$`rdf_type`)) {
        self$`rdf_type` <- AgentModelObject$`rdf_type`
      }
      if (!is.null(AgentModelObject$`settings`)) {
        settingsObject <- ObjectDTO$new()
        settingsObject$fromJSON(jsonlite::toJSON(AgentModelObject$settings, auto_unbox = TRUE, null = "null"))
        self$`settings` <- settingsObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "uri": %s,
           "rdf_type": %s,
           "settings": %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")),
        jsonlite::toJSON(self$`settings`$toJSON(),auto_unbox=TRUE, null = "null")
      )
    },
    fromJSONString = function(AgentModelJson) {
      AgentModelObject <- jsonlite::fromJSON(AgentModelJson)
      self$`uri` <- AgentModelObject$`uri`
      self$`rdf_type` <- AgentModelObject$`rdf_type`
      ObjectDTOObject <- ObjectDTO$new()
      self$`settings` <- ObjectDTOObject$fromJSON(jsonlite::toJSON(AgentModelObject$settings, auto_unbox = TRUE))
    }
  )
)
OpenSILEX/opensilexClientToolsR documentation built on Jan. 28, 2022, 5:03 a.m.