# TileDB Storage Platform API
#
# TileDB Storage Platform REST API
#
# The version of the OpenAPI document: 2.2.19
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title OrganizationUser
#'
#' @description OrganizationUser Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field user_id character [optional]
#'
#' @field organization_id character [optional]
#'
#' @field username character [optional]
#'
#' @field organization_name character [optional]
#'
#' @field role \link{OrganizationRoles} [optional]
#'
#' @field allowed_actions list( \link{NamespaceActions} ) [optional]
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
OrganizationUser <- R6::R6Class(
'OrganizationUser',
public = list(
`user_id` = NULL,
`organization_id` = NULL,
`username` = NULL,
`organization_name` = NULL,
`role` = NULL,
`allowed_actions` = NULL,
initialize = function(
`user_id`=NULL, `organization_id`=NULL, `username`=NULL, `organization_name`=NULL, `role`=NULL, `allowed_actions`=NULL, ...
) {
local.optional.var <- list(...)
if (!is.null(`user_id`)) {
stopifnot(is.character(`user_id`), length(`user_id`) == 1)
self$`user_id` <- `user_id`
}
if (!is.null(`organization_id`)) {
stopifnot(is.character(`organization_id`), length(`organization_id`) == 1)
self$`organization_id` <- `organization_id`
}
if (!is.null(`username`)) {
stopifnot(is.character(`username`), length(`username`) == 1)
self$`username` <- `username`
}
if (!is.null(`organization_name`)) {
stopifnot(is.character(`organization_name`), length(`organization_name`) == 1)
self$`organization_name` <- `organization_name`
}
if (!is.null(`role`)) {
stopifnot(R6::is.R6(`role`))
self$`role` <- `role`
}
if (!is.null(`allowed_actions`)) {
stopifnot(is.vector(`allowed_actions`), length(`allowed_actions`) != 0)
sapply(`allowed_actions`, function(x) stopifnot(R6::is.R6(x)))
self$`allowed_actions` <- `allowed_actions`
}
},
toJSON = function() {
OrganizationUserObject <- list()
if (!is.null(self$`user_id`)) {
OrganizationUserObject[['user_id']] <-
self$`user_id`
}
if (!is.null(self$`organization_id`)) {
OrganizationUserObject[['organization_id']] <-
self$`organization_id`
}
if (!is.null(self$`username`)) {
OrganizationUserObject[['username']] <-
self$`username`
}
if (!is.null(self$`organization_name`)) {
OrganizationUserObject[['organization_name']] <-
self$`organization_name`
}
if (!is.null(self$`role`)) {
OrganizationUserObject[['role']] <-
self$`role`$toJSON()
}
if (!is.null(self$`allowed_actions`)) {
OrganizationUserObject[['allowed_actions']] <-
lapply(self$`allowed_actions`, function(x) x$toJSON())
}
OrganizationUserObject
},
fromJSON = function(OrganizationUserJson) {
OrganizationUserObject <- jsonlite::fromJSON(OrganizationUserJson)
if (!is.null(OrganizationUserObject$`user_id`)) {
self$`user_id` <- OrganizationUserObject$`user_id`
}
if (!is.null(OrganizationUserObject$`organization_id`)) {
self$`organization_id` <- OrganizationUserObject$`organization_id`
}
if (!is.null(OrganizationUserObject$`username`)) {
self$`username` <- OrganizationUserObject$`username`
}
if (!is.null(OrganizationUserObject$`organization_name`)) {
self$`organization_name` <- OrganizationUserObject$`organization_name`
}
if (!is.null(OrganizationUserObject$`role`)) {
# MANUAL EDIT AFTER OPENAPI AUTOGEN
# For enums, OpenAPI autogen (1) generates a constructor which requires being called
# with one arguent; (2) generates callsites (such as here) that calls that constructor
# with zero arguments.
#
#roleObject <- OrganizationRoles$new()
#roleObject$fromJSON(jsonlite::toJSON(OrganizationUserObject$role, auto_unbox = TRUE, digits = NA))
roleObject <- OrganizationRoles$new(OrganizationUserObject$role)
self$`role` <- roleObject
}
if (!is.null(OrganizationUserObject$`allowed_actions`)) {
self$`allowed_actions` <- ApiClient$new()$deserializeObj(OrganizationUserObject$`allowed_actions`, "array[NamespaceActions]", loadNamespace("tiledbcloud"))
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`user_id`)) {
sprintf(
'"user_id":
"%s"
',
self$`user_id`
)},
if (!is.null(self$`organization_id`)) {
sprintf(
'"organization_id":
"%s"
',
self$`organization_id`
)},
if (!is.null(self$`username`)) {
sprintf(
'"username":
"%s"
',
self$`username`
)},
if (!is.null(self$`organization_name`)) {
sprintf(
'"organization_name":
"%s"
',
self$`organization_name`
)},
if (!is.null(self$`role`)) {
sprintf(
'"role":
%s
',
jsonlite::toJSON(self$`role`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`allowed_actions`)) {
sprintf(
'"allowed_actions":
[%s]
',
paste(sapply(self$`allowed_actions`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(OrganizationUserJson) {
OrganizationUserObject <- jsonlite::fromJSON(OrganizationUserJson)
self$`user_id` <- OrganizationUserObject$`user_id`
self$`organization_id` <- OrganizationUserObject$`organization_id`
self$`username` <- OrganizationUserObject$`username`
self$`organization_name` <- OrganizationUserObject$`organization_name`
self$`role` <- OrganizationRoles$new()$fromJSON(jsonlite::toJSON(OrganizationUserObject$role, auto_unbox = TRUE, digits = NA))
self$`allowed_actions` <- ApiClient$new()$deserializeObj(OrganizationUserObject$`allowed_actions`, "array[NamespaceActions]", loadNamespace("tiledbcloud"))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.