R/SystemAuthConfigServer.r

# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' SystemAuthConfigServer Class
#'
#' 
#'
#' @field endpoint The hostname or ip address of the remote server.
#' @field port The port number of the remote server..
#' @field protocol 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SystemAuthConfigServer <- R6::R6Class(
  'SystemAuthConfigServer',
  public = list(
    `endpoint` = NULL,
    `port` = NULL,
    `protocol` = NULL,
    initialize = function(`endpoint`, `port`, `protocol`){
      if (!missing(`endpoint`)) {
        stopifnot(is.character(`endpoint`), length(`endpoint`) == 1)
        self$`endpoint` <- `endpoint`
      }
      if (!missing(`port`)) {
        stopifnot(is.numeric(`port`), length(`port`) == 1)
        self$`port` <- `port`
      }
      if (!missing(`protocol`)) {
        stopifnot(R6::is.R6(`protocol`))
        self$`protocol` <- `protocol`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      SystemAuthConfigServerObject <- list()
      if (!is.null(self$`endpoint`)) {
        SystemAuthConfigServerObject[['endpoint']] <- self$`endpoint`
      }
      else {
        SystemAuthConfigServerObject[['endpoint']] <- NULL
      }
      if (!is.null(self$`port`)) {
        SystemAuthConfigServerObject[['port']] <- self$`port`
      }
      else {
        SystemAuthConfigServerObject[['port']] <- NULL
      }
      if (!is.null(self$`protocol`)) {
        SystemAuthConfigServerObject[['protocol']] <- self$`protocol`$toJSON()
      }
      else {
        SystemAuthConfigServerObject[['protocol']] <- NULL
      }

      SystemAuthConfigServerObject
    },
    fromJSON = function(SystemAuthConfigServerObject) {
      if (is.character(SystemAuthConfigServerObject)) {
        SystemAuthConfigServerObject <- jsonlite::fromJSON(SystemAuthConfigServerJson)
      }

      if ("result" %in% names(SystemAuthConfigServerObject)) {
        SystemAuthConfigServerObject <- SystemAuthConfigServerObject$result
      }

      if (!is.null(SystemAuthConfigServerObject$`endpoint`)) {
        self$`endpoint` <- SystemAuthConfigServerObject$`endpoint`
      }
      if (!is.null(SystemAuthConfigServerObject$`port`)) {
        self$`port` <- SystemAuthConfigServerObject$`port`
      }
      if (!is.null(SystemAuthConfigServerObject$`protocol`)) {
        protocolObject <- SystemAuthConfigServerProtocolType$new()
        protocolObject$fromJSON(jsonlite::toJSON(SystemAuthConfigServerObject$protocol, auto_unbox = TRUE))
        self$`protocol` <- protocolObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "endpoint": %s,
           "port": %d,
           "protocol": %s
        }',
        ifelse( is.null(self$`endpoint`),"null",paste0(c('"', self$`endpoint`, '"'))),
        ifelse( is.null(self$`port`),"null",paste0(c('"', self$`port`, '"'))),
        self$`protocol`$toJSON()
      )
    },
    fromJSONString = function(SystemAuthConfigServerJson) {
      SystemAuthConfigServerObject <- jsonlite::fromJSON(SystemAuthConfigServerJson)
      self::fromJSON(SystemAuthConfigServerObject)

    }
  )
)
deardooley/agave-rlang-sdk documentation built on May 17, 2019, 10:12 p.m.