R/workspace_acl_update_response_list.R

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

#' @docType class
#' @title WorkspaceACLUpdateResponseList
#'
#' @description WorkspaceACLUpdateResponseList Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field usersUpdated  list( \link{WorkspaceACLUpdateResponse} ) 
#'
#' @field invitesSent  list( \link{WorkspaceACLUpdate} ) 
#'
#' @field invitesUpdated  list( \link{WorkspaceACLUpdate} ) 
#'
#' @field usersNotFound  list( \link{WorkspaceACLUpdate} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
WorkspaceACLUpdateResponseList <- R6::R6Class(
  'WorkspaceACLUpdateResponseList',
  public = list(
    `usersUpdated` = NULL,
    `invitesSent` = NULL,
    `invitesUpdated` = NULL,
    `usersNotFound` = NULL,
    initialize = function(
        `usersUpdated`, `invitesSent`, `invitesUpdated`, `usersNotFound`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`usersUpdated`)) {
        stopifnot(is.vector(`usersUpdated`), length(`usersUpdated`) != 0)
        sapply(`usersUpdated`, function(x) stopifnot(R6::is.R6(x)))
        self$`usersUpdated` <- `usersUpdated`
      }
      if (!missing(`invitesSent`)) {
        stopifnot(is.vector(`invitesSent`), length(`invitesSent`) != 0)
        sapply(`invitesSent`, function(x) stopifnot(R6::is.R6(x)))
        self$`invitesSent` <- `invitesSent`
      }
      if (!missing(`invitesUpdated`)) {
        stopifnot(is.vector(`invitesUpdated`), length(`invitesUpdated`) != 0)
        sapply(`invitesUpdated`, function(x) stopifnot(R6::is.R6(x)))
        self$`invitesUpdated` <- `invitesUpdated`
      }
      if (!missing(`usersNotFound`)) {
        stopifnot(is.vector(`usersNotFound`), length(`usersNotFound`) != 0)
        sapply(`usersNotFound`, function(x) stopifnot(R6::is.R6(x)))
        self$`usersNotFound` <- `usersNotFound`
      }
    },
    toJSON = function() {
      WorkspaceACLUpdateResponseListObject <- list()
      if (!is.null(self$`usersUpdated`)) {
        WorkspaceACLUpdateResponseListObject[['usersUpdated']] <-
          lapply(self$`usersUpdated`, function(x) x$toJSON())
      }
      if (!is.null(self$`invitesSent`)) {
        WorkspaceACLUpdateResponseListObject[['invitesSent']] <-
          lapply(self$`invitesSent`, function(x) x$toJSON())
      }
      if (!is.null(self$`invitesUpdated`)) {
        WorkspaceACLUpdateResponseListObject[['invitesUpdated']] <-
          lapply(self$`invitesUpdated`, function(x) x$toJSON())
      }
      if (!is.null(self$`usersNotFound`)) {
        WorkspaceACLUpdateResponseListObject[['usersNotFound']] <-
          lapply(self$`usersNotFound`, function(x) x$toJSON())
      }

      WorkspaceACLUpdateResponseListObject
    },
    fromJSON = function(WorkspaceACLUpdateResponseListJson) {
      WorkspaceACLUpdateResponseListObject <- jsonlite::fromJSON(WorkspaceACLUpdateResponseListJson)
      if (!is.null(WorkspaceACLUpdateResponseListObject$`usersUpdated`)) {
        self$`usersUpdated` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`usersUpdated`, "array[WorkspaceACLUpdateResponse]", loadNamespace("openapi"))
      }
      if (!is.null(WorkspaceACLUpdateResponseListObject$`invitesSent`)) {
        self$`invitesSent` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`invitesSent`, "array[WorkspaceACLUpdate]", loadNamespace("openapi"))
      }
      if (!is.null(WorkspaceACLUpdateResponseListObject$`invitesUpdated`)) {
        self$`invitesUpdated` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`invitesUpdated`, "array[WorkspaceACLUpdate]", loadNamespace("openapi"))
      }
      if (!is.null(WorkspaceACLUpdateResponseListObject$`usersNotFound`)) {
        self$`usersNotFound` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`usersNotFound`, "array[WorkspaceACLUpdate]", loadNamespace("openapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`usersUpdated`)) {
        sprintf(
        '"usersUpdated":
        [%s]
',
        paste(sapply(self$`usersUpdated`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`invitesSent`)) {
        sprintf(
        '"invitesSent":
        [%s]
',
        paste(sapply(self$`invitesSent`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`invitesUpdated`)) {
        sprintf(
        '"invitesUpdated":
        [%s]
',
        paste(sapply(self$`invitesUpdated`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`usersNotFound`)) {
        sprintf(
        '"usersNotFound":
        [%s]
',
        paste(sapply(self$`usersNotFound`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(WorkspaceACLUpdateResponseListJson) {
      WorkspaceACLUpdateResponseListObject <- jsonlite::fromJSON(WorkspaceACLUpdateResponseListJson)
      self$`usersUpdated` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`usersUpdated`, "array[WorkspaceACLUpdateResponse]", loadNamespace("openapi"))
      self$`invitesSent` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`invitesSent`, "array[WorkspaceACLUpdate]", loadNamespace("openapi"))
      self$`invitesUpdated` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`invitesUpdated`, "array[WorkspaceACLUpdate]", loadNamespace("openapi"))
      self$`usersNotFound` <- ApiClient$new()$deserializeObj(WorkspaceACLUpdateResponseListObject$`usersNotFound`, "array[WorkspaceACLUpdate]", loadNamespace("openapi"))
      self
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.