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


#' Profile Class
#'
#' @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: "male" or "female"
#' @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
Profile <- R6::R6Class(
  'Profile',
  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(is.character(`gender`), length(`gender`) == 1)
        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() {
      ProfileObject <- list()
      if (!is.null(self$`city`)) {
        ProfileObject[['city']] <- self$`city`
      }
      else {
        ProfileObject[['city']] <- NULL
      }
      if (!is.null(self$`country`)) {
        ProfileObject[['country']] <- self$`country`
      }
      else {
        ProfileObject[['country']] <- NULL
      }
      if (!is.null(self$`department`)) {
        ProfileObject[['department']] <- self$`department`
      }
      else {
        ProfileObject[['department']] <- NULL
      }
      if (!is.null(self$`email`)) {
        ProfileObject[['email']] <- self$`email`
      }
      else {
        ProfileObject[['email']] <- NULL
      }
      if (!is.null(self$`fax`)) {
        ProfileObject[['fax']] <- self$`fax`
      }
      else {
        ProfileObject[['fax']] <- NULL
      }
      if (!is.null(self$`firstName`)) {
        ProfileObject[['firstName']] <- self$`firstName`
      }
      else {
        ProfileObject[['firstName']] <- NULL
      }
      if (!is.null(self$`gender`)) {
        ProfileObject[['gender']] <- self$`gender`
      }
      else {
        ProfileObject[['gender']] <- NULL
      }
      if (!is.null(self$`institution`)) {
        ProfileObject[['institution']] <- self$`institution`
      }
      else {
        ProfileObject[['institution']] <- NULL
      }
      if (!is.null(self$`lastName`)) {
        ProfileObject[['lastName']] <- self$`lastName`
      }
      else {
        ProfileObject[['lastName']] <- NULL
      }
      if (!is.null(self$`phone`)) {
        ProfileObject[['phone']] <- self$`phone`
      }
      else {
        ProfileObject[['phone']] <- NULL
      }
      if (!is.null(self$`position`)) {
        ProfileObject[['position']] <- self$`position`
      }
      else {
        ProfileObject[['position']] <- NULL
      }
      if (!is.null(self$`researchArea`)) {
        ProfileObject[['researchArea']] <- self$`researchArea`
      }
      else {
        ProfileObject[['researchArea']] <- NULL
      }
      if (!is.null(self$`state`)) {
        ProfileObject[['state']] <- self$`state`
      }
      else {
        ProfileObject[['state']] <- NULL
      }
      if (!is.null(self$`username`)) {
        ProfileObject[['username']] <- self$`username`
      }
      else {
        ProfileObject[['username']] <- NULL
      }
      if (!is.null(self$`password`)) {
        ProfileObject[['password']] <- self$`password`
      }
      else {
        ProfileObject[['password']] <- NULL
      }
      if (!is.null(self$`uuid`)) {
        ProfileObject[['uuid']] <- self$`uuid`
      }
      else {
        ProfileObject[['uuid']] <- NULL
      }

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

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

      if (!is.null(ProfileObject$`city`)) {
        self$`city` <- ProfileObject$`city`
      }
      if (!is.null(ProfileObject$`country`)) {
        self$`country` <- ProfileObject$`country`
      }
      if (!is.null(ProfileObject$`department`)) {
        self$`department` <- ProfileObject$`department`
      }
      if (!is.null(ProfileObject$`email`)) {
        self$`email` <- ProfileObject$`email`
      }
      if (!is.null(ProfileObject$`fax`)) {
        self$`fax` <- ProfileObject$`fax`
      }
      if (!is.null(ProfileObject$`firstName`)) {
        self$`firstName` <- ProfileObject$`firstName`
      }
      if (!is.null(ProfileObject$`first_name`)) {
        self$`firstName` <- ProfileObject$`first_name`
      }
      if (!is.null(ProfileObject$`gender`)) {
        self$`gender` <- ProfileObject$`gender`
      }
      if (!is.null(ProfileObject$`institution`)) {
        self$`institution` <- ProfileObject$`institution`
      }
      if (!is.null(ProfileObject$`lastName`)) {
        self$`lastName` <- ProfileObject$`lastName`
      }
      if (!is.null(ProfileObject$`lastName`)) {
        self$`lastName` <- ProfileObject$`lastName`
      }
      if (!is.null(ProfileObject$`phone`)) {
        self$`phone` <- ProfileObject$`phone`
      }
      if (!is.null(ProfileObject$`position`)) {
        self$`position` <- ProfileObject$`position`
      }
      if (!is.null(ProfileObject$`researchArea`)) {
        self$`researchArea` <- ProfileObject$`researchArea`
      }
      if (!is.null(ProfileObject$`state`)) {
        self$`state` <- ProfileObject$`state`
      }
      if (!is.null(ProfileObject$`username`)) {
        self$`username` <- ProfileObject$`username`
      }
      if (!is.null(ProfileObject$`password`)) {
        self$`password` <- ProfileObject$`password`
      }
      if (!is.null(ProfileObject$`uuid`)) {
        self$`uuid` <- ProfileObject$`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`, '"'))),
        ifelse( is.null(self$`gender`),"null",paste0(c('"', self$`gender`, '"'))),
        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(ProfileJson) {
      ProfileObject <- jsonlite::fromJSON(ProfileJson)
      self::fromJSON(ProfileObject)

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