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


#' SystemLoginConfig Class
#'
#' 
#'
#' @field auth 
#' @field host The hostname or ip address of the submission server
#' @field port The port number of the submission server.
#' @field protocol 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SystemLoginConfig <- R6::R6Class(
  'SystemLoginConfig',
  public = list(
    `auth` = NULL,
    `host` = NULL,
    `port` = NULL,
    `protocol` = NULL,
    initialize = function(`auth`, `host`, `port`, `protocol`){
      if (!missing(`auth`)) {
        stopifnot(R6::is.R6(`auth`))
        self$`auth` <- `auth`
      }
      if (!missing(`host`)) {
        stopifnot(is.character(`host`), length(`host`) == 1)
        self$`host` <- `host`
      }
      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() {
      SystemLoginConfigObject <- list()
      if (!is.null(self$`auth`)) {
        SystemLoginConfigObject[['auth']] <- self$`auth`$toJSON()
      }
      else {
        SystemLoginConfigObject[['auth']] <- NULL
      }
      if (!is.null(self$`host`)) {
        SystemLoginConfigObject[['host']] <- self$`host`
      }
      else {
        SystemLoginConfigObject[['host']] <- NULL
      }
      if (!is.null(self$`port`)) {
        SystemLoginConfigObject[['port']] <- self$`port`
      }
      else {
        SystemLoginConfigObject[['port']] <- NULL
      }
      if (!is.null(self$`protocol`)) {
        SystemLoginConfigObject[['protocol']] <- self$`protocol`$toJSON()
      }
      else {
        SystemLoginConfigObject[['protocol']] <- NULL
      }

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

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

      if (!is.null(SystemLoginConfigObject$`auth`)) {
        authObject <- SystemAuthConfig$new()
        authObject$fromJSON(jsonlite::toJSON(SystemLoginConfigObject$auth, auto_unbox = TRUE))
        self$`auth` <- authObject
      }
      if (!is.null(SystemLoginConfigObject$`host`)) {
        self$`host` <- SystemLoginConfigObject$`host`
      }
      if (!is.null(SystemLoginConfigObject$`port`)) {
        self$`port` <- SystemLoginConfigObject$`port`
      }
      if (!is.null(SystemLoginConfigObject$`protocol`)) {
        protocolObject <- SystemLoginProtocolType$new()
        protocolObject$fromJSON(jsonlite::toJSON(SystemLoginConfigObject$protocol, auto_unbox = TRUE))
        self$`protocol` <- protocolObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "auth": %s,
           "host": %s,
           "port": %d,
           "protocol": %s
        }',
        self$`auth`$toJSON(),
        ifelse( is.null(self$`host`),"null",paste0(c('"', self$`host`, '"'))),
        ifelse( is.null(self$`port`),"null",paste0(c('"', self$`port`, '"'))),
        self$`protocol`$toJSON()
      )
    },
    fromJSONString = function(SystemLoginConfigJson) {
      SystemLoginConfigObject <- jsonlite::fromJSON(SystemLoginConfigJson)
      self::fromJSON(SystemLoginConfigObject)

    }
  )
)
agaveplatform/r-sdk documentation built on May 13, 2019, 8:20 a.m.