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


#' InternalUser Class
#'
#' A virtual user profile associated with a concrete api user
#'
#' @field city The city of the user
#' @field country The country of the user
#' @field department The institutional department of the user
#' @field email The unique email address of the user
#' @field fax The fax number of the user
#' @field firstName The first name of the user
#' @field gender The gender of the user
#' @field institution The home institution of the user
#' @field lastName The last name of the user
#' @field phone The phone number of the user
#' @field position The position of employment of the user
#' @field researchArea The primary area of research of the user
#' @field state The state of the user
#' @field username The unique username of the user
#' @field password The password to set for this profile
#' @field uuid The uuid of the user
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InternalUser <- R6::R6Class(
  'InternalUser',
  public = list(
    `city` = NULL,
    `country` = NULL,
    `department` = NULL,
    `email` = NULL,
    `fax` = NULL,
    `firstName` = NULL,
    `gender` = NULL,
    `institution` = NULL,
    `lastName` = NULL,
    `phone` = NULL,
    `position` = NULL,
    `researchArea` = NULL,
    `state` = NULL,
    `username` = NULL,
    `password` = NULL,
    `uuid` = NULL,
    initialize = function(`city`, `country`, `department`, `email`, `fax`, `firstName`, `gender`, `institution`, `lastName`, `phone`, `position`, `researchArea`, `state`, `username`, `password`, `uuid`){
      if (!missing(`city`)) {
        stopifnot(is.character(`city`), length(`city`) == 1)
        self$`city` <- `city`
      }
      if (!missing(`country`)) {
        stopifnot(is.character(`country`), length(`country`) == 1)
        self$`country` <- `country`
      }
      if (!missing(`department`)) {
        stopifnot(is.character(`department`), length(`department`) == 1)
        self$`department` <- `department`
      }
      if (!missing(`email`)) {
        stopifnot(is.character(`email`), length(`email`) == 1)
        self$`email` <- `email`
      }
      if (!missing(`fax`)) {
        stopifnot(is.character(`fax`), length(`fax`) == 1)
        self$`fax` <- `fax`
      }
      if (!missing(`firstName`)) {
        stopifnot(is.character(`firstName`), length(`firstName`) == 1)
        self$`firstName` <- `firstName`
      }
      if (!missing(`gender`)) {
        stopifnot(R6::is.R6(`gender`))
        self$`gender` <- `gender`
      }
      if (!missing(`institution`)) {
        stopifnot(is.character(`institution`), length(`institution`) == 1)
        self$`institution` <- `institution`
      }
      if (!missing(`lastName`)) {
        stopifnot(is.character(`lastName`), length(`lastName`) == 1)
        self$`lastName` <- `lastName`
      }
      if (!missing(`phone`)) {
        stopifnot(is.character(`phone`), length(`phone`) == 1)
        self$`phone` <- `phone`
      }
      if (!missing(`position`)) {
        stopifnot(is.character(`position`), length(`position`) == 1)
        self$`position` <- `position`
      }
      if (!missing(`researchArea`)) {
        stopifnot(is.character(`researchArea`), length(`researchArea`) == 1)
        self$`researchArea` <- `researchArea`
      }
      if (!missing(`state`)) {
        stopifnot(is.character(`state`), length(`state`) == 1)
        self$`state` <- `state`
      }
      if (!missing(`username`)) {
        stopifnot(is.character(`username`), length(`username`) == 1)
        self$`username` <- `username`
      }
      if (!missing(`password`)) {
        stopifnot(is.character(`password`), length(`password`) == 1)
        self$`password` <- `password`
      }
      if (!missing(`uuid`)) {
        stopifnot(is.character(`uuid`), length(`uuid`) == 1)
        self$`uuid` <- `uuid`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      InternalUserObject <- list()
      if (!is.null(self$`city`)) {
        InternalUserObject[['city']] <- self$`city`
      }
      else {
        InternalUserObject[['city']] <- NULL
      }
      if (!is.null(self$`country`)) {
        InternalUserObject[['country']] <- self$`country`
      }
      else {
        InternalUserObject[['country']] <- NULL
      }
      if (!is.null(self$`department`)) {
        InternalUserObject[['department']] <- self$`department`
      }
      else {
        InternalUserObject[['department']] <- NULL
      }
      if (!is.null(self$`email`)) {
        InternalUserObject[['email']] <- self$`email`
      }
      else {
        InternalUserObject[['email']] <- NULL
      }
      if (!is.null(self$`fax`)) {
        InternalUserObject[['fax']] <- self$`fax`
      }
      else {
        InternalUserObject[['fax']] <- NULL
      }
      if (!is.null(self$`firstName`)) {
        InternalUserObject[['firstName']] <- self$`firstName`
      }
      else {
        InternalUserObject[['firstName']] <- NULL
      }
      if (!is.null(self$`gender`)) {
        InternalUserObject[['gender']] <- self$`gender`$toJSON()
      }
      else {
        InternalUserObject[['gender']] <- NULL
      }
      if (!is.null(self$`institution`)) {
        InternalUserObject[['institution']] <- self$`institution`
      }
      else {
        InternalUserObject[['institution']] <- NULL
      }
      if (!is.null(self$`lastName`)) {
        InternalUserObject[['lastName']] <- self$`lastName`
      }
      else {
        InternalUserObject[['lastName']] <- NULL
      }
      if (!is.null(self$`phone`)) {
        InternalUserObject[['phone']] <- self$`phone`
      }
      else {
        InternalUserObject[['phone']] <- NULL
      }
      if (!is.null(self$`position`)) {
        InternalUserObject[['position']] <- self$`position`
      }
      else {
        InternalUserObject[['position']] <- NULL
      }
      if (!is.null(self$`researchArea`)) {
        InternalUserObject[['researchArea']] <- self$`researchArea`
      }
      else {
        InternalUserObject[['researchArea']] <- NULL
      }
      if (!is.null(self$`state`)) {
        InternalUserObject[['state']] <- self$`state`
      }
      else {
        InternalUserObject[['state']] <- NULL
      }
      if (!is.null(self$`username`)) {
        InternalUserObject[['username']] <- self$`username`
      }
      else {
        InternalUserObject[['username']] <- NULL
      }
      if (!is.null(self$`password`)) {
        InternalUserObject[['password']] <- self$`password`
      }
      else {
        InternalUserObject[['password']] <- NULL
      }
      if (!is.null(self$`uuid`)) {
        InternalUserObject[['uuid']] <- self$`uuid`
      }
      else {
        InternalUserObject[['uuid']] <- NULL
      }

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

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

      if (!is.null(InternalUserObject$`city`)) {
        self$`city` <- InternalUserObject$`city`
      }
      if (!is.null(InternalUserObject$`country`)) {
        self$`country` <- InternalUserObject$`country`
      }
      if (!is.null(InternalUserObject$`department`)) {
        self$`department` <- InternalUserObject$`department`
      }
      if (!is.null(InternalUserObject$`email`)) {
        self$`email` <- InternalUserObject$`email`
      }
      if (!is.null(InternalUserObject$`fax`)) {
        self$`fax` <- InternalUserObject$`fax`
      }
      if (!is.null(InternalUserObject$`firstName`)) {
        self$`firstName` <- InternalUserObject$`firstName`
      }
      if (!is.null(InternalUserObject$`gender`)) {
        genderObject <- Gender$new()
        genderObject$fromJSON(jsonlite::toJSON(InternalUserObject$gender, auto_unbox = TRUE))
        self$`gender` <- genderObject
      }
      if (!is.null(InternalUserObject$`institution`)) {
        self$`institution` <- InternalUserObject$`institution`
      }
      if (!is.null(InternalUserObject$`lastName`)) {
        self$`lastName` <- InternalUserObject$`lastName`
      }
      if (!is.null(InternalUserObject$`phone`)) {
        self$`phone` <- InternalUserObject$`phone`
      }
      if (!is.null(InternalUserObject$`position`)) {
        self$`position` <- InternalUserObject$`position`
      }
      if (!is.null(InternalUserObject$`researchArea`)) {
        self$`researchArea` <- InternalUserObject$`researchArea`
      }
      if (!is.null(InternalUserObject$`state`)) {
        self$`state` <- InternalUserObject$`state`
      }
      if (!is.null(InternalUserObject$`username`)) {
        self$`username` <- InternalUserObject$`username`
      }
      if (!is.null(InternalUserObject$`password`)) {
        self$`password` <- InternalUserObject$`password`
      }
      if (!is.null(InternalUserObject$`uuid`)) {
        self$`uuid` <- InternalUserObject$`uuid`
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "city": %s,
           "country": %s,
           "department": %s,
           "email": %s,
           "fax": %s,
           "firstName": %s,
           "gender": %s,
           "institution": %s,
           "lastName": %s,
           "phone": %s,
           "position": %s,
           "researchArea": %s,
           "state": %s,
           "username": %s,
           "password": %s,
           "uuid": %s
        }',
        ifelse( is.null(self$`city`),"null",paste0(c('"', self$`city`, '"'))),
        ifelse( is.null(self$`country`),"null",paste0(c('"', self$`country`, '"'))),
        ifelse( is.null(self$`department`),"null",paste0(c('"', self$`department`, '"'))),
        ifelse( is.null(self$`email`),"null",paste0(c('"', self$`email`, '"'))),
        ifelse( is.null(self$`fax`),"null",paste0(c('"', self$`fax`, '"'))),
        ifelse( is.null(self$`firstName`),"null",paste0(c('"', self$`firstName`, '"'))),
        self$`gender`$toJSON(),
        ifelse( is.null(self$`institution`),"null",paste0(c('"', self$`institution`, '"'))),
        ifelse( is.null(self$`lastName`),"null",paste0(c('"', self$`lastName`, '"'))),
        ifelse( is.null(self$`phone`),"null",paste0(c('"', self$`phone`, '"'))),
        ifelse( is.null(self$`position`),"null",paste0(c('"', self$`position`, '"'))),
        ifelse( is.null(self$`researchArea`),"null",paste0(c('"', self$`researchArea`, '"'))),
        ifelse( is.null(self$`state`),"null",paste0(c('"', self$`state`, '"'))),
        ifelse( is.null(self$`username`),"null",paste0(c('"', self$`username`, '"'))),
        ifelse( is.null(self$`password`),"null",paste0(c('"', self$`password`, '"'))),
        ifelse( is.null(self$`uuid`),"null",paste0(c('"', self$`uuid`, '"')))
      )
    },
    fromJSONString = function(InternalUserJson) {
      InternalUserObject <- jsonlite::fromJSON(InternalUserJson)
      self::fromJSON(InternalUserObject)

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