R/entity_soft_conflict.R

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

#' @docType class
#' @title EntitySoftConflict
#'
#' @description EntitySoftConflict Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field entityType  character 
#'
#' @field entityName  character 
#'
#' @field conflicts  list( \link{EntitySoftConflict} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
EntitySoftConflict <- R6::R6Class(
  'EntitySoftConflict',
  public = list(
    `entityType` = NULL,
    `entityName` = NULL,
    `conflicts` = NULL,
    initialize = function(
        `entityType`, `entityName`, `conflicts`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`entityType`)) {
        stopifnot(is.character(`entityType`), length(`entityType`) == 1)
        self$`entityType` <- `entityType`
      }
      if (!missing(`entityName`)) {
        stopifnot(is.character(`entityName`), length(`entityName`) == 1)
        self$`entityName` <- `entityName`
      }
      if (!missing(`conflicts`)) {
        stopifnot(is.vector(`conflicts`), length(`conflicts`) != 0)
        sapply(`conflicts`, function(x) stopifnot(R6::is.R6(x)))
        self$`conflicts` <- `conflicts`
      }
    },
    toJSON = function() {
      EntitySoftConflictObject <- list()
      if (!is.null(self$`entityType`)) {
        EntitySoftConflictObject[['entityType']] <-
          self$`entityType`
      }
      if (!is.null(self$`entityName`)) {
        EntitySoftConflictObject[['entityName']] <-
          self$`entityName`
      }
      if (!is.null(self$`conflicts`)) {
        EntitySoftConflictObject[['conflicts']] <-
          lapply(self$`conflicts`, function(x) x$toJSON())
      }

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