R/user_info.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title UserInfo
#'
#' @description UserInfo Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field userSubjectId  character [optional]
#'
#' @field userEmail  character [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
UserInfo <- R6::R6Class(
  'UserInfo',
  public = list(
    `userSubjectId` = NULL,
    `userEmail` = NULL,
    initialize = function(
        `userSubjectId`=NULL, `userEmail`=NULL, ...
    ) {
      local.optional.var <- list(...)
      if (!is.null(`userSubjectId`)) {
        stopifnot(is.character(`userSubjectId`), length(`userSubjectId`) == 1)
        self$`userSubjectId` <- `userSubjectId`
      }
      if (!is.null(`userEmail`)) {
        stopifnot(is.character(`userEmail`), length(`userEmail`) == 1)
        self$`userEmail` <- `userEmail`
      }
    },
    toJSON = function() {
      UserInfoObject <- list()
      if (!is.null(self$`userSubjectId`)) {
        UserInfoObject[['userSubjectId']] <-
          self$`userSubjectId`
      }
      if (!is.null(self$`userEmail`)) {
        UserInfoObject[['userEmail']] <-
          self$`userEmail`
      }

      UserInfoObject
    },
    fromJSON = function(UserInfoJson) {
      UserInfoObject <- jsonlite::fromJSON(UserInfoJson)
      if (!is.null(UserInfoObject$`userSubjectId`)) {
        self$`userSubjectId` <- UserInfoObject$`userSubjectId`
      }
      if (!is.null(UserInfoObject$`userEmail`)) {
        self$`userEmail` <- UserInfoObject$`userEmail`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`userSubjectId`)) {
        sprintf(
        '"userSubjectId":
          "%s"
                ',
        self$`userSubjectId`
        )},
        if (!is.null(self$`userEmail`)) {
        sprintf(
        '"userEmail":
          "%s"
                ',
        self$`userEmail`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(UserInfoJson) {
      UserInfoObject <- jsonlite::fromJSON(UserInfoJson)
      self$`userSubjectId` <- UserInfoObject$`userSubjectId`
      self$`userEmail` <- UserInfoObject$`userEmail`
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.