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


#' ProfileRequest Class
#'
#' A profile describing a new user to be created.
#'
#' @field username The unique username of the user
#' @field email The unique email address of the user
#' @field city The city of the user
#' @field country The country of the user
#' @field department The institutional department 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 status The status. active or deleted of the user
#' @field password The password to set for the new user
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ProfileRequest <- R6::R6Class(
  'ProfileRequest',
  public = list(
    `username` = NULL,
    `email` = NULL,
    `city` = NULL,
    `country` = NULL,
    `department` = NULL,
    `fax` = NULL,
    `firstName` = NULL,
    `gender` = NULL,
    `institution` = NULL,
    `lastName` = NULL,
    `phone` = NULL,
    `position` = NULL,
    `researchArea` = NULL,
    `state` = NULL,
    `status` = NULL,
    `password` = NULL,
    initialize = function(`username`, `email`, `city`, `country`, `department`, `fax`, `firstName`, `gender`, `institution`, `lastName`, `phone`, `position`, `researchArea`, `state`, `status`, `password`){
      if (!missing(`username`)) {
        stopifnot(is.character(`username`), length(`username`) == 1)
        self$`username` <- `username`
      }
      if (!missing(`email`)) {
        stopifnot(is.character(`email`), length(`email`) == 1)
        self$`email` <- `email`
      }
      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(`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(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
      if (!missing(`password`)) {
        stopifnot(is.character(`password`), length(`password`) == 1)
        self$`password` <- `password`
      }
    },
    asJSON = function() {
      self$toJSON()
    },
    toJSON = function() {
      ProfileRequestObject <- list()
      if (!is.null(self$`username`)) {
        ProfileRequestObject[['username']] <- self$`username`
      }
      else {
        ProfileRequestObject[['username']] <- NULL
      }
      if (!is.null(self$`email`)) {
        ProfileRequestObject[['email']] <- self$`email`
      }
      else {
        ProfileRequestObject[['email']] <- NULL
      }
      if (!is.null(self$`city`)) {
        ProfileRequestObject[['city']] <- self$`city`
      }
      else {
        ProfileRequestObject[['city']] <- NULL
      }
      if (!is.null(self$`country`)) {
        ProfileRequestObject[['country']] <- self$`country`
      }
      else {
        ProfileRequestObject[['country']] <- NULL
      }
      if (!is.null(self$`department`)) {
        ProfileRequestObject[['department']] <- self$`department`
      }
      else {
        ProfileRequestObject[['department']] <- NULL
      }
      if (!is.null(self$`fax`)) {
        ProfileRequestObject[['fax']] <- self$`fax`
      }
      else {
        ProfileRequestObject[['fax']] <- NULL
      }
      if (!is.null(self$`firstName`)) {
        ProfileRequestObject[['firstName']] <- self$`firstName`
      }
      else {
        ProfileRequestObject[['firstName']] <- NULL
      }
      if (!is.null(self$`gender`)) {
        ProfileRequestObject[['gender']] <- self$`gender`$toJSON()
      }
      else {
        ProfileRequestObject[['gender']] <- NULL
      }
      if (!is.null(self$`institution`)) {
        ProfileRequestObject[['institution']] <- self$`institution`
      }
      else {
        ProfileRequestObject[['institution']] <- NULL
      }
      if (!is.null(self$`lastName`)) {
        ProfileRequestObject[['lastName']] <- self$`lastName`
      }
      else {
        ProfileRequestObject[['lastName']] <- NULL
      }
      if (!is.null(self$`phone`)) {
        ProfileRequestObject[['phone']] <- self$`phone`
      }
      else {
        ProfileRequestObject[['phone']] <- NULL
      }
      if (!is.null(self$`position`)) {
        ProfileRequestObject[['position']] <- self$`position`
      }
      else {
        ProfileRequestObject[['position']] <- NULL
      }
      if (!is.null(self$`researchArea`)) {
        ProfileRequestObject[['researchArea']] <- self$`researchArea`
      }
      else {
        ProfileRequestObject[['researchArea']] <- NULL
      }
      if (!is.null(self$`state`)) {
        ProfileRequestObject[['state']] <- self$`state`
      }
      else {
        ProfileRequestObject[['state']] <- NULL
      }
      if (!is.null(self$`status`)) {
        ProfileRequestObject[['status']] <- self$`status`
      }
      else {
        ProfileRequestObject[['status']] <- NULL
      }
      if (!is.null(self$`password`)) {
        ProfileRequestObject[['password']] <- self$`password`
      }
      else {
        ProfileRequestObject[['password']] <- NULL
      }

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

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

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

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